From 3ca08455c751c031c54134e3d5afdb1a0e8bfedc Mon Sep 17 00:00:00 2001 From: Ashna Shaj Date: Tue, 12 May 2026 16:57:20 +0530 Subject: [PATCH] v3 and v1 changes - Signed-off-by: Ashna Shaj --- go.mod | 2 +- go.sum | 49 +- .../watsonx_data_v3.go | 33439 ++++++++------ .../watsonx_data_v3_integration_test.go | 3726 +- .../watsonx_data_v3_suite_test.go | 8 +- .../watsonx_data_v3_test.go | 37861 +++++++++------- 6 files changed, 43324 insertions(+), 31761 deletions(-) rename watsonxdatav2/watsonx_data_v2.go => watsonxdatav3/watsonx_data_v3.go (55%) rename watsonxdatav2/watsonx_data_v2_integration_test.go => watsonxdatav3/watsonx_data_v3_integration_test.go (50%) rename watsonxdatav2/watsonx_data_v2_suite_test.go => watsonxdatav3/watsonx_data_v3_suite_test.go (83%) rename watsonxdatav2/watsonx_data_v2_test.go => watsonxdatav3/watsonx_data_v3_test.go (56%) diff --git a/go.mod b/go.mod index 0ffd592..74d3c1a 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.23 toolchain go1.23.4 require ( - github.com/IBM/go-sdk-core/v5 v5.18.1 //Updated version + github.com/IBM/go-sdk-core/v5 v5.18.1 //Updated version github.com/go-openapi/strfmt v0.23.0 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.36.0 diff --git a/go.sum b/go.sum index 45a9887..bd87699 100644 --- a/go.sum +++ b/go.sum @@ -9,23 +9,15 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= -github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/gabriel-vasile/mimetype v1.4.7 h1:SKFKl7kD0RiPdbht0s7hFtjl489WcQ1VyPW8ZzUMYCA= github.com/gabriel-vasile/mimetype v1.4.7/go.mod h1:GDlAgAyIRT27BhFl53XNAFtfjzOkLaF35JdEG0P7LtU= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY= -github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= -github.com/go-openapi/strfmt v0.22.1 h1:5Ky8cybT4576C6Ffc+8gYji/wRXCo6Ozm8RaWjPI6jc= -github.com/go-openapi/strfmt v0.22.1/go.mod h1:OfVoytIXJasDkkGvkb1Cceb3BPyMOwk1FgmyyEw7NYg= github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c= github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= @@ -34,33 +26,26 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= -github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-playground/validator/v10 v10.23.0 h1:/PwmTwZhS0dPkav3cdK9kV1FsAmrL8sThn8IHr/sO+o= github.com/go-playground/validator/v10 v10.23.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= -github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= +github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -83,7 +68,6 @@ github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= @@ -93,33 +77,24 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU= -github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= github.com/onsi/ginkgo/v2 v2.20.1 h1:YlVIbqct+ZmnEph770q9Q7NVAz4wwIiVNahee6JyUzo= +github.com/onsi/ginkgo/v2 v2.20.1/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= -github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= github.com/onsi/gomega v1.36.0 h1:Pb12RlruUtj4XUuPUqeEWc6j5DkVVVA49Uf6YLfC95Y= github.com/onsi/gomega v1.36.0/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= -go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM= go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -128,8 +103,6 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -145,22 +118,17 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= +golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -171,9 +139,8 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/watsonxdatav2/watsonx_data_v2.go b/watsonxdatav3/watsonx_data_v3.go similarity index 55% rename from watsonxdatav2/watsonx_data_v2.go rename to watsonxdatav3/watsonx_data_v3.go index d2a6b60..b7dedd0 100644 --- a/watsonxdatav2/watsonx_data_v2.go +++ b/watsonxdatav3/watsonx_data_v3.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2025. + * (C) Copyright IBM Corp. 2026. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ * IBM OpenAPI SDK Code Generator Version: 3.104.0-b4a47c49-20250418-184351 */ -// Package watsonxdatav2 : Operations and models for the WatsonxDataV2 service -package watsonxdatav2 +// Package watsonxdatav3 : Operations and models for the WatsonxDataV3 service +package watsonxdatav3 import ( "context" @@ -33,30 +33,31 @@ import ( "github.com/IBM/go-sdk-core/v5/core" common "github.com/IBM/watsonxdata-go-sdk/common" + "github.com/go-openapi/strfmt" ) -// WatsonxDataV2 : This is the Public API for IBM watsonx.data +// WatsonxDataV3 : This is the Public API for IBM watsonx.data // -// API Version: 2.0.0 -type WatsonxDataV2 struct { +// API Version: 3.0.0 +type WatsonxDataV3 struct { Service *core.BaseService } // DefaultServiceURL is the default URL to make service requests to. -const DefaultServiceURL = "https://region.lakehouse.cloud.ibm.com/lakehouse/api/v2" +const DefaultServiceURL = "https://region.lakehouse.cloud.ibm.com/lakehouse/api" // DefaultServiceName is the default key used to find external configuration information. const DefaultServiceName = "watsonx_data" -// WatsonxDataV2Options : Service options -type WatsonxDataV2Options struct { +// WatsonxDataV3Options : Service options +type WatsonxDataV3Options struct { ServiceName string URL string Authenticator core.Authenticator } -// NewWatsonxDataV2UsingExternalConfig : constructs an instance of WatsonxDataV2 with passed in options and external configuration. -func NewWatsonxDataV2UsingExternalConfig(options *WatsonxDataV2Options) (watsonxData *WatsonxDataV2, err error) { +// NewWatsonxDataV3UsingExternalConfig : constructs an instance of WatsonxDataV3 with passed in options and external configuration. +func NewWatsonxDataV3UsingExternalConfig(options *WatsonxDataV3Options) (watsonxData *WatsonxDataV3, err error) { if options.ServiceName == "" { options.ServiceName = DefaultServiceName } @@ -69,7 +70,7 @@ func NewWatsonxDataV2UsingExternalConfig(options *WatsonxDataV2Options) (watsonx } } - watsonxData, err = NewWatsonxDataV2(options) + watsonxData, err = NewWatsonxDataV3(options) err = core.RepurposeSDKProblem(err, "new-client-error") if err != nil { return @@ -88,8 +89,8 @@ func NewWatsonxDataV2UsingExternalConfig(options *WatsonxDataV2Options) (watsonx return } -// NewWatsonxDataV2 : constructs an instance of WatsonxDataV2 with passed in options. -func NewWatsonxDataV2(options *WatsonxDataV2Options) (service *WatsonxDataV2, err error) { +// NewWatsonxDataV3 : constructs an instance of WatsonxDataV3 with passed in options. +func NewWatsonxDataV3(options *WatsonxDataV3Options) (service *WatsonxDataV3, err error) { serviceOptions := &core.ServiceOptions{ URL: DefaultServiceURL, Authenticator: options.Authenticator, @@ -109,7 +110,7 @@ func NewWatsonxDataV2(options *WatsonxDataV2Options) (service *WatsonxDataV2, er } } - service = &WatsonxDataV2{ + service = &WatsonxDataV3{ Service: baseService, } @@ -122,7 +123,7 @@ func GetServiceURLForRegion(region string) (string, error) { } // Clone makes a copy of "watsonxData" suitable for processing requests. -func (watsonxData *WatsonxDataV2) Clone() *WatsonxDataV2 { +func (watsonxData *WatsonxDataV3) Clone() *WatsonxDataV3 { if core.IsNil(watsonxData) { return nil } @@ -132,7 +133,7 @@ func (watsonxData *WatsonxDataV2) Clone() *WatsonxDataV2 { } // SetServiceURL sets the service URL -func (watsonxData *WatsonxDataV2) SetServiceURL(url string) error { +func (watsonxData *WatsonxDataV3) SetServiceURL(url string) error { err := watsonxData.Service.SetServiceURL(url) if err != nil { err = core.SDKErrorf(err, "", "url-set-error", common.GetComponentInfo()) @@ -141,47 +142,151 @@ func (watsonxData *WatsonxDataV2) SetServiceURL(url string) error { } // GetServiceURL returns the service URL -func (watsonxData *WatsonxDataV2) GetServiceURL() string { +func (watsonxData *WatsonxDataV3) GetServiceURL() string { return watsonxData.Service.GetServiceURL() } // SetDefaultHeaders sets HTTP headers to be sent in every request -func (watsonxData *WatsonxDataV2) SetDefaultHeaders(headers http.Header) { +func (watsonxData *WatsonxDataV3) SetDefaultHeaders(headers http.Header) { watsonxData.Service.SetDefaultHeaders(headers) } // SetEnableGzipCompression sets the service's EnableGzipCompression field -func (watsonxData *WatsonxDataV2) SetEnableGzipCompression(enableGzip bool) { +func (watsonxData *WatsonxDataV3) SetEnableGzipCompression(enableGzip bool) { watsonxData.Service.SetEnableGzipCompression(enableGzip) } // GetEnableGzipCompression returns the service's EnableGzipCompression field -func (watsonxData *WatsonxDataV2) GetEnableGzipCompression() bool { +func (watsonxData *WatsonxDataV3) GetEnableGzipCompression() bool { return watsonxData.Service.GetEnableGzipCompression() } // EnableRetries enables automatic retries for requests invoked for this service instance. // If either parameter is specified as 0, then a default value is used instead. -func (watsonxData *WatsonxDataV2) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { +func (watsonxData *WatsonxDataV3) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { watsonxData.Service.EnableRetries(maxRetries, maxRetryInterval) } // DisableRetries disables automatic retries for requests invoked for this service instance. -func (watsonxData *WatsonxDataV2) DisableRetries() { +func (watsonxData *WatsonxDataV3) DisableRetries() { watsonxData.Service.DisableRetries() } -// ListBucketRegistrations : Get bucket registrations -// Get list of registered buckets. -func (watsonxData *WatsonxDataV2) ListBucketRegistrations(listBucketRegistrationsOptions *ListBucketRegistrationsOptions) (result *BucketRegistrationCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListBucketRegistrationsWithContext(context.Background(), listBucketRegistrationsOptions) +// CreateHdfsStorage : Add/Create HDFS storage +// Add or create a new HDFS database. +func (watsonxData *WatsonxDataV3) CreateHdfsStorage(createHdfsStorageOptions *CreateHdfsStorageOptions) (result *HdfsStorageRegistration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateHdfsStorageWithContext(context.Background(), createHdfsStorageOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// CreateHdfsStorageWithContext is an alternate form of the CreateHdfsStorage method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateHdfsStorageWithContext(ctx context.Context, createHdfsStorageOptions *CreateHdfsStorageOptions) (result *HdfsStorageRegistration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createHdfsStorageOptions, "createHdfsStorageOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createHdfsStorageOptions, "createHdfsStorageOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/storage_hdfs_registrations`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range createHdfsStorageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateHdfsStorage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if createHdfsStorageOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createHdfsStorageOptions.AuthInstanceID)) + } + + builder.AddFormData("display_name", "", "", fmt.Sprint(*createHdfsStorageOptions.DisplayName)) + builder.AddFormData("type", "", "", fmt.Sprint(*createHdfsStorageOptions.Type)) + builder.AddFormData("hms_thrift_uri", "", "", fmt.Sprint(*createHdfsStorageOptions.HmsThriftURI)) + builder.AddFormData("hms_thrift_port", "", "", fmt.Sprint(*createHdfsStorageOptions.HmsThriftPort)) + builder.AddFormData("core_site", "", "", fmt.Sprint(*createHdfsStorageOptions.CoreSite)) + builder.AddFormData("hdfs_site", "", "", fmt.Sprint(*createHdfsStorageOptions.HdfsSite)) + builder.AddFormData("kerberos", "", "", fmt.Sprint(*createHdfsStorageOptions.Kerberos)) + builder.AddFormData("catalog_name", "", "", fmt.Sprint(*createHdfsStorageOptions.CatalogName)) + builder.AddFormData("catalog_type", "", "", fmt.Sprint(*createHdfsStorageOptions.CatalogType)) + if createHdfsStorageOptions.Krb5Config != nil { + builder.AddFormData("krb5_config", "", "", fmt.Sprint(*createHdfsStorageOptions.Krb5Config)) + } + if createHdfsStorageOptions.HiveKeytab != nil { + builder.AddFormData("hive_keytab", "filename", + core.StringNilMapper(createHdfsStorageOptions.HiveKeytabContentType), createHdfsStorageOptions.HiveKeytab) + } + if createHdfsStorageOptions.HdfsKeytab != nil { + builder.AddFormData("hdfs_keytab", "filename", + core.StringNilMapper(createHdfsStorageOptions.HdfsKeytabContentType), createHdfsStorageOptions.HdfsKeytab) + } + if createHdfsStorageOptions.HiveServerPrincipal != nil { + builder.AddFormData("hive_server_principal", "", "", fmt.Sprint(*createHdfsStorageOptions.HiveServerPrincipal)) + } + if createHdfsStorageOptions.HiveClientPrincipal != nil { + builder.AddFormData("hive_client_principal", "", "", fmt.Sprint(*createHdfsStorageOptions.HiveClientPrincipal)) + } + if createHdfsStorageOptions.HdfsPrincipal != nil { + builder.AddFormData("hdfs_principal", "", "", fmt.Sprint(*createHdfsStorageOptions.HdfsPrincipal)) + } + if createHdfsStorageOptions.Description != nil { + builder.AddFormData("description", "", "", fmt.Sprint(*createHdfsStorageOptions.Description)) + } + if createHdfsStorageOptions.CreatedAt != nil { + builder.AddFormData("created_at", "", "", fmt.Sprint(*createHdfsStorageOptions.CreatedAt)) + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "create_hdfs_storage", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalHdfsStorageRegistration) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// ListStorageRegistrations : Get list of storage registrations +// Get list of storage registrations. +func (watsonxData *WatsonxDataV3) ListStorageRegistrations(listStorageRegistrationsOptions *ListStorageRegistrationsOptions) (result *StorageRegistrationCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListStorageRegistrationsWithContext(context.Background(), listStorageRegistrationsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBucketRegistrationsWithContext is an alternate form of the ListBucketRegistrations method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListBucketRegistrationsWithContext(ctx context.Context, listBucketRegistrationsOptions *ListBucketRegistrationsOptions) (result *BucketRegistrationCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listBucketRegistrationsOptions, "listBucketRegistrationsOptions") +// ListStorageRegistrationsWithContext is an alternate form of the ListStorageRegistrations method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListStorageRegistrationsWithContext(ctx context.Context, listStorageRegistrationsOptions *ListStorageRegistrationsOptions) (result *StorageRegistrationCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listStorageRegistrationsOptions, "listStorageRegistrationsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -190,23 +295,23 @@ func (watsonxData *WatsonxDataV2) ListBucketRegistrationsWithContext(ctx context builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/bucket_registrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/storage_registrations`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBucketRegistrationsOptions.Headers { + for headerName, headerValue := range listStorageRegistrationsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListBucketRegistrations") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListStorageRegistrations") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listBucketRegistrationsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listBucketRegistrationsOptions.AuthInstanceID)) + if listStorageRegistrationsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listStorageRegistrationsOptions.AuthInstanceID)) } request, err := builder.Build() @@ -218,12 +323,12 @@ func (watsonxData *WatsonxDataV2) ListBucketRegistrationsWithContext(ctx context var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bucket_registrations", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_storage_registrations", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBucketRegistrationCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalStorageRegistrationCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -234,22 +339,22 @@ func (watsonxData *WatsonxDataV2) ListBucketRegistrationsWithContext(ctx context return } -// CreateBucketRegistration : Register bucket -// Register a new bucket. -func (watsonxData *WatsonxDataV2) CreateBucketRegistration(createBucketRegistrationOptions *CreateBucketRegistrationOptions) (result *BucketRegistration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateBucketRegistrationWithContext(context.Background(), createBucketRegistrationOptions) +// CreateStorageRegistration : Register storage +// Register a new storage. +func (watsonxData *WatsonxDataV3) CreateStorageRegistration(createStorageRegistrationOptions *CreateStorageRegistrationOptions) (result *StorageRegistration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateStorageRegistrationWithContext(context.Background(), createStorageRegistrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateBucketRegistrationWithContext is an alternate form of the CreateBucketRegistration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateBucketRegistrationWithContext(ctx context.Context, createBucketRegistrationOptions *CreateBucketRegistrationOptions) (result *BucketRegistration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createBucketRegistrationOptions, "createBucketRegistrationOptions cannot be nil") +// CreateStorageRegistrationWithContext is an alternate form of the CreateStorageRegistration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateStorageRegistrationWithContext(ctx context.Context, createStorageRegistrationOptions *CreateStorageRegistrationOptions) (result *StorageRegistration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createStorageRegistrationOptions, "createStorageRegistrationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createBucketRegistrationOptions, "createBucketRegistrationOptions") + err = core.ValidateStruct(createStorageRegistrationOptions, "createStorageRegistrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -258,53 +363,53 @@ func (watsonxData *WatsonxDataV2) CreateBucketRegistrationWithContext(ctx contex builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/bucket_registrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/storage_registrations`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createBucketRegistrationOptions.Headers { + for headerName, headerValue := range createStorageRegistrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateBucketRegistration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateStorageRegistration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if createBucketRegistrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createBucketRegistrationOptions.AuthInstanceID)) + if createStorageRegistrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createStorageRegistrationOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if createBucketRegistrationOptions.BucketType != nil { - body["bucket_type"] = createBucketRegistrationOptions.BucketType + if createStorageRegistrationOptions.Description != nil { + body["description"] = createStorageRegistrationOptions.Description } - if createBucketRegistrationOptions.Description != nil { - body["description"] = createBucketRegistrationOptions.Description + if createStorageRegistrationOptions.DisplayName != nil { + body["display_name"] = createStorageRegistrationOptions.DisplayName } - if createBucketRegistrationOptions.ManagedBy != nil { - body["managed_by"] = createBucketRegistrationOptions.ManagedBy + if createStorageRegistrationOptions.ManagedBy != nil { + body["managed_by"] = createStorageRegistrationOptions.ManagedBy } - if createBucketRegistrationOptions.AssociatedCatalog != nil { - body["associated_catalog"] = createBucketRegistrationOptions.AssociatedCatalog + if createStorageRegistrationOptions.Type != nil { + body["type"] = createStorageRegistrationOptions.Type } - if createBucketRegistrationOptions.BucketDetails != nil { - body["bucket_details"] = createBucketRegistrationOptions.BucketDetails + if createStorageRegistrationOptions.AssociatedCatalog != nil { + body["associated_catalog"] = createStorageRegistrationOptions.AssociatedCatalog } - if createBucketRegistrationOptions.BucketDisplayName != nil { - body["bucket_display_name"] = createBucketRegistrationOptions.BucketDisplayName + if createStorageRegistrationOptions.Connection != nil { + body["connection"] = createStorageRegistrationOptions.Connection } - if createBucketRegistrationOptions.Region != nil { - body["region"] = createBucketRegistrationOptions.Region + if createStorageRegistrationOptions.Region != nil { + body["region"] = createStorageRegistrationOptions.Region } - if createBucketRegistrationOptions.StorageDetails != nil { - body["storage_details"] = createBucketRegistrationOptions.StorageDetails + if createStorageRegistrationOptions.StorageUse != nil { + body["storage_use"] = createStorageRegistrationOptions.StorageUse } - if createBucketRegistrationOptions.Tags != nil { - body["tags"] = createBucketRegistrationOptions.Tags + if createStorageRegistrationOptions.Tags != nil { + body["tags"] = createStorageRegistrationOptions.Tags } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -321,12 +426,12 @@ func (watsonxData *WatsonxDataV2) CreateBucketRegistrationWithContext(ctx contex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_bucket_registration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_storage_registration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBucketRegistration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalStorageRegistration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -337,51 +442,55 @@ func (watsonxData *WatsonxDataV2) CreateBucketRegistrationWithContext(ctx contex return } -// GetBucketRegistration : Get bucket -// Get a registered bucket. -func (watsonxData *WatsonxDataV2) GetBucketRegistration(getBucketRegistrationOptions *GetBucketRegistrationOptions) (result *BucketRegistration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetBucketRegistrationWithContext(context.Background(), getBucketRegistrationOptions) +// GetStorageRegistration : Get storage +// Get a registered storage. +func (watsonxData *WatsonxDataV3) GetStorageRegistration(getStorageRegistrationOptions *GetStorageRegistrationOptions) (result *StorageRegistration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetStorageRegistrationWithContext(context.Background(), getStorageRegistrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBucketRegistrationWithContext is an alternate form of the GetBucketRegistration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetBucketRegistrationWithContext(ctx context.Context, getBucketRegistrationOptions *GetBucketRegistrationOptions) (result *BucketRegistration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBucketRegistrationOptions, "getBucketRegistrationOptions cannot be nil") +// GetStorageRegistrationWithContext is an alternate form of the GetStorageRegistration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetStorageRegistrationWithContext(ctx context.Context, getStorageRegistrationOptions *GetStorageRegistrationOptions) (result *StorageRegistration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getStorageRegistrationOptions, "getStorageRegistrationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBucketRegistrationOptions, "getBucketRegistrationOptions") + err = core.ValidateStruct(getStorageRegistrationOptions, "getStorageRegistrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bucket_id": *getBucketRegistrationOptions.BucketID, + "id": *getStorageRegistrationOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/bucket_registrations/{bucket_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/storage_registrations/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBucketRegistrationOptions.Headers { + for headerName, headerValue := range getStorageRegistrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetBucketRegistration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetStorageRegistration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getBucketRegistrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getBucketRegistrationOptions.AuthInstanceID)) + if getStorageRegistrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getStorageRegistrationOptions.AuthInstanceID)) + } + + if getStorageRegistrationOptions.SkipMdsCall != nil { + builder.AddQuery("skip_mds_call", fmt.Sprint(*getStorageRegistrationOptions.SkipMdsCall)) } request, err := builder.Build() @@ -393,12 +502,12 @@ func (watsonxData *WatsonxDataV2) GetBucketRegistrationWithContext(ctx context.C var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bucket_registration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_storage_registration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBucketRegistration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalStorageRegistration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -409,50 +518,54 @@ func (watsonxData *WatsonxDataV2) GetBucketRegistrationWithContext(ctx context.C return } -// DeleteBucketRegistration : Deregister Bucket -// Deregister a bucket. -func (watsonxData *WatsonxDataV2) DeleteBucketRegistration(deleteBucketRegistrationOptions *DeleteBucketRegistrationOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteBucketRegistrationWithContext(context.Background(), deleteBucketRegistrationOptions) +// DeleteStorageRegistration : Unregister Storage +// Unregister a storage. +func (watsonxData *WatsonxDataV3) DeleteStorageRegistration(deleteStorageRegistrationOptions *DeleteStorageRegistrationOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteStorageRegistrationWithContext(context.Background(), deleteStorageRegistrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteBucketRegistrationWithContext is an alternate form of the DeleteBucketRegistration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteBucketRegistrationWithContext(ctx context.Context, deleteBucketRegistrationOptions *DeleteBucketRegistrationOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteBucketRegistrationOptions, "deleteBucketRegistrationOptions cannot be nil") +// DeleteStorageRegistrationWithContext is an alternate form of the DeleteStorageRegistration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteStorageRegistrationWithContext(ctx context.Context, deleteStorageRegistrationOptions *DeleteStorageRegistrationOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteStorageRegistrationOptions, "deleteStorageRegistrationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteBucketRegistrationOptions, "deleteBucketRegistrationOptions") + err = core.ValidateStruct(deleteStorageRegistrationOptions, "deleteStorageRegistrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bucket_id": *deleteBucketRegistrationOptions.BucketID, + "id": *deleteStorageRegistrationOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/bucket_registrations/{bucket_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/storage_registrations/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteBucketRegistrationOptions.Headers { + for headerName, headerValue := range deleteStorageRegistrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteBucketRegistration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteStorageRegistration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteBucketRegistrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteBucketRegistrationOptions.AuthInstanceID)) + if deleteStorageRegistrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteStorageRegistrationOptions.AuthInstanceID)) + } + + if deleteStorageRegistrationOptions.SkipMdsCall != nil { + builder.AddQuery("skip_mds_call", fmt.Sprint(*deleteStorageRegistrationOptions.SkipMdsCall)) } request, err := builder.Build() @@ -463,7 +576,7 @@ func (watsonxData *WatsonxDataV2) DeleteBucketRegistrationWithContext(ctx contex response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_bucket_registration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_storage_registration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -471,55 +584,59 @@ func (watsonxData *WatsonxDataV2) DeleteBucketRegistrationWithContext(ctx contex return } -// UpdateBucketRegistration : Update bucket -// Update bucket details & credentials. -func (watsonxData *WatsonxDataV2) UpdateBucketRegistration(updateBucketRegistrationOptions *UpdateBucketRegistrationOptions) (result *BucketRegistration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateBucketRegistrationWithContext(context.Background(), updateBucketRegistrationOptions) +// UpdateStorageRegistration : Update storage +// Update storage details & credentials. +func (watsonxData *WatsonxDataV3) UpdateStorageRegistration(updateStorageRegistrationOptions *UpdateStorageRegistrationOptions) (result *StorageRegistration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateStorageRegistrationWithContext(context.Background(), updateStorageRegistrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateBucketRegistrationWithContext is an alternate form of the UpdateBucketRegistration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateBucketRegistrationWithContext(ctx context.Context, updateBucketRegistrationOptions *UpdateBucketRegistrationOptions) (result *BucketRegistration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateBucketRegistrationOptions, "updateBucketRegistrationOptions cannot be nil") +// UpdateStorageRegistrationWithContext is an alternate form of the UpdateStorageRegistration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateStorageRegistrationWithContext(ctx context.Context, updateStorageRegistrationOptions *UpdateStorageRegistrationOptions) (result *StorageRegistration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateStorageRegistrationOptions, "updateStorageRegistrationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateBucketRegistrationOptions, "updateBucketRegistrationOptions") + err = core.ValidateStruct(updateStorageRegistrationOptions, "updateStorageRegistrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bucket_id": *updateBucketRegistrationOptions.BucketID, + "id": *updateStorageRegistrationOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/bucket_registrations/{bucket_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/storage_registrations/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateBucketRegistrationOptions.Headers { + for headerName, headerValue := range updateStorageRegistrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateBucketRegistration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateStorageRegistration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateBucketRegistrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateBucketRegistrationOptions.AuthInstanceID)) + if updateStorageRegistrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateStorageRegistrationOptions.AuthInstanceID)) } - _, err = builder.SetBodyContentJSON(updateBucketRegistrationOptions.Body) + if updateStorageRegistrationOptions.SkipMdsCall != nil { + builder.AddQuery("skip_mds_call", fmt.Sprint(*updateStorageRegistrationOptions.SkipMdsCall)) + } + + _, err = builder.SetBodyContentJSON(updateStorageRegistrationOptions.Body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -534,12 +651,12 @@ func (watsonxData *WatsonxDataV2) UpdateBucketRegistrationWithContext(ctx contex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_bucket_registration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_storage_registration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBucketRegistration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalStorageRegistration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -550,51 +667,75 @@ func (watsonxData *WatsonxDataV2) UpdateBucketRegistrationWithContext(ctx contex return } -// CreateActivateBucket : Activate Bucket -// Activate a registered bucket. -func (watsonxData *WatsonxDataV2) CreateActivateBucket(createActivateBucketOptions *CreateActivateBucketOptions) (result *CreateActivateBucketCreatedBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateActivateBucketWithContext(context.Background(), createActivateBucketOptions) +// AddStorageCatalog : Add storage catalog +// Add storage catalog. +func (watsonxData *WatsonxDataV3) AddStorageCatalog(addStorageCatalogOptions *AddStorageCatalogOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.AddStorageCatalogWithContext(context.Background(), addStorageCatalogOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateActivateBucketWithContext is an alternate form of the CreateActivateBucket method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateActivateBucketWithContext(ctx context.Context, createActivateBucketOptions *CreateActivateBucketOptions) (result *CreateActivateBucketCreatedBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createActivateBucketOptions, "createActivateBucketOptions cannot be nil") +// AddStorageCatalogWithContext is an alternate form of the AddStorageCatalog method which supports a Context parameter +func (watsonxData *WatsonxDataV3) AddStorageCatalogWithContext(ctx context.Context, addStorageCatalogOptions *AddStorageCatalogOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addStorageCatalogOptions, "addStorageCatalogOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createActivateBucketOptions, "createActivateBucketOptions") + err = core.ValidateStruct(addStorageCatalogOptions, "addStorageCatalogOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bucket_id": *createActivateBucketOptions.BucketID, + "storage_id": *addStorageCatalogOptions.StorageID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/bucket_registrations/{bucket_id}/activate`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/storage_registrations/{storage_id}/catalogs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createActivateBucketOptions.Headers { + for headerName, headerValue := range addStorageCatalogOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateActivateBucket") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "AddStorageCatalog") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if createActivateBucketOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createActivateBucketOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if addStorageCatalogOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*addStorageCatalogOptions.AuthInstanceID)) + } + + if addStorageCatalogOptions.SkipMdsCall != nil { + builder.AddQuery("skip_mds_call", fmt.Sprint(*addStorageCatalogOptions.SkipMdsCall)) + } + + body := make(map[string]interface{}) + if addStorageCatalogOptions.CatalogTags != nil { + body["catalog_tags"] = addStorageCatalogOptions.CatalogTags + } + if addStorageCatalogOptions.BasePath != nil { + body["base_path"] = addStorageCatalogOptions.BasePath + } + if addStorageCatalogOptions.CatalogName != nil { + body["catalog_name"] = addStorageCatalogOptions.CatalogName + } + if addStorageCatalogOptions.CatalogType != nil { + body["catalog_type"] = addStorageCatalogOptions.CatalogType + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -606,12 +747,12 @@ func (watsonxData *WatsonxDataV2) CreateActivateBucketWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_activate_bucket", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_storage_catalog", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCreateActivateBucketCreatedBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -622,66 +763,57 @@ func (watsonxData *WatsonxDataV2) CreateActivateBucketWithContext(ctx context.Co return } -// AddBucketCatalog : Add bucket catalog -// Add bucket catalog. -func (watsonxData *WatsonxDataV2) AddBucketCatalog(addBucketCatalogOptions *AddBucketCatalogOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.AddBucketCatalogWithContext(context.Background(), addBucketCatalogOptions) +// GetStorageObjectProperties : Get storage object properties +// Get storage object properties. +func (watsonxData *WatsonxDataV3) GetStorageObjectProperties(getStorageObjectPropertiesOptions *GetStorageObjectPropertiesOptions) (result *StorageObjectProperties, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetStorageObjectPropertiesWithContext(context.Background(), getStorageObjectPropertiesOptions) err = core.RepurposeSDKProblem(err, "") return } -// AddBucketCatalogWithContext is an alternate form of the AddBucketCatalog method which supports a Context parameter -func (watsonxData *WatsonxDataV2) AddBucketCatalogWithContext(ctx context.Context, addBucketCatalogOptions *AddBucketCatalogOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(addBucketCatalogOptions, "addBucketCatalogOptions cannot be nil") +// GetStorageObjectPropertiesWithContext is an alternate form of the GetStorageObjectProperties method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetStorageObjectPropertiesWithContext(ctx context.Context, getStorageObjectPropertiesOptions *GetStorageObjectPropertiesOptions) (result *StorageObjectProperties, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getStorageObjectPropertiesOptions, "getStorageObjectPropertiesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(addBucketCatalogOptions, "addBucketCatalogOptions") + err = core.ValidateStruct(getStorageObjectPropertiesOptions, "getStorageObjectPropertiesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bucket_id": *addBucketCatalogOptions.BucketID, + "storage_id": *getStorageObjectPropertiesOptions.StorageID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/bucket_registrations/{bucket_id}/catalogs`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/storage_registrations/{storage_id}/object_properties`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range addBucketCatalogOptions.Headers { + for headerName, headerValue := range getStorageObjectPropertiesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "AddBucketCatalog") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetStorageObjectProperties") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if addBucketCatalogOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*addBucketCatalogOptions.AuthInstanceID)) + if getStorageObjectPropertiesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getStorageObjectPropertiesOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if addBucketCatalogOptions.BasePath != nil { - body["base_path"] = addBucketCatalogOptions.BasePath - } - if addBucketCatalogOptions.CatalogName != nil { - body["catalog_name"] = addBucketCatalogOptions.CatalogName - } - if addBucketCatalogOptions.CatalogTags != nil { - body["catalog_tags"] = addBucketCatalogOptions.CatalogTags - } - if addBucketCatalogOptions.CatalogType != nil { - body["catalog_type"] = addBucketCatalogOptions.CatalogType + if getStorageObjectPropertiesOptions.Paths != nil { + body["paths"] = getStorageObjectPropertiesOptions.Paths } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -698,12 +830,12 @@ func (watsonxData *WatsonxDataV2) AddBucketCatalogWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "add_bucket_catalog", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_storage_object_properties", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalStorageObjectProperties) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -714,50 +846,67 @@ func (watsonxData *WatsonxDataV2) AddBucketCatalogWithContext(ctx context.Contex return } -// DeleteDeactivateBucket : Deactivate Bucket -// Deactivate a bucket. -func (watsonxData *WatsonxDataV2) DeleteDeactivateBucket(deleteDeactivateBucketOptions *DeleteDeactivateBucketOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteDeactivateBucketWithContext(context.Background(), deleteDeactivateBucketOptions) +// ListStorageRegistrationsObjects : List storage objects +// Fetch all objects from a given storage. +func (watsonxData *WatsonxDataV3) ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptions *ListStorageRegistrationsObjectsOptions) (result *StorageRegistrationObjectCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListStorageRegistrationsObjectsWithContext(context.Background(), listStorageRegistrationsObjectsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteDeactivateBucketWithContext is an alternate form of the DeleteDeactivateBucket method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteDeactivateBucketWithContext(ctx context.Context, deleteDeactivateBucketOptions *DeleteDeactivateBucketOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDeactivateBucketOptions, "deleteDeactivateBucketOptions cannot be nil") +// ListStorageRegistrationsObjectsWithContext is an alternate form of the ListStorageRegistrationsObjects method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListStorageRegistrationsObjectsWithContext(ctx context.Context, listStorageRegistrationsObjectsOptions *ListStorageRegistrationsObjectsOptions) (result *StorageRegistrationObjectCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listStorageRegistrationsObjectsOptions, "listStorageRegistrationsObjectsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteDeactivateBucketOptions, "deleteDeactivateBucketOptions") + err = core.ValidateStruct(listStorageRegistrationsObjectsOptions, "listStorageRegistrationsObjectsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "bucket_id": *deleteDeactivateBucketOptions.BucketID, + "storage_id": *listStorageRegistrationsObjectsOptions.StorageID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/bucket_registrations/{bucket_id}/deactivate`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/storage_registrations/{storage_id}/objects`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteDeactivateBucketOptions.Headers { + for headerName, headerValue := range listStorageRegistrationsObjectsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteDeactivateBucket") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListStorageRegistrationsObjects") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteDeactivateBucketOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteDeactivateBucketOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + if listStorageRegistrationsObjectsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listStorageRegistrationsObjectsOptions.AuthInstanceID)) + } + + if listStorageRegistrationsObjectsOptions.Path != nil { + builder.AddQuery("path", fmt.Sprint(*listStorageRegistrationsObjectsOptions.Path)) + } + if listStorageRegistrationsObjectsOptions.Paginated != nil { + builder.AddQuery("paginated", fmt.Sprint(*listStorageRegistrationsObjectsOptions.Paginated)) + } + if listStorageRegistrationsObjectsOptions.PageSize != nil { + builder.AddQuery("page_size", fmt.Sprint(*listStorageRegistrationsObjectsOptions.PageSize)) + } + if listStorageRegistrationsObjectsOptions.Prefix != nil { + builder.AddQuery("prefix", fmt.Sprint(*listStorageRegistrationsObjectsOptions.Prefix)) + } + if listStorageRegistrationsObjectsOptions.StartAfter != nil { + builder.AddQuery("start_after", fmt.Sprint(*listStorageRegistrationsObjectsOptions.StartAfter)) } request, err := builder.Build() @@ -766,65 +915,61 @@ func (watsonxData *WatsonxDataV2) DeleteDeactivateBucketWithContext(ctx context. return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_deactivate_bucket", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_storage_registrations_objects", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalStorageRegistrationObjectCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// ListBucketObjects : List bucket objects -// Fetch all objects from a given bucket. -func (watsonxData *WatsonxDataV2) ListBucketObjects(listBucketObjectsOptions *ListBucketObjectsOptions) (result *BucketRegistrationObjectCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListBucketObjectsWithContext(context.Background(), listBucketObjectsOptions) +// ListDatabaseRegistrations : Get list of databases +// Get list of databases. +func (watsonxData *WatsonxDataV3) ListDatabaseRegistrations(listDatabaseRegistrationsOptions *ListDatabaseRegistrationsOptions) (result *DatabaseRegistrationCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListDatabaseRegistrationsWithContext(context.Background(), listDatabaseRegistrationsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListBucketObjectsWithContext is an alternate form of the ListBucketObjects method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListBucketObjectsWithContext(ctx context.Context, listBucketObjectsOptions *ListBucketObjectsOptions) (result *BucketRegistrationObjectCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listBucketObjectsOptions, "listBucketObjectsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listBucketObjectsOptions, "listBucketObjectsOptions") +// ListDatabaseRegistrationsWithContext is an alternate form of the ListDatabaseRegistrations method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListDatabaseRegistrationsWithContext(ctx context.Context, listDatabaseRegistrationsOptions *ListDatabaseRegistrationsOptions) (result *DatabaseRegistrationCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDatabaseRegistrationsOptions, "listDatabaseRegistrationsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "bucket_id": *listBucketObjectsOptions.BucketID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/bucket_registrations/{bucket_id}/objects`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/database_registrations`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listBucketObjectsOptions.Headers { + for headerName, headerValue := range listDatabaseRegistrationsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListBucketObjects") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListDatabaseRegistrations") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listBucketObjectsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listBucketObjectsOptions.AuthInstanceID)) - } - - if listBucketObjectsOptions.Path != nil { - builder.AddQuery("path", fmt.Sprint(*listBucketObjectsOptions.Path)) + if listDatabaseRegistrationsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listDatabaseRegistrationsOptions.AuthInstanceID)) } request, err := builder.Build() @@ -836,12 +981,12 @@ func (watsonxData *WatsonxDataV2) ListBucketObjectsWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_bucket_objects", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_database_registrations", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBucketRegistrationObjectCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDatabaseRegistrationCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -852,57 +997,86 @@ func (watsonxData *WatsonxDataV2) ListBucketObjectsWithContext(ctx context.Conte return } -// GetBucketObjectProperties : Get bucket object properties -// Get bucket object properties. -func (watsonxData *WatsonxDataV2) GetBucketObjectProperties(getBucketObjectPropertiesOptions *GetBucketObjectPropertiesOptions) (result *BucketObjectProperties, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetBucketObjectPropertiesWithContext(context.Background(), getBucketObjectPropertiesOptions) +// CreateDatabaseRegistration : Add/Create database +// Add or create a new database. +func (watsonxData *WatsonxDataV3) CreateDatabaseRegistration(createDatabaseRegistrationOptions *CreateDatabaseRegistrationOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateDatabaseRegistrationWithContext(context.Background(), createDatabaseRegistrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetBucketObjectPropertiesWithContext is an alternate form of the GetBucketObjectProperties method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetBucketObjectPropertiesWithContext(ctx context.Context, getBucketObjectPropertiesOptions *GetBucketObjectPropertiesOptions) (result *BucketObjectProperties, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getBucketObjectPropertiesOptions, "getBucketObjectPropertiesOptions cannot be nil") +// CreateDatabaseRegistrationWithContext is an alternate form of the CreateDatabaseRegistration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateDatabaseRegistrationWithContext(ctx context.Context, createDatabaseRegistrationOptions *CreateDatabaseRegistrationOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDatabaseRegistrationOptions, "createDatabaseRegistrationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getBucketObjectPropertiesOptions, "getBucketObjectPropertiesOptions") + err = core.ValidateStruct(createDatabaseRegistrationOptions, "createDatabaseRegistrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "bucket_id": *getBucketObjectPropertiesOptions.BucketID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/bucket_registrations/{bucket_id}/object_properties`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/database_registrations`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getBucketObjectPropertiesOptions.Headers { + for headerName, headerValue := range createDatabaseRegistrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetBucketObjectProperties") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateDatabaseRegistration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if getBucketObjectPropertiesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getBucketObjectPropertiesOptions.AuthInstanceID)) + if createDatabaseRegistrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createDatabaseRegistrationOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if getBucketObjectPropertiesOptions.Paths != nil { - body["paths"] = getBucketObjectPropertiesOptions.Paths + if createDatabaseRegistrationOptions.DisplayName != nil { + body["display_name"] = createDatabaseRegistrationOptions.DisplayName + } + if createDatabaseRegistrationOptions.Type != nil { + body["type"] = createDatabaseRegistrationOptions.Type + } + if createDatabaseRegistrationOptions.AssociatedCatalog != nil { + body["associated_catalog"] = createDatabaseRegistrationOptions.AssociatedCatalog + } + if createDatabaseRegistrationOptions.Connection != nil { + body["connection"] = createDatabaseRegistrationOptions.Connection + } + if createDatabaseRegistrationOptions.CreatedAt != nil { + body["created_at"] = createDatabaseRegistrationOptions.CreatedAt + } + if createDatabaseRegistrationOptions.Description != nil { + body["description"] = createDatabaseRegistrationOptions.Description + } + if createDatabaseRegistrationOptions.Properties != nil { + body["properties"] = createDatabaseRegistrationOptions.Properties + } + if createDatabaseRegistrationOptions.SourceAssetID != nil { + body["source_asset_id"] = createDatabaseRegistrationOptions.SourceAssetID + } + if createDatabaseRegistrationOptions.SourceCatalogID != nil { + body["source_catalog_id"] = createDatabaseRegistrationOptions.SourceCatalogID + } + if createDatabaseRegistrationOptions.SourceProjectID != nil { + body["source_project_id"] = createDatabaseRegistrationOptions.SourceProjectID + } + if createDatabaseRegistrationOptions.Tags != nil { + body["tags"] = createDatabaseRegistrationOptions.Tags + } + if createDatabaseRegistrationOptions.TargetCatalogID != nil { + body["target_catalog_id"] = createDatabaseRegistrationOptions.TargetCatalogID } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -919,12 +1093,12 @@ func (watsonxData *WatsonxDataV2) GetBucketObjectPropertiesWithContext(ctx conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_bucket_object_properties", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_database_registration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalBucketObjectProperties) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDatabaseRegistration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -935,83 +1109,62 @@ func (watsonxData *WatsonxDataV2) GetBucketObjectPropertiesWithContext(ctx conte return } -// CreateHdfsStorage : Add/Create HDFS storage -// Add or create a new HDFS database. -func (watsonxData *WatsonxDataV2) CreateHdfsStorage(createHdfsStorageOptions *CreateHdfsStorageOptions) (result *HdfsStorageRegistration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateHdfsStorageWithContext(context.Background(), createHdfsStorageOptions) +// AddDatabaseCatalog : Post database catalog +// Add catalog to a registered database. +func (watsonxData *WatsonxDataV3) AddDatabaseCatalog(addDatabaseCatalogOptions *AddDatabaseCatalogOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.AddDatabaseCatalogWithContext(context.Background(), addDatabaseCatalogOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateHdfsStorageWithContext is an alternate form of the CreateHdfsStorage method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateHdfsStorageWithContext(ctx context.Context, createHdfsStorageOptions *CreateHdfsStorageOptions) (result *HdfsStorageRegistration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createHdfsStorageOptions, "createHdfsStorageOptions cannot be nil") +// AddDatabaseCatalogWithContext is an alternate form of the AddDatabaseCatalog method which supports a Context parameter +func (watsonxData *WatsonxDataV3) AddDatabaseCatalogWithContext(ctx context.Context, addDatabaseCatalogOptions *AddDatabaseCatalogOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addDatabaseCatalogOptions, "addDatabaseCatalogOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createHdfsStorageOptions, "createHdfsStorageOptions") + err = core.ValidateStruct(addDatabaseCatalogOptions, "addDatabaseCatalogOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "database_id": *addDatabaseCatalogOptions.DatabaseID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/storage_hdfs_registrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/database_registrations/{database_id}/catalogs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createHdfsStorageOptions.Headers { + for headerName, headerValue := range addDatabaseCatalogOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateHdfsStorage") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "AddDatabaseCatalog") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if createHdfsStorageOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createHdfsStorageOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if addDatabaseCatalogOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*addDatabaseCatalogOptions.AuthInstanceID)) } - builder.AddFormData("bucket_display_name", "", "", fmt.Sprint(*createHdfsStorageOptions.BucketDisplayName)) - builder.AddFormData("bucket_type", "", "", fmt.Sprint(*createHdfsStorageOptions.BucketType)) - builder.AddFormData("hms_thrift_uri", "", "", fmt.Sprint(*createHdfsStorageOptions.HmsThriftURI)) - builder.AddFormData("hms_thrift_port", "", "", fmt.Sprint(*createHdfsStorageOptions.HmsThriftPort)) - builder.AddFormData("core_site", "", "", fmt.Sprint(*createHdfsStorageOptions.CoreSite)) - builder.AddFormData("hdfs_site", "", "", fmt.Sprint(*createHdfsStorageOptions.HdfsSite)) - builder.AddFormData("kerberos", "", "", fmt.Sprint(*createHdfsStorageOptions.Kerberos)) - builder.AddFormData("catalog_name", "", "", fmt.Sprint(*createHdfsStorageOptions.CatalogName)) - builder.AddFormData("catalog_type", "", "", fmt.Sprint(*createHdfsStorageOptions.CatalogType)) - if createHdfsStorageOptions.Krb5Config != nil { - builder.AddFormData("krb5_config", "", "", fmt.Sprint(*createHdfsStorageOptions.Krb5Config)) - } - if createHdfsStorageOptions.HiveKeytab != nil { - builder.AddFormData("hive_keytab", "filename", - core.StringNilMapper(createHdfsStorageOptions.HiveKeytabContentType), createHdfsStorageOptions.HiveKeytab) - } - if createHdfsStorageOptions.HdfsKeytab != nil { - builder.AddFormData("hdfs_keytab", "filename", - core.StringNilMapper(createHdfsStorageOptions.HdfsKeytabContentType), createHdfsStorageOptions.HdfsKeytab) - } - if createHdfsStorageOptions.HiveServerPrincipal != nil { - builder.AddFormData("hive_server_principal", "", "", fmt.Sprint(*createHdfsStorageOptions.HiveServerPrincipal)) - } - if createHdfsStorageOptions.HiveClientPrincipal != nil { - builder.AddFormData("hive_client_principal", "", "", fmt.Sprint(*createHdfsStorageOptions.HiveClientPrincipal)) - } - if createHdfsStorageOptions.HdfsPrincipal != nil { - builder.AddFormData("hdfs_principal", "", "", fmt.Sprint(*createHdfsStorageOptions.HdfsPrincipal)) - } - if createHdfsStorageOptions.Description != nil { - builder.AddFormData("description", "", "", fmt.Sprint(*createHdfsStorageOptions.Description)) + body := make(map[string]interface{}) + if addDatabaseCatalogOptions.CatalogName != nil { + body["catalog_name"] = addDatabaseCatalogOptions.CatalogName } - if createHdfsStorageOptions.CreatedOn != nil { - builder.AddFormData("created_on", "", "", fmt.Sprint(*createHdfsStorageOptions.CreatedOn)) + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -1023,12 +1176,12 @@ func (watsonxData *WatsonxDataV2) CreateHdfsStorageWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_hdfs_storage", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "add_database_catalog", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalHdfsStorageRegistration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1039,42 +1192,51 @@ func (watsonxData *WatsonxDataV2) CreateHdfsStorageWithContext(ctx context.Conte return } -// ListDatabaseRegistrations : Get databases -// Get list of databases. -func (watsonxData *WatsonxDataV2) ListDatabaseRegistrations(listDatabaseRegistrationsOptions *ListDatabaseRegistrationsOptions) (result *DatabaseRegistrationCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListDatabaseRegistrationsWithContext(context.Background(), listDatabaseRegistrationsOptions) +// GetDatabase : Get database +// Get a registered databases. +func (watsonxData *WatsonxDataV3) GetDatabase(getDatabaseOptions *GetDatabaseOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetDatabaseWithContext(context.Background(), getDatabaseOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListDatabaseRegistrationsWithContext is an alternate form of the ListDatabaseRegistrations method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListDatabaseRegistrationsWithContext(ctx context.Context, listDatabaseRegistrationsOptions *ListDatabaseRegistrationsOptions) (result *DatabaseRegistrationCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDatabaseRegistrationsOptions, "listDatabaseRegistrationsOptions") +// GetDatabaseWithContext is an alternate form of the GetDatabase method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetDatabaseWithContext(ctx context.Context, getDatabaseOptions *GetDatabaseOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDatabaseOptions, "getDatabaseOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getDatabaseOptions, "getDatabaseOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *getDatabaseOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/database_registrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/database_registrations/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDatabaseRegistrationsOptions.Headers { + for headerName, headerValue := range getDatabaseOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListDatabaseRegistrations") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetDatabase") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listDatabaseRegistrationsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listDatabaseRegistrationsOptions.AuthInstanceID)) + if getDatabaseOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getDatabaseOptions.AuthInstanceID)) } request, err := builder.Build() @@ -1086,12 +1248,12 @@ func (watsonxData *WatsonxDataV2) ListDatabaseRegistrationsWithContext(ctx conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_database_registrations", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_database", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDatabaseRegistrationCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDatabaseRegistration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1102,76 +1264,117 @@ func (watsonxData *WatsonxDataV2) ListDatabaseRegistrationsWithContext(ctx conte return } -// CreateDatabaseRegistration : Add/Create database -// Add or create a new database. -func (watsonxData *WatsonxDataV2) CreateDatabaseRegistration(createDatabaseRegistrationOptions *CreateDatabaseRegistrationOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateDatabaseRegistrationWithContext(context.Background(), createDatabaseRegistrationOptions) +// DeleteDatabaseCatalog : Delete database +// Delete a database. +func (watsonxData *WatsonxDataV3) DeleteDatabaseCatalog(deleteDatabaseCatalogOptions *DeleteDatabaseCatalogOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteDatabaseCatalogWithContext(context.Background(), deleteDatabaseCatalogOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateDatabaseRegistrationWithContext is an alternate form of the CreateDatabaseRegistration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateDatabaseRegistrationWithContext(ctx context.Context, createDatabaseRegistrationOptions *CreateDatabaseRegistrationOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createDatabaseRegistrationOptions, "createDatabaseRegistrationOptions cannot be nil") +// DeleteDatabaseCatalogWithContext is an alternate form of the DeleteDatabaseCatalog method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteDatabaseCatalogWithContext(ctx context.Context, deleteDatabaseCatalogOptions *DeleteDatabaseCatalogOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDatabaseCatalogOptions, "deleteDatabaseCatalogOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createDatabaseRegistrationOptions, "createDatabaseRegistrationOptions") + err = core.ValidateStruct(deleteDatabaseCatalogOptions, "deleteDatabaseCatalogOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *deleteDatabaseCatalogOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/database_registrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/database_registrations/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createDatabaseRegistrationOptions.Headers { + for headerName, headerValue := range deleteDatabaseCatalogOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateDatabaseRegistration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteDatabaseCatalog") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createDatabaseRegistrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createDatabaseRegistrationOptions.AuthInstanceID)) + if deleteDatabaseCatalogOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteDatabaseCatalogOptions.AuthInstanceID)) } - body := make(map[string]interface{}) - if createDatabaseRegistrationOptions.DatabaseDisplayName != nil { - body["database_display_name"] = createDatabaseRegistrationOptions.DatabaseDisplayName + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if createDatabaseRegistrationOptions.DatabaseType != nil { - body["database_type"] = createDatabaseRegistrationOptions.DatabaseType + + response, err = watsonxData.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_database_catalog", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return } - if createDatabaseRegistrationOptions.AssociatedCatalog != nil { - body["associated_catalog"] = createDatabaseRegistrationOptions.AssociatedCatalog + + return +} + +// UpdateDatabase : Update database +// Update database details. +func (watsonxData *WatsonxDataV3) UpdateDatabase(updateDatabaseOptions *UpdateDatabaseOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateDatabaseWithContext(context.Background(), updateDatabaseOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// UpdateDatabaseWithContext is an alternate form of the UpdateDatabase method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateDatabaseWithContext(ctx context.Context, updateDatabaseOptions *UpdateDatabaseOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDatabaseOptions, "updateDatabaseOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return } - if createDatabaseRegistrationOptions.CreatedOn != nil { - body["created_on"] = createDatabaseRegistrationOptions.CreatedOn + err = core.ValidateStruct(updateDatabaseOptions, "updateDatabaseOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return } - if createDatabaseRegistrationOptions.DatabaseDetails != nil { - body["database_details"] = createDatabaseRegistrationOptions.DatabaseDetails + + pathParamsMap := map[string]string{ + "id": *updateDatabaseOptions.ID, } - if createDatabaseRegistrationOptions.DatabaseProperties != nil { - body["database_properties"] = createDatabaseRegistrationOptions.DatabaseProperties + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/database_registrations/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return } - if createDatabaseRegistrationOptions.Description != nil { - body["description"] = createDatabaseRegistrationOptions.Description + + for headerName, headerValue := range updateDatabaseOptions.Headers { + builder.AddHeader(headerName, headerValue) } - if createDatabaseRegistrationOptions.Tags != nil { - body["tags"] = createDatabaseRegistrationOptions.Tags + + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateDatabase") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) } - _, err = builder.SetBodyContentJSON(body) + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateDatabaseOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateDatabaseOptions.AuthInstanceID)) + } + + _, err = builder.SetBodyContentJSON(updateDatabaseOptions.Body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -1186,7 +1389,7 @@ func (watsonxData *WatsonxDataV2) CreateDatabaseRegistrationWithContext(ctx cont var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_database_registration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_database", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -1202,51 +1405,42 @@ func (watsonxData *WatsonxDataV2) CreateDatabaseRegistrationWithContext(ctx cont return } -// GetDatabase : Get database -// Get a registered databases. -func (watsonxData *WatsonxDataV2) GetDatabase(getDatabaseOptions *GetDatabaseOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetDatabaseWithContext(context.Background(), getDatabaseOptions) +// ListPrestoEngines : Get list of Presto(Java) engines +// Get list of all Presto(Java) engines. +func (watsonxData *WatsonxDataV3) ListPrestoEngines(listPrestoEnginesOptions *ListPrestoEnginesOptions) (result *PrestoEngineCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListPrestoEnginesWithContext(context.Background(), listPrestoEnginesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetDatabaseWithContext is an alternate form of the GetDatabase method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetDatabaseWithContext(ctx context.Context, getDatabaseOptions *GetDatabaseOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getDatabaseOptions, "getDatabaseOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getDatabaseOptions, "getDatabaseOptions") +// ListPrestoEnginesWithContext is an alternate form of the ListPrestoEngines method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListPrestoEnginesWithContext(ctx context.Context, listPrestoEnginesOptions *ListPrestoEnginesOptions) (result *PrestoEngineCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPrestoEnginesOptions, "listPrestoEnginesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "database_id": *getDatabaseOptions.DatabaseID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/database_registrations/{database_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getDatabaseOptions.Headers { + for headerName, headerValue := range listPrestoEnginesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetDatabase") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListPrestoEngines") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getDatabaseOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getDatabaseOptions.AuthInstanceID)) + if listPrestoEnginesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listPrestoEnginesOptions.AuthInstanceID)) } request, err := builder.Build() @@ -1258,12 +1452,12 @@ func (watsonxData *WatsonxDataV2) GetDatabaseWithContext(ctx context.Context, ge var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_database", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_presto_engines", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDatabaseRegistration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngineCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1274,50 +1468,76 @@ func (watsonxData *WatsonxDataV2) GetDatabaseWithContext(ctx context.Context, ge return } -// DeleteDatabaseCatalog : Delete database -// Delete a database. -func (watsonxData *WatsonxDataV2) DeleteDatabaseCatalog(deleteDatabaseCatalogOptions *DeleteDatabaseCatalogOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteDatabaseCatalogWithContext(context.Background(), deleteDatabaseCatalogOptions) +// CreatePrestoEngine : Create presto engine +// Create a new presto engine. +func (watsonxData *WatsonxDataV3) CreatePrestoEngine(createPrestoEngineOptions *CreatePrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreatePrestoEngineWithContext(context.Background(), createPrestoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteDatabaseCatalogWithContext is an alternate form of the DeleteDatabaseCatalog method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteDatabaseCatalogWithContext(ctx context.Context, deleteDatabaseCatalogOptions *DeleteDatabaseCatalogOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDatabaseCatalogOptions, "deleteDatabaseCatalogOptions cannot be nil") +// CreatePrestoEngineWithContext is an alternate form of the CreatePrestoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreatePrestoEngineWithContext(ctx context.Context, createPrestoEngineOptions *CreatePrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPrestoEngineOptions, "createPrestoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteDatabaseCatalogOptions, "deleteDatabaseCatalogOptions") + err = core.ValidateStruct(createPrestoEngineOptions, "createPrestoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "database_id": *deleteDatabaseCatalogOptions.DatabaseID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/database_registrations/{database_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteDatabaseCatalogOptions.Headers { + for headerName, headerValue := range createPrestoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteDatabaseCatalog") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreatePrestoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteDatabaseCatalogOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteDatabaseCatalogOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if createPrestoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createPrestoEngineOptions.AuthInstanceID)) + } + + body := make(map[string]interface{}) + if createPrestoEngineOptions.Configuration != nil { + body["configuration"] = createPrestoEngineOptions.Configuration + } + if createPrestoEngineOptions.DisplayName != nil { + body["display_name"] = createPrestoEngineOptions.DisplayName + } + if createPrestoEngineOptions.Origin != nil { + body["origin"] = createPrestoEngineOptions.Origin + } + if createPrestoEngineOptions.AssociatedCatalogs != nil { + body["associated_catalogs"] = createPrestoEngineOptions.AssociatedCatalogs + } + if createPrestoEngineOptions.Description != nil { + body["description"] = createPrestoEngineOptions.Description + } + if createPrestoEngineOptions.ID != nil { + body["id"] = createPrestoEngineOptions.ID + } + if createPrestoEngineOptions.Tags != nil { + body["tags"] = createPrestoEngineOptions.Tags + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -1326,65 +1546,74 @@ func (watsonxData *WatsonxDataV2) DeleteDatabaseCatalogWithContext(ctx context.C return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_database_catalog", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_presto_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngine) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateDatabase : Update database -// Update database details. -func (watsonxData *WatsonxDataV2) UpdateDatabase(updateDatabaseOptions *UpdateDatabaseOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateDatabaseWithContext(context.Background(), updateDatabaseOptions) +// UpdatePrestoEngineAutoscaling : Update Autoscaling Configuration +// Update autoscaling configuration for an existing running Presto engine. +func (watsonxData *WatsonxDataV3) UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptions *UpdatePrestoEngineAutoscalingOptions) (result *PatchAutoscalingSuccess, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdatePrestoEngineAutoscalingWithContext(context.Background(), updatePrestoEngineAutoscalingOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateDatabaseWithContext is an alternate form of the UpdateDatabase method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateDatabaseWithContext(ctx context.Context, updateDatabaseOptions *UpdateDatabaseOptions) (result *DatabaseRegistration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDatabaseOptions, "updateDatabaseOptions cannot be nil") +// UpdatePrestoEngineAutoscalingWithContext is an alternate form of the UpdatePrestoEngineAutoscaling method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdatePrestoEngineAutoscalingWithContext(ctx context.Context, updatePrestoEngineAutoscalingOptions *UpdatePrestoEngineAutoscalingOptions) (result *PatchAutoscalingSuccess, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePrestoEngineAutoscalingOptions, "updatePrestoEngineAutoscalingOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateDatabaseOptions, "updateDatabaseOptions") + err = core.ValidateStruct(updatePrestoEngineAutoscalingOptions, "updatePrestoEngineAutoscalingOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "database_id": *updateDatabaseOptions.DatabaseID, + "engine_id": *updatePrestoEngineAutoscalingOptions.EngineID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/database_registrations/{database_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{engine_id}/autoscaling`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateDatabaseOptions.Headers { + for headerName, headerValue := range updatePrestoEngineAutoscalingOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateDatabase") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdatePrestoEngineAutoscaling") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateDatabaseOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateDatabaseOptions.AuthInstanceID)) + if updatePrestoEngineAutoscalingOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updatePrestoEngineAutoscalingOptions.AuthInstanceID)) } - _, err = builder.SetBodyContentJSON(updateDatabaseOptions.Body) + _, err = builder.SetBodyContentJSON(updatePrestoEngineAutoscalingOptions.UpdateAutoScalingRequestPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -1399,12 +1628,12 @@ func (watsonxData *WatsonxDataV2) UpdateDatabaseWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_database", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_presto_engine_autoscaling", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDatabaseRegistration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPatchAutoscalingSuccess) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1415,42 +1644,51 @@ func (watsonxData *WatsonxDataV2) UpdateDatabaseWithContext(ctx context.Context, return } -// ListDriverRegistration : Get drivers -// Get all driver details. -func (watsonxData *WatsonxDataV2) ListDriverRegistration(listDriverRegistrationOptions *ListDriverRegistrationOptions) (result *DriverRegistrationCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListDriverRegistrationWithContext(context.Background(), listDriverRegistrationOptions) +// ListPrestoEngineCatalogs : Get presto engine catalogs +// Get list of all catalogs attached to a presto engine. +func (watsonxData *WatsonxDataV3) ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptions *ListPrestoEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListPrestoEngineCatalogsWithContext(context.Background(), listPrestoEngineCatalogsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListDriverRegistrationWithContext is an alternate form of the ListDriverRegistration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListDriverRegistrationWithContext(ctx context.Context, listDriverRegistrationOptions *ListDriverRegistrationOptions) (result *DriverRegistrationCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDriverRegistrationOptions, "listDriverRegistrationOptions") +// ListPrestoEngineCatalogsWithContext is an alternate form of the ListPrestoEngineCatalogs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListPrestoEngineCatalogsWithContext(ctx context.Context, listPrestoEngineCatalogsOptions *ListPrestoEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listPrestoEngineCatalogsOptions, "listPrestoEngineCatalogsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listPrestoEngineCatalogsOptions, "listPrestoEngineCatalogsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "engine_id": *listPrestoEngineCatalogsOptions.EngineID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/driver_registrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{engine_id}/catalogs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDriverRegistrationOptions.Headers { + for headerName, headerValue := range listPrestoEngineCatalogsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListDriverRegistration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListPrestoEngineCatalogs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listDriverRegistrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listDriverRegistrationOptions.AuthInstanceID)) + if listPrestoEngineCatalogsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listPrestoEngineCatalogsOptions.AuthInstanceID)) } request, err := builder.Build() @@ -1462,12 +1700,12 @@ func (watsonxData *WatsonxDataV2) ListDriverRegistrationWithContext(ctx context. var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_driver_registration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_presto_engine_catalogs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDriverRegistrationCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1478,55 +1716,62 @@ func (watsonxData *WatsonxDataV2) ListDriverRegistrationWithContext(ctx context. return } -// CreateDriverRegistration : Register driver -// Register a new driver. -func (watsonxData *WatsonxDataV2) CreateDriverRegistration(createDriverRegistrationOptions *CreateDriverRegistrationOptions) (result *DriverRegistration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateDriverRegistrationWithContext(context.Background(), createDriverRegistrationOptions) +// CreatePrestoEngineCatalogs : Associate catalogs to presto engine +// Associate one or more catalogs to a presto engine. +func (watsonxData *WatsonxDataV3) CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptions *CreatePrestoEngineCatalogsOptions) (result *Catalog, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreatePrestoEngineCatalogsWithContext(context.Background(), createPrestoEngineCatalogsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateDriverRegistrationWithContext is an alternate form of the CreateDriverRegistration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateDriverRegistrationWithContext(ctx context.Context, createDriverRegistrationOptions *CreateDriverRegistrationOptions) (result *DriverRegistration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createDriverRegistrationOptions, "createDriverRegistrationOptions cannot be nil") +// CreatePrestoEngineCatalogsWithContext is an alternate form of the CreatePrestoEngineCatalogs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreatePrestoEngineCatalogsWithContext(ctx context.Context, createPrestoEngineCatalogsOptions *CreatePrestoEngineCatalogsOptions) (result *Catalog, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPrestoEngineCatalogsOptions, "createPrestoEngineCatalogsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createDriverRegistrationOptions, "createDriverRegistrationOptions") + err = core.ValidateStruct(createPrestoEngineCatalogsOptions, "createPrestoEngineCatalogsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "engine_id": *createPrestoEngineCatalogsOptions.EngineID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/driver_registrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{engine_id}/catalogs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createDriverRegistrationOptions.Headers { + for headerName, headerValue := range createPrestoEngineCatalogsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateDriverRegistration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreatePrestoEngineCatalogs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if createDriverRegistrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createDriverRegistrationOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if createPrestoEngineCatalogsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createPrestoEngineCatalogsOptions.AuthInstanceID)) } - builder.AddFormData("driver", "filename", - core.StringNilMapper(createDriverRegistrationOptions.DriverContentType), createDriverRegistrationOptions.Driver) - builder.AddFormData("driver_name", "", "", fmt.Sprint(*createDriverRegistrationOptions.DriverName)) - builder.AddFormData("connection_type", "", "", fmt.Sprint(*createDriverRegistrationOptions.ConnectionType)) - if createDriverRegistrationOptions.Version != nil { - builder.AddFormData("version", "", "", fmt.Sprint(*createDriverRegistrationOptions.Version)) + body := make(map[string]interface{}) + if createPrestoEngineCatalogsOptions.CatalogNames != nil { + body["catalog_names"] = createPrestoEngineCatalogsOptions.CatalogNames + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -1538,12 +1783,12 @@ func (watsonxData *WatsonxDataV2) CreateDriverRegistrationWithContext(ctx contex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_driver_registration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_presto_engine_catalogs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDriverRegistration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1554,52 +1799,54 @@ func (watsonxData *WatsonxDataV2) CreateDriverRegistrationWithContext(ctx contex return } -// DeleteDriverRegistration : Delete driver -// Delete a driver. -func (watsonxData *WatsonxDataV2) DeleteDriverRegistration(deleteDriverRegistrationOptions *DeleteDriverRegistrationOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteDriverRegistrationWithContext(context.Background(), deleteDriverRegistrationOptions) +// DeletePrestoEngineCatalogs : Disassociate catalogs from a presto engine +// Disassociate one or more catalogs from a presto engine. +func (watsonxData *WatsonxDataV3) DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptions *DeletePrestoEngineCatalogsOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeletePrestoEngineCatalogsWithContext(context.Background(), deletePrestoEngineCatalogsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteDriverRegistrationWithContext is an alternate form of the DeleteDriverRegistration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteDriverRegistrationWithContext(ctx context.Context, deleteDriverRegistrationOptions *DeleteDriverRegistrationOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDriverRegistrationOptions, "deleteDriverRegistrationOptions cannot be nil") +// DeletePrestoEngineCatalogsWithContext is an alternate form of the DeletePrestoEngineCatalogs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeletePrestoEngineCatalogsWithContext(ctx context.Context, deletePrestoEngineCatalogsOptions *DeletePrestoEngineCatalogsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePrestoEngineCatalogsOptions, "deletePrestoEngineCatalogsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteDriverRegistrationOptions, "deleteDriverRegistrationOptions") + err = core.ValidateStruct(deletePrestoEngineCatalogsOptions, "deletePrestoEngineCatalogsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "driver_id": *deleteDriverRegistrationOptions.DriverID, + "engine_id": *deletePrestoEngineCatalogsOptions.EngineID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/driver_registrations/{driver_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{engine_id}/catalogs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteDriverRegistrationOptions.Headers { + for headerName, headerValue := range deletePrestoEngineCatalogsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteDriverRegistration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeletePrestoEngineCatalogs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteDriverRegistrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteDriverRegistrationOptions.AuthInstanceID)) + if deletePrestoEngineCatalogsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deletePrestoEngineCatalogsOptions.AuthInstanceID)) } + builder.AddQuery("catalog_names", fmt.Sprint(*deletePrestoEngineCatalogsOptions.CatalogNames)) + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -1608,7 +1855,7 @@ func (watsonxData *WatsonxDataV2) DeleteDriverRegistrationWithContext(ctx contex response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_driver_registration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_presto_engine_catalogs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -1616,122 +1863,129 @@ func (watsonxData *WatsonxDataV2) DeleteDriverRegistrationWithContext(ctx contex return } -// DeleteDriverEngines : Disassociate engines from driver -// Disassociate one or more engines from a driver. -func (watsonxData *WatsonxDataV2) DeleteDriverEngines(deleteDriverEnginesOptions *DeleteDriverEnginesOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteDriverEnginesWithContext(context.Background(), deleteDriverEnginesOptions) +// GetPrestoEngineCatalog : Get presto engine catalog +// Get catalog attached to presto engine. +func (watsonxData *WatsonxDataV3) GetPrestoEngineCatalog(getPrestoEngineCatalogOptions *GetPrestoEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetPrestoEngineCatalogWithContext(context.Background(), getPrestoEngineCatalogOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteDriverEnginesWithContext is an alternate form of the DeleteDriverEngines method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteDriverEnginesWithContext(ctx context.Context, deleteDriverEnginesOptions *DeleteDriverEnginesOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDriverEnginesOptions, "deleteDriverEnginesOptions cannot be nil") +// GetPrestoEngineCatalogWithContext is an alternate form of the GetPrestoEngineCatalog method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetPrestoEngineCatalogWithContext(ctx context.Context, getPrestoEngineCatalogOptions *GetPrestoEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPrestoEngineCatalogOptions, "getPrestoEngineCatalogOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteDriverEnginesOptions, "deleteDriverEnginesOptions") + err = core.ValidateStruct(getPrestoEngineCatalogOptions, "getPrestoEngineCatalogOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "driver_id": *deleteDriverEnginesOptions.DriverID, + "engine_id": *getPrestoEngineCatalogOptions.EngineID, + "id": *getPrestoEngineCatalogOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/driver_registrations/{driver_id}/engines`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{engine_id}/catalogs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteDriverEnginesOptions.Headers { + for headerName, headerValue := range getPrestoEngineCatalogOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteDriverEngines") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetPrestoEngineCatalog") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteDriverEnginesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteDriverEnginesOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + if getPrestoEngineCatalogOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getPrestoEngineCatalogOptions.AuthInstanceID)) } - builder.AddQuery("engine_ids", fmt.Sprint(*deleteDriverEnginesOptions.EngineIds)) - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_driver_engines", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_presto_engine_catalog", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateDriverEngines : Associate engines to driver -// Associate one or more engines to a driver. -func (watsonxData *WatsonxDataV2) UpdateDriverEngines(updateDriverEnginesOptions *UpdateDriverEnginesOptions) (result *DriverRegistrationEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateDriverEnginesWithContext(context.Background(), updateDriverEnginesOptions) +// GetPrestoEngineConfig : Get Presto Engine Configuration +// Retrieve Presto engine configuration properties. Supports filtering by sections: catalog, configuration, +// event_listener, global, jmx_exporter_config, jvm, log_config. +func (watsonxData *WatsonxDataV3) GetPrestoEngineConfig(getPrestoEngineConfigOptions *GetPrestoEngineConfigOptions) (result *PrestoEnginePropertiesDetails, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetPrestoEngineConfigWithContext(context.Background(), getPrestoEngineConfigOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateDriverEnginesWithContext is an alternate form of the UpdateDriverEngines method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateDriverEnginesWithContext(ctx context.Context, updateDriverEnginesOptions *UpdateDriverEnginesOptions) (result *DriverRegistrationEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDriverEnginesOptions, "updateDriverEnginesOptions cannot be nil") +// GetPrestoEngineConfigWithContext is an alternate form of the GetPrestoEngineConfig method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetPrestoEngineConfigWithContext(ctx context.Context, getPrestoEngineConfigOptions *GetPrestoEngineConfigOptions) (result *PrestoEnginePropertiesDetails, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPrestoEngineConfigOptions, "getPrestoEngineConfigOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateDriverEnginesOptions, "updateDriverEnginesOptions") + err = core.ValidateStruct(getPrestoEngineConfigOptions, "getPrestoEngineConfigOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "driver_id": *updateDriverEnginesOptions.DriverID, + "engine_id": *getPrestoEngineConfigOptions.EngineID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/driver_registrations/{driver_id}/engines`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{engine_id}/config`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateDriverEnginesOptions.Headers { + for headerName, headerValue := range getPrestoEngineConfigOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateDriverEngines") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetPrestoEngineConfig") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateDriverEnginesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateDriverEnginesOptions.AuthInstanceID)) + if getPrestoEngineConfigOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getPrestoEngineConfigOptions.AuthInstanceID)) } - _, err = builder.SetBodyContentJSON(updateDriverEnginesOptions.Body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if getPrestoEngineConfigOptions.Sections != nil { + builder.AddQuery("sections", fmt.Sprint(*getPrestoEngineConfigOptions.Sections)) } request, err := builder.Build() @@ -1743,12 +1997,12 @@ func (watsonxData *WatsonxDataV2) UpdateDriverEnginesWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_driver_engines", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_presto_engine_config", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDriverRegistrationEngine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEnginePropertiesDetails) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1759,42 +2013,58 @@ func (watsonxData *WatsonxDataV2) UpdateDriverEnginesWithContext(ctx context.Con return } -// ListOtherEngines : List other engines -// list all other engine details. -func (watsonxData *WatsonxDataV2) ListOtherEngines(listOtherEnginesOptions *ListOtherEnginesOptions) (result *OtherEngineCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListOtherEnginesWithContext(context.Background(), listOtherEnginesOptions) +// UpdatePrestoEngineConfig : Update Presto Engine Configuration +// Update Presto engine configuration properties including catalog, configuration, event_listener, global, +// jmx_exporter_config, jvm, and log_config settings. +func (watsonxData *WatsonxDataV3) UpdatePrestoEngineConfig(updatePrestoEngineConfigOptions *UpdatePrestoEngineConfigOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.UpdatePrestoEngineConfigWithContext(context.Background(), updatePrestoEngineConfigOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListOtherEnginesWithContext is an alternate form of the ListOtherEngines method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListOtherEnginesWithContext(ctx context.Context, listOtherEnginesOptions *ListOtherEnginesOptions) (result *OtherEngineCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listOtherEnginesOptions, "listOtherEnginesOptions") +// UpdatePrestoEngineConfigWithContext is an alternate form of the UpdatePrestoEngineConfig method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdatePrestoEngineConfigWithContext(ctx context.Context, updatePrestoEngineConfigOptions *UpdatePrestoEngineConfigOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePrestoEngineConfigOptions, "updatePrestoEngineConfigOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updatePrestoEngineConfigOptions, "updatePrestoEngineConfigOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "engine_id": *updatePrestoEngineConfigOptions.EngineID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/other_engines`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{engine_id}/config`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listOtherEnginesOptions.Headers { + for headerName, headerValue := range updatePrestoEngineConfigOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListOtherEngines") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdatePrestoEngineConfig") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if listOtherEnginesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listOtherEnginesOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updatePrestoEngineConfigOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updatePrestoEngineConfigOptions.AuthInstanceID)) + } + + _, err = builder.SetBodyContentJSON(updatePrestoEngineConfigOptions.PrestoEnginePropertiesDetailsPatch) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -1803,89 +2073,61 @@ func (watsonxData *WatsonxDataV2) ListOtherEnginesWithContext(ctx context.Contex return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "list_other_engines", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_presto_engine_config", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOtherEngineCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateOtherEngine : Create other engine -// Create a new engine. -func (watsonxData *WatsonxDataV2) CreateOtherEngine(createOtherEngineOptions *CreateOtherEngineOptions) (result *OtherEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateOtherEngineWithContext(context.Background(), createOtherEngineOptions) +// GetPrestoEngine : Get presto engine +// Get details of one presto engine. +func (watsonxData *WatsonxDataV3) GetPrestoEngine(getPrestoEngineOptions *GetPrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetPrestoEngineWithContext(context.Background(), getPrestoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateOtherEngineWithContext is an alternate form of the CreateOtherEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateOtherEngineWithContext(ctx context.Context, createOtherEngineOptions *CreateOtherEngineOptions) (result *OtherEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createOtherEngineOptions, "createOtherEngineOptions cannot be nil") +// GetPrestoEngineWithContext is an alternate form of the GetPrestoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetPrestoEngineWithContext(ctx context.Context, getPrestoEngineOptions *GetPrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPrestoEngineOptions, "getPrestoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createOtherEngineOptions, "createOtherEngineOptions") + err = core.ValidateStruct(getPrestoEngineOptions, "getPrestoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *getPrestoEngineOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/other_engines`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createOtherEngineOptions.Headers { + for headerName, headerValue := range getPrestoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateOtherEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetPrestoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createOtherEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createOtherEngineOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if createOtherEngineOptions.EngineDetails != nil { - body["engine_details"] = createOtherEngineOptions.EngineDetails - } - if createOtherEngineOptions.EngineDisplayName != nil { - body["engine_display_name"] = createOtherEngineOptions.EngineDisplayName - } - if createOtherEngineOptions.Description != nil { - body["description"] = createOtherEngineOptions.Description - } - if createOtherEngineOptions.Origin != nil { - body["origin"] = createOtherEngineOptions.Origin - } - if createOtherEngineOptions.Tags != nil { - body["tags"] = createOtherEngineOptions.Tags - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if getPrestoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getPrestoEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -1897,12 +2139,12 @@ func (watsonxData *WatsonxDataV2) CreateOtherEngineWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_other_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_presto_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOtherEngine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -1913,50 +2155,50 @@ func (watsonxData *WatsonxDataV2) CreateOtherEngineWithContext(ctx context.Conte return } -// DeleteOtherEngine : Delete engine -// Delete an engine from lakehouse. -func (watsonxData *WatsonxDataV2) DeleteOtherEngine(deleteOtherEngineOptions *DeleteOtherEngineOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteOtherEngineWithContext(context.Background(), deleteOtherEngineOptions) +// DeleteEngine : Delete presto engine +// Delete a presto engine. +func (watsonxData *WatsonxDataV3) DeleteEngine(deleteEngineOptions *DeleteEngineOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteEngineWithContext(context.Background(), deleteEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteOtherEngineWithContext is an alternate form of the DeleteOtherEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteOtherEngineWithContext(ctx context.Context, deleteOtherEngineOptions *DeleteOtherEngineOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteOtherEngineOptions, "deleteOtherEngineOptions cannot be nil") +// DeleteEngineWithContext is an alternate form of the DeleteEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteEngineWithContext(ctx context.Context, deleteEngineOptions *DeleteEngineOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteEngineOptions, "deleteEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteOtherEngineOptions, "deleteOtherEngineOptions") + err = core.ValidateStruct(deleteEngineOptions, "deleteEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *deleteOtherEngineOptions.EngineID, + "id": *deleteEngineOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/other_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteOtherEngineOptions.Headers { + for headerName, headerValue := range deleteEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteOtherEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteOtherEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteOtherEngineOptions.AuthInstanceID)) + if deleteEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -1967,7 +2209,7 @@ func (watsonxData *WatsonxDataV2) DeleteOtherEngineWithContext(ctx context.Conte response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_other_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -1975,52 +2217,58 @@ func (watsonxData *WatsonxDataV2) DeleteOtherEngineWithContext(ctx context.Conte return } -// ListAllIntegrations : Get all existing Integrations -// Get all existing Integrations. -func (watsonxData *WatsonxDataV2) ListAllIntegrations(listAllIntegrationsOptions *ListAllIntegrationsOptions) (result *IntegrationCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListAllIntegrationsWithContext(context.Background(), listAllIntegrationsOptions) +// UpdatePrestoEngine : Update presto engine +// Update details of presto engine. +func (watsonxData *WatsonxDataV3) UpdatePrestoEngine(updatePrestoEngineOptions *UpdatePrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdatePrestoEngineWithContext(context.Background(), updatePrestoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListAllIntegrationsWithContext is an alternate form of the ListAllIntegrations method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListAllIntegrationsWithContext(ctx context.Context, listAllIntegrationsOptions *ListAllIntegrationsOptions) (result *IntegrationCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listAllIntegrationsOptions, "listAllIntegrationsOptions") +// UpdatePrestoEngineWithContext is an alternate form of the UpdatePrestoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdatePrestoEngineWithContext(ctx context.Context, updatePrestoEngineOptions *UpdatePrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePrestoEngineOptions, "updatePrestoEngineOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updatePrestoEngineOptions, "updatePrestoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *updatePrestoEngineOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/integrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listAllIntegrationsOptions.Headers { + for headerName, headerValue := range updatePrestoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListAllIntegrations") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdatePrestoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listAllIntegrationsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listAllIntegrationsOptions.AuthInstanceID)) - } - if listAllIntegrationsOptions.Secret != nil { - builder.AddHeader("Secret", fmt.Sprint(*listAllIntegrationsOptions.Secret)) + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updatePrestoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updatePrestoEngineOptions.AuthInstanceID)) } - if listAllIntegrationsOptions.ServiceType != nil { - builder.AddQuery("service_type", fmt.Sprint(*listAllIntegrationsOptions.ServiceType)) - } - if listAllIntegrationsOptions.State != nil { - builder.AddQuery("state", strings.Join(listAllIntegrationsOptions.State, ",")) + _, err = builder.SetBodyContentJSON(updatePrestoEngineOptions.Body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -2032,12 +2280,12 @@ func (watsonxData *WatsonxDataV2) ListAllIntegrationsWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_all_integrations", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_presto_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIntegrationCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2048,88 +2296,51 @@ func (watsonxData *WatsonxDataV2) ListAllIntegrationsWithContext(ctx context.Con return } -// CreateIntegration : To register an integration -// To register an integration. -func (watsonxData *WatsonxDataV2) CreateIntegration(createIntegrationOptions *CreateIntegrationOptions) (result *Integration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateIntegrationWithContext(context.Background(), createIntegrationOptions) +// PausePrestoEngine : Pause presto engine +// Pause a running presto engine. +func (watsonxData *WatsonxDataV3) PausePrestoEngine(pausePrestoEngineOptions *PausePrestoEngineOptions) (result *PrestoEngineSuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.PausePrestoEngineWithContext(context.Background(), pausePrestoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateIntegrationWithContext is an alternate form of the CreateIntegration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateIntegrationWithContext(ctx context.Context, createIntegrationOptions *CreateIntegrationOptions) (result *Integration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createIntegrationOptions, "createIntegrationOptions cannot be nil") +// PausePrestoEngineWithContext is an alternate form of the PausePrestoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) PausePrestoEngineWithContext(ctx context.Context, pausePrestoEngineOptions *PausePrestoEngineOptions) (result *PrestoEngineSuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(pausePrestoEngineOptions, "pausePrestoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createIntegrationOptions, "createIntegrationOptions") + err = core.ValidateStruct(pausePrestoEngineOptions, "pausePrestoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *pausePrestoEngineOptions.ID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/integrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{id}/pause`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createIntegrationOptions.Headers { + for headerName, headerValue := range pausePrestoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateIntegration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "PausePrestoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createIntegrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createIntegrationOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if createIntegrationOptions.AccessToken != nil { - body["access_token"] = createIntegrationOptions.AccessToken - } - if createIntegrationOptions.Apikey != nil { - body["apikey"] = createIntegrationOptions.Apikey - } - if createIntegrationOptions.CrossAccountIntegration != nil { - body["cross_account_integration"] = createIntegrationOptions.CrossAccountIntegration - } - if createIntegrationOptions.EnableDataPolicyWithinWxd != nil { - body["enable_data_policy_within_wxd"] = createIntegrationOptions.EnableDataPolicyWithinWxd - } - if createIntegrationOptions.IkcUserAccountID != nil { - body["ikc_user_account_id"] = createIntegrationOptions.IkcUserAccountID - } - if createIntegrationOptions.Password != nil { - body["password"] = createIntegrationOptions.Password - } - if createIntegrationOptions.Resource != nil { - body["resource"] = createIntegrationOptions.Resource - } - if createIntegrationOptions.ServiceType != nil { - body["service_type"] = createIntegrationOptions.ServiceType - } - if createIntegrationOptions.StorageCatalogs != nil { - body["storage_catalogs"] = createIntegrationOptions.StorageCatalogs - } - if createIntegrationOptions.URL != nil { - body["url"] = createIntegrationOptions.URL - } - if createIntegrationOptions.Username != nil { - body["username"] = createIntegrationOptions.Username - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if pausePrestoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*pausePrestoEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -2141,12 +2352,12 @@ func (watsonxData *WatsonxDataV2) CreateIntegrationWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_integration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "pause_presto_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIntegration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngineSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2157,71 +2368,91 @@ func (watsonxData *WatsonxDataV2) CreateIntegrationWithContext(ctx context.Conte return } -// GetIntegrations : Get an Integration -// Get an Integration. -func (watsonxData *WatsonxDataV2) GetIntegrations(getIntegrationsOptions *GetIntegrationsOptions) (result *Integration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetIntegrationsWithContext(context.Background(), getIntegrationsOptions) +// RunExplainStatement : Explain presto query +// Explain a query statement. +func (watsonxData *WatsonxDataV3) RunExplainStatement(runExplainStatementOptions *RunExplainStatementOptions) (result *PrestoQueryExplain, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.RunExplainStatementWithContext(context.Background(), runExplainStatementOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetIntegrationsWithContext is an alternate form of the GetIntegrations method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetIntegrationsWithContext(ctx context.Context, getIntegrationsOptions *GetIntegrationsOptions) (result *Integration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getIntegrationsOptions, "getIntegrationsOptions cannot be nil") +// RunExplainStatementWithContext is an alternate form of the RunExplainStatement method which supports a Context parameter +func (watsonxData *WatsonxDataV3) RunExplainStatementWithContext(ctx context.Context, runExplainStatementOptions *RunExplainStatementOptions) (result *PrestoQueryExplain, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(runExplainStatementOptions, "runExplainStatementOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getIntegrationsOptions, "getIntegrationsOptions") + err = core.ValidateStruct(runExplainStatementOptions, "runExplainStatementOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "integration_id": *getIntegrationsOptions.IntegrationID, + "id": *runExplainStatementOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/integrations/{integration_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{id}/query_explain`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getIntegrationsOptions.Headers { + for headerName, headerValue := range runExplainStatementOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetIntegrations") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "RunExplainStatement") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getIntegrationsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getIntegrationsOptions.AuthInstanceID)) - } - if getIntegrationsOptions.Secret != nil { - builder.AddHeader("Secret", fmt.Sprint(*getIntegrationsOptions.Secret)) + builder.AddHeader("Content-Type", "application/json") + if runExplainStatementOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*runExplainStatementOptions.AuthInstanceID)) } - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) - return + body := make(map[string]interface{}) + if runExplainStatementOptions.Statement != nil { + body["statement"] = runExplainStatementOptions.Statement } - - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "get_integrations", getServiceComponentInfo()) + if runExplainStatementOptions.Catalog != nil { + body["catalog"] = runExplainStatementOptions.Catalog + } + if runExplainStatementOptions.Format != nil { + body["format"] = runExplainStatementOptions.Format + } + if runExplainStatementOptions.Schema != nil { + body["schema"] = runExplainStatementOptions.Schema + } + if runExplainStatementOptions.Type != nil { + body["type"] = runExplainStatementOptions.Type + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return + } + + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) + if err != nil { + core.EnrichHTTPProblem(err, "run_explain_statement", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIntegration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoQueryExplain) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2232,50 +2463,65 @@ func (watsonxData *WatsonxDataV2) GetIntegrationsWithContext(ctx context.Context return } -// DeleteIntegration : Remove an Integration -// Remove an Integration. -func (watsonxData *WatsonxDataV2) DeleteIntegration(deleteIntegrationOptions *DeleteIntegrationOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteIntegrationWithContext(context.Background(), deleteIntegrationOptions) +// RunExplainAnalyzeStatement : Explain presto analyze +// Return query metrics after query is complete. +func (watsonxData *WatsonxDataV3) RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptions *RunExplainAnalyzeStatementOptions) (result *PrestoQueryExplain, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.RunExplainAnalyzeStatementWithContext(context.Background(), runExplainAnalyzeStatementOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteIntegrationWithContext is an alternate form of the DeleteIntegration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteIntegrationWithContext(ctx context.Context, deleteIntegrationOptions *DeleteIntegrationOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteIntegrationOptions, "deleteIntegrationOptions cannot be nil") +// RunExplainAnalyzeStatementWithContext is an alternate form of the RunExplainAnalyzeStatement method which supports a Context parameter +func (watsonxData *WatsonxDataV3) RunExplainAnalyzeStatementWithContext(ctx context.Context, runExplainAnalyzeStatementOptions *RunExplainAnalyzeStatementOptions) (result *PrestoQueryExplain, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(runExplainAnalyzeStatementOptions, "runExplainAnalyzeStatementOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteIntegrationOptions, "deleteIntegrationOptions") + err = core.ValidateStruct(runExplainAnalyzeStatementOptions, "runExplainAnalyzeStatementOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "integration_id": *deleteIntegrationOptions.IntegrationID, + "id": *runExplainAnalyzeStatementOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/integrations/{integration_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{id}/query_explain_analyze`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteIntegrationOptions.Headers { + for headerName, headerValue := range runExplainAnalyzeStatementOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteIntegration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "RunExplainAnalyzeStatement") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteIntegrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteIntegrationOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if runExplainAnalyzeStatementOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*runExplainAnalyzeStatementOptions.AuthInstanceID)) + } + + body := make(map[string]interface{}) + if runExplainAnalyzeStatementOptions.Statement != nil { + body["statement"] = runExplainAnalyzeStatementOptions.Statement + } + if runExplainAnalyzeStatementOptions.Verbose != nil { + body["verbose"] = runExplainAnalyzeStatementOptions.Verbose + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -2284,68 +2530,70 @@ func (watsonxData *WatsonxDataV2) DeleteIntegrationWithContext(ctx context.Conte return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_integration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "run_explain_analyze_statement", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoQueryExplain) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateIntegration : Update an existing Integration -// Update an existing Integration. -func (watsonxData *WatsonxDataV2) UpdateIntegration(updateIntegrationOptions *UpdateIntegrationOptions) (result *Integration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateIntegrationWithContext(context.Background(), updateIntegrationOptions) +// RestartPrestoEngine : Restart a presto engine +// Restart an existing presto engine. +func (watsonxData *WatsonxDataV3) RestartPrestoEngine(restartPrestoEngineOptions *RestartPrestoEngineOptions) (result *PrestoEngineSuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.RestartPrestoEngineWithContext(context.Background(), restartPrestoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateIntegrationWithContext is an alternate form of the UpdateIntegration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateIntegrationWithContext(ctx context.Context, updateIntegrationOptions *UpdateIntegrationOptions) (result *Integration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateIntegrationOptions, "updateIntegrationOptions cannot be nil") +// RestartPrestoEngineWithContext is an alternate form of the RestartPrestoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) RestartPrestoEngineWithContext(ctx context.Context, restartPrestoEngineOptions *RestartPrestoEngineOptions) (result *PrestoEngineSuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(restartPrestoEngineOptions, "restartPrestoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateIntegrationOptions, "updateIntegrationOptions") + err = core.ValidateStruct(restartPrestoEngineOptions, "restartPrestoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "integration_id": *updateIntegrationOptions.IntegrationID, + "id": *restartPrestoEngineOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/integrations/{integration_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{id}/restart`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateIntegrationOptions.Headers { + for headerName, headerValue := range restartPrestoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateIntegration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "RestartPrestoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateIntegrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateIntegrationOptions.AuthInstanceID)) - } - - _, err = builder.SetBodyContentJSON(updateIntegrationOptions.IntegrationPatch) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if restartPrestoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*restartPrestoEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -2357,12 +2605,12 @@ func (watsonxData *WatsonxDataV2) UpdateIntegrationWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_integration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "restart_presto_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIntegration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngineSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2373,42 +2621,51 @@ func (watsonxData *WatsonxDataV2) UpdateIntegrationWithContext(ctx context.Conte return } -// ListDb2Engines : Get list of db2 engines -// Get list of all db2 engines. -func (watsonxData *WatsonxDataV2) ListDb2Engines(listDb2EnginesOptions *ListDb2EnginesOptions) (result *Db2EngineCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListDb2EnginesWithContext(context.Background(), listDb2EnginesOptions) +// ResumePrestoEngine : Resume Presto(Java) engine +// Resume a paused presto engine. +func (watsonxData *WatsonxDataV3) ResumePrestoEngine(resumePrestoEngineOptions *ResumePrestoEngineOptions) (result *PrestoEngineSuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ResumePrestoEngineWithContext(context.Background(), resumePrestoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListDb2EnginesWithContext is an alternate form of the ListDb2Engines method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListDb2EnginesWithContext(ctx context.Context, listDb2EnginesOptions *ListDb2EnginesOptions) (result *Db2EngineCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listDb2EnginesOptions, "listDb2EnginesOptions") +// ResumePrestoEngineWithContext is an alternate form of the ResumePrestoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ResumePrestoEngineWithContext(ctx context.Context, resumePrestoEngineOptions *ResumePrestoEngineOptions) (result *PrestoEngineSuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(resumePrestoEngineOptions, "resumePrestoEngineOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(resumePrestoEngineOptions, "resumePrestoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *resumePrestoEngineOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/db2_engines`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{id}/resume`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listDb2EnginesOptions.Headers { + for headerName, headerValue := range resumePrestoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListDb2Engines") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ResumePrestoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listDb2EnginesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listDb2EnginesOptions.AuthInstanceID)) + if resumePrestoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*resumePrestoEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -2420,12 +2677,12 @@ func (watsonxData *WatsonxDataV2) ListDb2EnginesWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_db2_engines", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "resume_presto_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDb2EngineCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngineSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2436,65 +2693,60 @@ func (watsonxData *WatsonxDataV2) ListDb2EnginesWithContext(ctx context.Context, return } -// CreateDb2Engine : Create db2 engine -// Create a new db2 engine. -func (watsonxData *WatsonxDataV2) CreateDb2Engine(createDb2EngineOptions *CreateDb2EngineOptions) (result *Db2Engine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateDb2EngineWithContext(context.Background(), createDb2EngineOptions) +// ScalePrestoEngine : Scale a presto engine +// Scale an existing presto engine. +func (watsonxData *WatsonxDataV3) ScalePrestoEngine(scalePrestoEngineOptions *ScalePrestoEngineOptions) (result *PrestoEngineSuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ScalePrestoEngineWithContext(context.Background(), scalePrestoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateDb2EngineWithContext is an alternate form of the CreateDb2Engine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateDb2EngineWithContext(ctx context.Context, createDb2EngineOptions *CreateDb2EngineOptions) (result *Db2Engine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createDb2EngineOptions, "createDb2EngineOptions cannot be nil") +// ScalePrestoEngineWithContext is an alternate form of the ScalePrestoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ScalePrestoEngineWithContext(ctx context.Context, scalePrestoEngineOptions *ScalePrestoEngineOptions) (result *PrestoEngineSuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(scalePrestoEngineOptions, "scalePrestoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createDb2EngineOptions, "createDb2EngineOptions") + err = core.ValidateStruct(scalePrestoEngineOptions, "scalePrestoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *scalePrestoEngineOptions.ID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/db2_engines`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/presto_engines/{id}/scale`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createDb2EngineOptions.Headers { + for headerName, headerValue := range scalePrestoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateDb2Engine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ScalePrestoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if createDb2EngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createDb2EngineOptions.AuthInstanceID)) + if scalePrestoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*scalePrestoEngineOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if createDb2EngineOptions.Origin != nil { - body["origin"] = createDb2EngineOptions.Origin - } - if createDb2EngineOptions.Description != nil { - body["description"] = createDb2EngineOptions.Description - } - if createDb2EngineOptions.EngineDetails != nil { - body["engine_details"] = createDb2EngineOptions.EngineDetails - } - if createDb2EngineOptions.EngineDisplayName != nil { - body["engine_display_name"] = createDb2EngineOptions.EngineDisplayName + if scalePrestoEngineOptions.Coordinator != nil { + body["coordinator"] = scalePrestoEngineOptions.Coordinator } - if createDb2EngineOptions.Tags != nil { - body["tags"] = createDb2EngineOptions.Tags + if scalePrestoEngineOptions.Worker != nil { + body["worker"] = scalePrestoEngineOptions.Worker } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -2511,12 +2763,12 @@ func (watsonxData *WatsonxDataV2) CreateDb2EngineWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_db2_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "scale_presto_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDb2Engine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngineSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2527,50 +2779,42 @@ func (watsonxData *WatsonxDataV2) CreateDb2EngineWithContext(ctx context.Context return } -// DeleteDb2Engine : Delete db2 engine -// Delete a db2 engine. -func (watsonxData *WatsonxDataV2) DeleteDb2Engine(deleteDb2EngineOptions *DeleteDb2EngineOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteDb2EngineWithContext(context.Background(), deleteDb2EngineOptions) +// ListPrestissimoEngines : Get list of prestissimo engines +// Get list of prestissimo engines. +func (watsonxData *WatsonxDataV3) ListPrestissimoEngines(listPrestissimoEnginesOptions *ListPrestissimoEnginesOptions) (result *PrestissimoEngineCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListPrestissimoEnginesWithContext(context.Background(), listPrestissimoEnginesOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteDb2EngineWithContext is an alternate form of the DeleteDb2Engine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteDb2EngineWithContext(ctx context.Context, deleteDb2EngineOptions *DeleteDb2EngineOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteDb2EngineOptions, "deleteDb2EngineOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteDb2EngineOptions, "deleteDb2EngineOptions") +// ListPrestissimoEnginesWithContext is an alternate form of the ListPrestissimoEngines method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListPrestissimoEnginesWithContext(ctx context.Context, listPrestissimoEnginesOptions *ListPrestissimoEnginesOptions) (result *PrestissimoEngineCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPrestissimoEnginesOptions, "listPrestissimoEnginesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "engine_id": *deleteDb2EngineOptions.EngineID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/db2_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteDb2EngineOptions.Headers { + for headerName, headerValue := range listPrestissimoEnginesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteDb2Engine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListPrestissimoEngines") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteDb2EngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteDb2EngineOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + if listPrestissimoEnginesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listPrestissimoEnginesOptions.AuthInstanceID)) } request, err := builder.Build() @@ -2579,65 +2823,92 @@ func (watsonxData *WatsonxDataV2) DeleteDb2EngineWithContext(ctx context.Context return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_db2_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_prestissimo_engines", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestissimoEngineCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateDb2Engine : Update db2 engine -// Update details of db2 engine. -func (watsonxData *WatsonxDataV2) UpdateDb2Engine(updateDb2EngineOptions *UpdateDb2EngineOptions) (result *Db2Engine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateDb2EngineWithContext(context.Background(), updateDb2EngineOptions) +// CreatePrestissimoEngine : Create prestissimo engine +// Create a new prestissimo engine. +func (watsonxData *WatsonxDataV3) CreatePrestissimoEngine(createPrestissimoEngineOptions *CreatePrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreatePrestissimoEngineWithContext(context.Background(), createPrestissimoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateDb2EngineWithContext is an alternate form of the UpdateDb2Engine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateDb2EngineWithContext(ctx context.Context, updateDb2EngineOptions *UpdateDb2EngineOptions) (result *Db2Engine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateDb2EngineOptions, "updateDb2EngineOptions cannot be nil") +// CreatePrestissimoEngineWithContext is an alternate form of the CreatePrestissimoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreatePrestissimoEngineWithContext(ctx context.Context, createPrestissimoEngineOptions *CreatePrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPrestissimoEngineOptions, "createPrestissimoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateDb2EngineOptions, "updateDb2EngineOptions") + err = core.ValidateStruct(createPrestissimoEngineOptions, "createPrestissimoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "engine_id": *updateDb2EngineOptions.EngineID, - } - - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/db2_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateDb2EngineOptions.Headers { + for headerName, headerValue := range createPrestissimoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateDb2Engine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreatePrestissimoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateDb2EngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateDb2EngineOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if createPrestissimoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createPrestissimoEngineOptions.AuthInstanceID)) } - _, err = builder.SetBodyContentJSON(updateDb2EngineOptions.Body) + body := make(map[string]interface{}) + if createPrestissimoEngineOptions.Configuration != nil { + body["configuration"] = createPrestissimoEngineOptions.Configuration + } + if createPrestissimoEngineOptions.DisplayName != nil { + body["display_name"] = createPrestissimoEngineOptions.DisplayName + } + if createPrestissimoEngineOptions.Origin != nil { + body["origin"] = createPrestissimoEngineOptions.Origin + } + if createPrestissimoEngineOptions.AssociatedCatalogs != nil { + body["associated_catalogs"] = createPrestissimoEngineOptions.AssociatedCatalogs + } + if createPrestissimoEngineOptions.Description != nil { + body["description"] = createPrestissimoEngineOptions.Description + } + if createPrestissimoEngineOptions.ID != nil { + body["id"] = createPrestissimoEngineOptions.ID + } + if createPrestissimoEngineOptions.Tags != nil { + body["tags"] = createPrestissimoEngineOptions.Tags + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -2652,12 +2923,12 @@ func (watsonxData *WatsonxDataV2) UpdateDb2EngineWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_db2_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_prestissimo_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDb2Engine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestissimoEngine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2668,42 +2939,52 @@ func (watsonxData *WatsonxDataV2) UpdateDb2EngineWithContext(ctx context.Context return } -// ListNetezzaEngines : Get list of netezza engines -// Get list of all netezza engines. -func (watsonxData *WatsonxDataV2) ListNetezzaEngines(listNetezzaEnginesOptions *ListNetezzaEnginesOptions) (result *NetezzaEngineCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListNetezzaEnginesWithContext(context.Background(), listNetezzaEnginesOptions) +// GetPrestissimoEngineCatalog : Get prestissimo engine catalog +// Get catalog attached to a prestissimo engine. +func (watsonxData *WatsonxDataV3) GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptions *GetPrestissimoEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetPrestissimoEngineCatalogWithContext(context.Background(), getPrestissimoEngineCatalogOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListNetezzaEnginesWithContext is an alternate form of the ListNetezzaEngines method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListNetezzaEnginesWithContext(ctx context.Context, listNetezzaEnginesOptions *ListNetezzaEnginesOptions) (result *NetezzaEngineCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listNetezzaEnginesOptions, "listNetezzaEnginesOptions") - if err != nil { +// GetPrestissimoEngineCatalogWithContext is an alternate form of the GetPrestissimoEngineCatalog method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetPrestissimoEngineCatalogWithContext(ctx context.Context, getPrestissimoEngineCatalogOptions *GetPrestissimoEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPrestissimoEngineCatalogOptions, "getPrestissimoEngineCatalogOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getPrestissimoEngineCatalogOptions, "getPrestissimoEngineCatalogOptions") + if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "engine_id": *getPrestissimoEngineCatalogOptions.EngineID, + "id": *getPrestissimoEngineCatalogOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/netezza_engines`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{engine_id}/catalogs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listNetezzaEnginesOptions.Headers { + for headerName, headerValue := range getPrestissimoEngineCatalogOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListNetezzaEngines") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetPrestissimoEngineCatalog") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listNetezzaEnginesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listNetezzaEnginesOptions.AuthInstanceID)) + if getPrestissimoEngineCatalogOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getPrestissimoEngineCatalogOptions.AuthInstanceID)) } request, err := builder.Build() @@ -2715,12 +2996,12 @@ func (watsonxData *WatsonxDataV2) ListNetezzaEnginesWithContext(ctx context.Cont var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_netezza_engines", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_prestissimo_engine_catalog", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetezzaEngineCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2731,70 +3012,51 @@ func (watsonxData *WatsonxDataV2) ListNetezzaEnginesWithContext(ctx context.Cont return } -// CreateNetezzaEngine : Create netezza engine -// Create a new netezza engine. -func (watsonxData *WatsonxDataV2) CreateNetezzaEngine(createNetezzaEngineOptions *CreateNetezzaEngineOptions) (result *NetezzaEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateNetezzaEngineWithContext(context.Background(), createNetezzaEngineOptions) +// GetPrestissimoEngine : Get prestissimo engine +// Prestissimo engine details. +func (watsonxData *WatsonxDataV3) GetPrestissimoEngine(getPrestissimoEngineOptions *GetPrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetPrestissimoEngineWithContext(context.Background(), getPrestissimoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateNetezzaEngineWithContext is an alternate form of the CreateNetezzaEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateNetezzaEngineWithContext(ctx context.Context, createNetezzaEngineOptions *CreateNetezzaEngineOptions) (result *NetezzaEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createNetezzaEngineOptions, "createNetezzaEngineOptions cannot be nil") +// GetPrestissimoEngineWithContext is an alternate form of the GetPrestissimoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetPrestissimoEngineWithContext(ctx context.Context, getPrestissimoEngineOptions *GetPrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPrestissimoEngineOptions, "getPrestissimoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createNetezzaEngineOptions, "createNetezzaEngineOptions") + err = core.ValidateStruct(getPrestissimoEngineOptions, "getPrestissimoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *getPrestissimoEngineOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/netezza_engines`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createNetezzaEngineOptions.Headers { + for headerName, headerValue := range getPrestissimoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateNetezzaEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetPrestissimoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createNetezzaEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createNetezzaEngineOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if createNetezzaEngineOptions.Origin != nil { - body["origin"] = createNetezzaEngineOptions.Origin - } - if createNetezzaEngineOptions.Description != nil { - body["description"] = createNetezzaEngineOptions.Description - } - if createNetezzaEngineOptions.EngineDetails != nil { - body["engine_details"] = createNetezzaEngineOptions.EngineDetails - } - if createNetezzaEngineOptions.EngineDisplayName != nil { - body["engine_display_name"] = createNetezzaEngineOptions.EngineDisplayName - } - if createNetezzaEngineOptions.Tags != nil { - body["tags"] = createNetezzaEngineOptions.Tags - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if getPrestissimoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getPrestissimoEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -2806,12 +3068,12 @@ func (watsonxData *WatsonxDataV2) CreateNetezzaEngineWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_netezza_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_prestissimo_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetezzaEngine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestissimoEngine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2822,50 +3084,50 @@ func (watsonxData *WatsonxDataV2) CreateNetezzaEngineWithContext(ctx context.Con return } -// DeleteNetezzaEngine : Delete netezza engine -// Delete a netezza engine. -func (watsonxData *WatsonxDataV2) DeleteNetezzaEngine(deleteNetezzaEngineOptions *DeleteNetezzaEngineOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteNetezzaEngineWithContext(context.Background(), deleteNetezzaEngineOptions) +// DeletePrestissimoEngine : Delete prestissimo engine +// Delete a prestissimo engine. +func (watsonxData *WatsonxDataV3) DeletePrestissimoEngine(deletePrestissimoEngineOptions *DeletePrestissimoEngineOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeletePrestissimoEngineWithContext(context.Background(), deletePrestissimoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteNetezzaEngineWithContext is an alternate form of the DeleteNetezzaEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteNetezzaEngineWithContext(ctx context.Context, deleteNetezzaEngineOptions *DeleteNetezzaEngineOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteNetezzaEngineOptions, "deleteNetezzaEngineOptions cannot be nil") +// DeletePrestissimoEngineWithContext is an alternate form of the DeletePrestissimoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeletePrestissimoEngineWithContext(ctx context.Context, deletePrestissimoEngineOptions *DeletePrestissimoEngineOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePrestissimoEngineOptions, "deletePrestissimoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteNetezzaEngineOptions, "deleteNetezzaEngineOptions") + err = core.ValidateStruct(deletePrestissimoEngineOptions, "deletePrestissimoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *deleteNetezzaEngineOptions.EngineID, + "id": *deletePrestissimoEngineOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/netezza_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteNetezzaEngineOptions.Headers { + for headerName, headerValue := range deletePrestissimoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteNetezzaEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeletePrestissimoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteNetezzaEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteNetezzaEngineOptions.AuthInstanceID)) + if deletePrestissimoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deletePrestissimoEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -2876,7 +3138,7 @@ func (watsonxData *WatsonxDataV2) DeleteNetezzaEngineWithContext(ctx context.Con response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_netezza_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_prestissimo_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -2884,55 +3146,55 @@ func (watsonxData *WatsonxDataV2) DeleteNetezzaEngineWithContext(ctx context.Con return } -// UpdateNetezzaEngine : Update netezza engine -// Update details of netezza engine. -func (watsonxData *WatsonxDataV2) UpdateNetezzaEngine(updateNetezzaEngineOptions *UpdateNetezzaEngineOptions) (result *NetezzaEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateNetezzaEngineWithContext(context.Background(), updateNetezzaEngineOptions) +// UpdatePrestissimoEngine : Update prestissimo engine +// Update details of prestissimo engine. +func (watsonxData *WatsonxDataV3) UpdatePrestissimoEngine(updatePrestissimoEngineOptions *UpdatePrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdatePrestissimoEngineWithContext(context.Background(), updatePrestissimoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateNetezzaEngineWithContext is an alternate form of the UpdateNetezzaEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateNetezzaEngineWithContext(ctx context.Context, updateNetezzaEngineOptions *UpdateNetezzaEngineOptions) (result *NetezzaEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateNetezzaEngineOptions, "updateNetezzaEngineOptions cannot be nil") +// UpdatePrestissimoEngineWithContext is an alternate form of the UpdatePrestissimoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdatePrestissimoEngineWithContext(ctx context.Context, updatePrestissimoEngineOptions *UpdatePrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePrestissimoEngineOptions, "updatePrestissimoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateNetezzaEngineOptions, "updateNetezzaEngineOptions") + err = core.ValidateStruct(updatePrestissimoEngineOptions, "updatePrestissimoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *updateNetezzaEngineOptions.EngineID, + "id": *updatePrestissimoEngineOptions.ID, } builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/netezza_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateNetezzaEngineOptions.Headers { + for headerName, headerValue := range updatePrestissimoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateNetezzaEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdatePrestissimoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateNetezzaEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateNetezzaEngineOptions.AuthInstanceID)) + if updatePrestissimoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updatePrestissimoEngineOptions.AuthInstanceID)) } - _, err = builder.SetBodyContentJSON(updateNetezzaEngineOptions.Body) + _, err = builder.SetBodyContentJSON(updatePrestissimoEngineOptions.Body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -2947,12 +3209,12 @@ func (watsonxData *WatsonxDataV2) UpdateNetezzaEngineWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_netezza_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_prestissimo_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetezzaEngine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestissimoEngine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -2963,68 +3225,51 @@ func (watsonxData *WatsonxDataV2) UpdateNetezzaEngineWithContext(ctx context.Con return } -// CreateExecuteQuery : Execute a query -// Execute a query. -func (watsonxData *WatsonxDataV2) CreateExecuteQuery(createExecuteQueryOptions *CreateExecuteQueryOptions) (result *ExecuteQueryCreatedBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateExecuteQueryWithContext(context.Background(), createExecuteQueryOptions) +// ListPrestissimoEngineCatalogs : Get prestissimo engine catalogs +// Get list of all catalogs attached a prestissimo engine. +func (watsonxData *WatsonxDataV3) ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptions *ListPrestissimoEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListPrestissimoEngineCatalogsWithContext(context.Background(), listPrestissimoEngineCatalogsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateExecuteQueryWithContext is an alternate form of the CreateExecuteQuery method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateExecuteQueryWithContext(ctx context.Context, createExecuteQueryOptions *CreateExecuteQueryOptions) (result *ExecuteQueryCreatedBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createExecuteQueryOptions, "createExecuteQueryOptions cannot be nil") +// ListPrestissimoEngineCatalogsWithContext is an alternate form of the ListPrestissimoEngineCatalogs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListPrestissimoEngineCatalogsWithContext(ctx context.Context, listPrestissimoEngineCatalogsOptions *ListPrestissimoEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listPrestissimoEngineCatalogsOptions, "listPrestissimoEngineCatalogsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createExecuteQueryOptions, "createExecuteQueryOptions") + err = core.ValidateStruct(listPrestissimoEngineCatalogsOptions, "listPrestissimoEngineCatalogsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *createExecuteQueryOptions.EngineID, + "id": *listPrestissimoEngineCatalogsOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/queries/execute/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}/catalogs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createExecuteQueryOptions.Headers { + for headerName, headerValue := range listPrestissimoEngineCatalogsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateExecuteQuery") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListPrestissimoEngineCatalogs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createExecuteQueryOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createExecuteQueryOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if createExecuteQueryOptions.SqlString != nil { - body["sql_string"] = createExecuteQueryOptions.SqlString - } - if createExecuteQueryOptions.CatalogName != nil { - body["catalog_name"] = createExecuteQueryOptions.CatalogName - } - if createExecuteQueryOptions.SchemaName != nil { - body["schema_name"] = createExecuteQueryOptions.SchemaName - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listPrestissimoEngineCatalogsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listPrestissimoEngineCatalogsOptions.AuthInstanceID)) } request, err := builder.Build() @@ -3036,12 +3281,12 @@ func (watsonxData *WatsonxDataV2) CreateExecuteQueryWithContext(ctx context.Cont var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_execute_query", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_prestissimo_engine_catalogs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalExecuteQueryCreatedBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3052,42 +3297,62 @@ func (watsonxData *WatsonxDataV2) CreateExecuteQueryWithContext(ctx context.Cont return } -// ListInstanceDetails : Get all instance details -// Get all engine details. -func (watsonxData *WatsonxDataV2) ListInstanceDetails(listInstanceDetailsOptions *ListInstanceDetailsOptions) (result *WatsonxInstanceDetailsCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListInstanceDetailsWithContext(context.Background(), listInstanceDetailsOptions) +// CreatePrestissimoEngineCatalogs : Associate catalogs to a prestissimo engine +// Associate one or more catalogs to a prestissimo engine. +func (watsonxData *WatsonxDataV3) CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptions *CreatePrestissimoEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreatePrestissimoEngineCatalogsWithContext(context.Background(), createPrestissimoEngineCatalogsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceDetailsWithContext is an alternate form of the ListInstanceDetails method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListInstanceDetailsWithContext(ctx context.Context, listInstanceDetailsOptions *ListInstanceDetailsOptions) (result *WatsonxInstanceDetailsCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listInstanceDetailsOptions, "listInstanceDetailsOptions") +// CreatePrestissimoEngineCatalogsWithContext is an alternate form of the CreatePrestissimoEngineCatalogs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreatePrestissimoEngineCatalogsWithContext(ctx context.Context, createPrestissimoEngineCatalogsOptions *CreatePrestissimoEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPrestissimoEngineCatalogsOptions, "createPrestissimoEngineCatalogsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createPrestissimoEngineCatalogsOptions, "createPrestissimoEngineCatalogsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *createPrestissimoEngineCatalogsOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/instance_details`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}/catalogs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceDetailsOptions.Headers { + for headerName, headerValue := range createPrestissimoEngineCatalogsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListInstanceDetails") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreatePrestissimoEngineCatalogs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listInstanceDetailsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listInstanceDetailsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if createPrestissimoEngineCatalogsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createPrestissimoEngineCatalogsOptions.AuthInstanceID)) + } + + body := make(map[string]interface{}) + if createPrestissimoEngineCatalogsOptions.CatalogNames != nil { + body["catalog_names"] = createPrestissimoEngineCatalogsOptions.CatalogNames + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -3099,12 +3364,12 @@ func (watsonxData *WatsonxDataV2) ListInstanceDetailsWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_details", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_prestissimo_engine_catalogs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalWatsonxInstanceDetailsCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3115,53 +3380,53 @@ func (watsonxData *WatsonxDataV2) ListInstanceDetailsWithContext(ctx context.Con return } -// ListInstanceServiceDetails : Get engines and services detail -// Get engines and services detail. -func (watsonxData *WatsonxDataV2) ListInstanceServiceDetails(listInstanceServiceDetailsOptions *ListInstanceServiceDetailsOptions) (result *EnginesServicesDetails, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListInstanceServiceDetailsWithContext(context.Background(), listInstanceServiceDetailsOptions) +// DeletePrestissimoEngineCatalogs : Disassociate catalogs from a prestissimo engine +// Disassociate one or more catalogs from a prestissimo engine. +func (watsonxData *WatsonxDataV3) DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptions *DeletePrestissimoEngineCatalogsOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeletePrestissimoEngineCatalogsWithContext(context.Background(), deletePrestissimoEngineCatalogsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListInstanceServiceDetailsWithContext is an alternate form of the ListInstanceServiceDetails method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListInstanceServiceDetailsWithContext(ctx context.Context, listInstanceServiceDetailsOptions *ListInstanceServiceDetailsOptions) (result *EnginesServicesDetails, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listInstanceServiceDetailsOptions, "listInstanceServiceDetailsOptions cannot be nil") +// DeletePrestissimoEngineCatalogsWithContext is an alternate form of the DeletePrestissimoEngineCatalogs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeletePrestissimoEngineCatalogsWithContext(ctx context.Context, deletePrestissimoEngineCatalogsOptions *DeletePrestissimoEngineCatalogsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePrestissimoEngineCatalogsOptions, "deletePrestissimoEngineCatalogsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listInstanceServiceDetailsOptions, "listInstanceServiceDetailsOptions") + err = core.ValidateStruct(deletePrestissimoEngineCatalogsOptions, "deletePrestissimoEngineCatalogsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *deletePrestissimoEngineCatalogsOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/instance_details/engines_services`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}/catalogs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listInstanceServiceDetailsOptions.Headers { + for headerName, headerValue := range deletePrestissimoEngineCatalogsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListInstanceServiceDetails") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeletePrestissimoEngineCatalogs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if listInstanceServiceDetailsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listInstanceServiceDetailsOptions.AuthInstanceID)) + if deletePrestissimoEngineCatalogsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deletePrestissimoEngineCatalogsOptions.AuthInstanceID)) } - builder.AddQuery("target", fmt.Sprint(*listInstanceServiceDetailsOptions.Target)) - if listInstanceServiceDetailsOptions.InternalHost != nil { - builder.AddQuery("internal_host", fmt.Sprint(*listInstanceServiceDetailsOptions.InternalHost)) - } + builder.AddQuery("catalog_names", fmt.Sprint(*deletePrestissimoEngineCatalogsOptions.CatalogNames)) request, err := builder.Build() if err != nil { @@ -3169,75 +3434,61 @@ func (watsonxData *WatsonxDataV2) ListInstanceServiceDetailsWithContext(ctx cont return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "list_instance_service_details", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_prestissimo_engine_catalogs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEnginesServicesDetails) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetServicesDetails : Get services details -// Get services details for a given engine or service type. -func (watsonxData *WatsonxDataV2) GetServicesDetails(getServicesDetailsOptions *GetServicesDetailsOptions) (result *ServicesDetails, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetServicesDetailsWithContext(context.Background(), getServicesDetailsOptions) +// PausePrestissimoEngine : Pause prestissimo engine +// Pause a running prestissimo engine ie, only available is SAAS. +func (watsonxData *WatsonxDataV3) PausePrestissimoEngine(pausePrestissimoEngineOptions *PausePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.PausePrestissimoEngineWithContext(context.Background(), pausePrestissimoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetServicesDetailsWithContext is an alternate form of the GetServicesDetails method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetServicesDetailsWithContext(ctx context.Context, getServicesDetailsOptions *GetServicesDetailsOptions) (result *ServicesDetails, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getServicesDetailsOptions, "getServicesDetailsOptions cannot be nil") +// PausePrestissimoEngineWithContext is an alternate form of the PausePrestissimoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) PausePrestissimoEngineWithContext(ctx context.Context, pausePrestissimoEngineOptions *PausePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(pausePrestissimoEngineOptions, "pausePrestissimoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getServicesDetailsOptions, "getServicesDetailsOptions") + err = core.ValidateStruct(pausePrestissimoEngineOptions, "pausePrestissimoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_or_service_type": *getServicesDetailsOptions.EngineOrServiceType, + "id": *pausePrestissimoEngineOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/instance_details/engines_services/{engine_or_service_type}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}/pause`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getServicesDetailsOptions.Headers { + for headerName, headerValue := range pausePrestissimoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetServicesDetails") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "PausePrestissimoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getServicesDetailsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getServicesDetailsOptions.AuthInstanceID)) - } - - builder.AddQuery("target", fmt.Sprint(*getServicesDetailsOptions.Target)) - if getServicesDetailsOptions.InternalHost != nil { - builder.AddQuery("internal_host", fmt.Sprint(*getServicesDetailsOptions.InternalHost)) + if pausePrestissimoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*pausePrestissimoEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -3249,12 +3500,12 @@ func (watsonxData *WatsonxDataV2) GetServicesDetailsWithContext(ctx context.Cont var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_services_details", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "pause_prestissimo_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalServicesDetails) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3265,60 +3516,74 @@ func (watsonxData *WatsonxDataV2) GetServicesDetailsWithContext(ctx context.Cont return } -// GetServiceDetail : Get Milvus service detail -// Get Milvus service detail. -func (watsonxData *WatsonxDataV2) GetServiceDetail(getServiceDetailOptions *GetServiceDetailOptions) (result *ConnectionPropertiesDetails, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetServiceDetailWithContext(context.Background(), getServiceDetailOptions) +// RunPrestissimoExplainStatement : Explain query +// Explain a query statement. +func (watsonxData *WatsonxDataV3) RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptions *RunPrestissimoExplainStatementOptions) (result *ResultPrestissimoExplainStatement, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.RunPrestissimoExplainStatementWithContext(context.Background(), runPrestissimoExplainStatementOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetServiceDetailWithContext is an alternate form of the GetServiceDetail method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetServiceDetailWithContext(ctx context.Context, getServiceDetailOptions *GetServiceDetailOptions) (result *ConnectionPropertiesDetails, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getServiceDetailOptions, "getServiceDetailOptions cannot be nil") +// RunPrestissimoExplainStatementWithContext is an alternate form of the RunPrestissimoExplainStatement method which supports a Context parameter +func (watsonxData *WatsonxDataV3) RunPrestissimoExplainStatementWithContext(ctx context.Context, runPrestissimoExplainStatementOptions *RunPrestissimoExplainStatementOptions) (result *ResultPrestissimoExplainStatement, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(runPrestissimoExplainStatementOptions, "runPrestissimoExplainStatementOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getServiceDetailOptions, "getServiceDetailOptions") + err = core.ValidateStruct(runPrestissimoExplainStatementOptions, "runPrestissimoExplainStatementOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_or_service_type": *getServiceDetailOptions.EngineOrServiceType, - "id": *getServiceDetailOptions.ID, + "id": *runPrestissimoExplainStatementOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/instance_details/engines_services/{engine_or_service_type}/id/{id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}/query_explain`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getServiceDetailOptions.Headers { + for headerName, headerValue := range runPrestissimoExplainStatementOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetServiceDetail") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "RunPrestissimoExplainStatement") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getServiceDetailOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getServiceDetailOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if runPrestissimoExplainStatementOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*runPrestissimoExplainStatementOptions.AuthInstanceID)) } - builder.AddQuery("target", fmt.Sprint(*getServiceDetailOptions.Target)) - if getServiceDetailOptions.Database != nil { - builder.AddQuery("database", fmt.Sprint(*getServiceDetailOptions.Database)) + body := make(map[string]interface{}) + if runPrestissimoExplainStatementOptions.Statement != nil { + body["statement"] = runPrestissimoExplainStatementOptions.Statement + } + if runPrestissimoExplainStatementOptions.Catalog != nil { + body["catalog"] = runPrestissimoExplainStatementOptions.Catalog + } + if runPrestissimoExplainStatementOptions.Format != nil { + body["format"] = runPrestissimoExplainStatementOptions.Format + } + if runPrestissimoExplainStatementOptions.Schema != nil { + body["schema"] = runPrestissimoExplainStatementOptions.Schema + } + if runPrestissimoExplainStatementOptions.Type != nil { + body["type"] = runPrestissimoExplainStatementOptions.Type } - if getServiceDetailOptions.InternalHost != nil { - builder.AddQuery("internal_host", fmt.Sprint(*getServiceDetailOptions.InternalHost)) + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -3330,12 +3595,12 @@ func (watsonxData *WatsonxDataV2) GetServiceDetailWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_service_detail", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "run_prestissimo_explain_statement", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalConnectionPropertiesDetails) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResultPrestissimoExplainStatement) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3346,137 +3611,60 @@ func (watsonxData *WatsonxDataV2) GetServiceDetailWithContext(ctx context.Contex return } -// ListPrestissimoEngines : Get list of prestissimo engines -// Get list of all prestissimo engines. -func (watsonxData *WatsonxDataV2) ListPrestissimoEngines(listPrestissimoEnginesOptions *ListPrestissimoEnginesOptions) (result *PrestissimoEngineCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListPrestissimoEnginesWithContext(context.Background(), listPrestissimoEnginesOptions) +// RunPrestissimoExplainAnalyzeStatement : Explain analyze +// Return query metrics after query is complete. +func (watsonxData *WatsonxDataV3) RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptions *RunPrestissimoExplainAnalyzeStatementOptions) (result *ResultRunPrestissimoExplainAnalyzeStatement, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.RunPrestissimoExplainAnalyzeStatementWithContext(context.Background(), runPrestissimoExplainAnalyzeStatementOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListPrestissimoEnginesWithContext is an alternate form of the ListPrestissimoEngines method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListPrestissimoEnginesWithContext(ctx context.Context, listPrestissimoEnginesOptions *ListPrestissimoEnginesOptions) (result *PrestissimoEngineCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPrestissimoEnginesOptions, "listPrestissimoEnginesOptions") +// RunPrestissimoExplainAnalyzeStatementWithContext is an alternate form of the RunPrestissimoExplainAnalyzeStatement method which supports a Context parameter +func (watsonxData *WatsonxDataV3) RunPrestissimoExplainAnalyzeStatementWithContext(ctx context.Context, runPrestissimoExplainAnalyzeStatementOptions *RunPrestissimoExplainAnalyzeStatementOptions) (result *ResultRunPrestissimoExplainAnalyzeStatement, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(runPrestissimoExplainAnalyzeStatementOptions, "runPrestissimoExplainAnalyzeStatementOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(runPrestissimoExplainAnalyzeStatementOptions, "runPrestissimoExplainAnalyzeStatementOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *runPrestissimoExplainAnalyzeStatementOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}/query_explain_analyze`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPrestissimoEnginesOptions.Headers { + for headerName, headerValue := range runPrestissimoExplainAnalyzeStatementOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListPrestissimoEngines") - for headerName, headerValue := range sdkHeaders { - builder.AddHeader(headerName, headerValue) - } - builder.AddHeader("Accept", "application/json") - if listPrestissimoEnginesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listPrestissimoEnginesOptions.AuthInstanceID)) - } - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) - return - } - - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) - if err != nil { - core.EnrichHTTPProblem(err, "list_prestissimo_engines", getServiceComponentInfo()) - err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) - return - } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestissimoEngineCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } - - return -} - -// CreatePrestissimoEngine : Create prestissimo engine -// Create a new prestissimo engine. -func (watsonxData *WatsonxDataV2) CreatePrestissimoEngine(createPrestissimoEngineOptions *CreatePrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreatePrestissimoEngineWithContext(context.Background(), createPrestissimoEngineOptions) - err = core.RepurposeSDKProblem(err, "") - return -} - -// CreatePrestissimoEngineWithContext is an alternate form of the CreatePrestissimoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreatePrestissimoEngineWithContext(ctx context.Context, createPrestissimoEngineOptions *CreatePrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPrestissimoEngineOptions, "createPrestissimoEngineOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createPrestissimoEngineOptions, "createPrestissimoEngineOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - builder := core.NewRequestBuilder(core.POST) - builder = builder.WithContext(ctx) - builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines`, nil) - if err != nil { - err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) - return - } - - for headerName, headerValue := range createPrestissimoEngineOptions.Headers { - builder.AddHeader(headerName, headerValue) - } - - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreatePrestissimoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "RunPrestissimoExplainAnalyzeStatement") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if createPrestissimoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createPrestissimoEngineOptions.AuthInstanceID)) + if runPrestissimoExplainAnalyzeStatementOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*runPrestissimoExplainAnalyzeStatementOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if createPrestissimoEngineOptions.Origin != nil { - body["origin"] = createPrestissimoEngineOptions.Origin - } - if createPrestissimoEngineOptions.AssociatedCatalogs != nil { - body["associated_catalogs"] = createPrestissimoEngineOptions.AssociatedCatalogs - } - if createPrestissimoEngineOptions.Description != nil { - body["description"] = createPrestissimoEngineOptions.Description - } - if createPrestissimoEngineOptions.EngineDetails != nil { - body["engine_details"] = createPrestissimoEngineOptions.EngineDetails - } - if createPrestissimoEngineOptions.EngineDisplayName != nil { - body["engine_display_name"] = createPrestissimoEngineOptions.EngineDisplayName - } - if createPrestissimoEngineOptions.Region != nil { - body["region"] = createPrestissimoEngineOptions.Region - } - if createPrestissimoEngineOptions.Tags != nil { - body["tags"] = createPrestissimoEngineOptions.Tags + if runPrestissimoExplainAnalyzeStatementOptions.Statement != nil { + body["statement"] = runPrestissimoExplainAnalyzeStatementOptions.Statement } - if createPrestissimoEngineOptions.Version != nil { - body["version"] = createPrestissimoEngineOptions.Version + if runPrestissimoExplainAnalyzeStatementOptions.Verbose != nil { + body["verbose"] = runPrestissimoExplainAnalyzeStatementOptions.Verbose } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -3493,12 +3681,12 @@ func (watsonxData *WatsonxDataV2) CreatePrestissimoEngineWithContext(ctx context var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_prestissimo_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "run_prestissimo_explain_analyze_statement", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestissimoEngine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResultRunPrestissimoExplainAnalyzeStatement) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3509,51 +3697,51 @@ func (watsonxData *WatsonxDataV2) CreatePrestissimoEngineWithContext(ctx context return } -// GetPrestissimoEngine : Get prestissimo engine -// Get details of one prestissimo engine. -func (watsonxData *WatsonxDataV2) GetPrestissimoEngine(getPrestissimoEngineOptions *GetPrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetPrestissimoEngineWithContext(context.Background(), getPrestissimoEngineOptions) +// RestartPrestissimoEngine : Restart a prestissimo engine +// Restart an existing prestissimo engine. +func (watsonxData *WatsonxDataV3) RestartPrestissimoEngine(restartPrestissimoEngineOptions *RestartPrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.RestartPrestissimoEngineWithContext(context.Background(), restartPrestissimoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetPrestissimoEngineWithContext is an alternate form of the GetPrestissimoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetPrestissimoEngineWithContext(ctx context.Context, getPrestissimoEngineOptions *GetPrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPrestissimoEngineOptions, "getPrestissimoEngineOptions cannot be nil") +// RestartPrestissimoEngineWithContext is an alternate form of the RestartPrestissimoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) RestartPrestissimoEngineWithContext(ctx context.Context, restartPrestissimoEngineOptions *RestartPrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(restartPrestissimoEngineOptions, "restartPrestissimoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getPrestissimoEngineOptions, "getPrestissimoEngineOptions") + err = core.ValidateStruct(restartPrestissimoEngineOptions, "restartPrestissimoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *getPrestissimoEngineOptions.EngineID, + "id": *restartPrestissimoEngineOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}/restart`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getPrestissimoEngineOptions.Headers { + for headerName, headerValue := range restartPrestissimoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetPrestissimoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "RestartPrestissimoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getPrestissimoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getPrestissimoEngineOptions.AuthInstanceID)) + if restartPrestissimoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*restartPrestissimoEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -3565,12 +3753,12 @@ func (watsonxData *WatsonxDataV2) GetPrestissimoEngineWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_prestissimo_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "restart_prestissimo_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestissimoEngine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3581,50 +3769,51 @@ func (watsonxData *WatsonxDataV2) GetPrestissimoEngineWithContext(ctx context.Co return } -// DeletePrestissimoEngine : Delete prestissimo engine -// Delete a prestissimo engine. -func (watsonxData *WatsonxDataV2) DeletePrestissimoEngine(deletePrestissimoEngineOptions *DeletePrestissimoEngineOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeletePrestissimoEngineWithContext(context.Background(), deletePrestissimoEngineOptions) +// ResumePrestissimoEngine : Resume prestissimo engine +// Resume a paused prestissimo engine ie, only available is SAAS. +func (watsonxData *WatsonxDataV3) ResumePrestissimoEngine(resumePrestissimoEngineOptions *ResumePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ResumePrestissimoEngineWithContext(context.Background(), resumePrestissimoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeletePrestissimoEngineWithContext is an alternate form of the DeletePrestissimoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeletePrestissimoEngineWithContext(ctx context.Context, deletePrestissimoEngineOptions *DeletePrestissimoEngineOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePrestissimoEngineOptions, "deletePrestissimoEngineOptions cannot be nil") +// ResumePrestissimoEngineWithContext is an alternate form of the ResumePrestissimoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ResumePrestissimoEngineWithContext(ctx context.Context, resumePrestissimoEngineOptions *ResumePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(resumePrestissimoEngineOptions, "resumePrestissimoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deletePrestissimoEngineOptions, "deletePrestissimoEngineOptions") + err = core.ValidateStruct(resumePrestissimoEngineOptions, "resumePrestissimoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *deletePrestissimoEngineOptions.EngineID, + "id": *resumePrestissimoEngineOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}/resume`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deletePrestissimoEngineOptions.Headers { + for headerName, headerValue := range resumePrestissimoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeletePrestissimoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ResumePrestissimoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deletePrestissimoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deletePrestissimoEngineOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + if resumePrestissimoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*resumePrestissimoEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -3633,65 +3822,81 @@ func (watsonxData *WatsonxDataV2) DeletePrestissimoEngineWithContext(ctx context return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_prestissimo_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "resume_prestissimo_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdatePrestissimoEngine : Update prestissimo engine -// Update details of prestissimo engine. -func (watsonxData *WatsonxDataV2) UpdatePrestissimoEngine(updatePrestissimoEngineOptions *UpdatePrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdatePrestissimoEngineWithContext(context.Background(), updatePrestissimoEngineOptions) +// ScalePrestissimoEngine : Scale a prestissimo engine +// Scale an existing prestissimo engine ie, only available is SAAS. +func (watsonxData *WatsonxDataV3) ScalePrestissimoEngine(scalePrestissimoEngineOptions *ScalePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ScalePrestissimoEngineWithContext(context.Background(), scalePrestissimoEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdatePrestissimoEngineWithContext is an alternate form of the UpdatePrestissimoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdatePrestissimoEngineWithContext(ctx context.Context, updatePrestissimoEngineOptions *UpdatePrestissimoEngineOptions) (result *PrestissimoEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePrestissimoEngineOptions, "updatePrestissimoEngineOptions cannot be nil") +// ScalePrestissimoEngineWithContext is an alternate form of the ScalePrestissimoEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ScalePrestissimoEngineWithContext(ctx context.Context, scalePrestissimoEngineOptions *ScalePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(scalePrestissimoEngineOptions, "scalePrestissimoEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updatePrestissimoEngineOptions, "updatePrestissimoEngineOptions") + err = core.ValidateStruct(scalePrestissimoEngineOptions, "scalePrestissimoEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *updatePrestissimoEngineOptions.EngineID, + "id": *scalePrestissimoEngineOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/prestissimo_engines/{id}/scale`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updatePrestissimoEngineOptions.Headers { + for headerName, headerValue := range scalePrestissimoEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdatePrestissimoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ScalePrestissimoEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updatePrestissimoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updatePrestissimoEngineOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if scalePrestissimoEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*scalePrestissimoEngineOptions.AuthInstanceID)) } - _, err = builder.SetBodyContentJSON(updatePrestissimoEngineOptions.Body) + body := make(map[string]interface{}) + if scalePrestissimoEngineOptions.Coordinator != nil { + body["coordinator"] = scalePrestissimoEngineOptions.Coordinator + } + if scalePrestissimoEngineOptions.Worker != nil { + body["worker"] = scalePrestissimoEngineOptions.Worker + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -3706,12 +3911,12 @@ func (watsonxData *WatsonxDataV2) UpdatePrestissimoEngineWithContext(ctx context var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_prestissimo_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "scale_prestissimo_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestissimoEngine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3722,51 +3927,42 @@ func (watsonxData *WatsonxDataV2) UpdatePrestissimoEngineWithContext(ctx context return } -// ListPrestissimoEngineCatalogs : Get prestissimo engine catalogs -// Get list of all catalogs attached a prestissimo engine. -func (watsonxData *WatsonxDataV2) ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptions *ListPrestissimoEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListPrestissimoEngineCatalogsWithContext(context.Background(), listPrestissimoEngineCatalogsOptions) +// ListDb2Engines : Get list of db2 engines +// Get list of all db2 engines. +func (watsonxData *WatsonxDataV3) ListDb2Engines(listDb2EnginesOptions *ListDb2EnginesOptions) (result *Db2EngineCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListDb2EnginesWithContext(context.Background(), listDb2EnginesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListPrestissimoEngineCatalogsWithContext is an alternate form of the ListPrestissimoEngineCatalogs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListPrestissimoEngineCatalogsWithContext(ctx context.Context, listPrestissimoEngineCatalogsOptions *ListPrestissimoEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listPrestissimoEngineCatalogsOptions, "listPrestissimoEngineCatalogsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listPrestissimoEngineCatalogsOptions, "listPrestissimoEngineCatalogsOptions") +// ListDb2EnginesWithContext is an alternate form of the ListDb2Engines method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListDb2EnginesWithContext(ctx context.Context, listDb2EnginesOptions *ListDb2EnginesOptions) (result *Db2EngineCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDb2EnginesOptions, "listDb2EnginesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "engine_id": *listPrestissimoEngineCatalogsOptions.EngineID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}/catalogs`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/db2_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPrestissimoEngineCatalogsOptions.Headers { + for headerName, headerValue := range listDb2EnginesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListPrestissimoEngineCatalogs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListDb2Engines") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listPrestissimoEngineCatalogsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listPrestissimoEngineCatalogsOptions.AuthInstanceID)) + if listDb2EnginesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listDb2EnginesOptions.AuthInstanceID)) } request, err := builder.Build() @@ -3778,12 +3974,12 @@ func (watsonxData *WatsonxDataV2) ListPrestissimoEngineCatalogsWithContext(ctx c var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_prestissimo_engine_catalogs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_db2_engines", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDb2EngineCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3794,57 +3990,65 @@ func (watsonxData *WatsonxDataV2) ListPrestissimoEngineCatalogsWithContext(ctx c return } -// CreatePrestissimoEngineCatalogs : Associate catalogs to a prestissimo engine -// Associate one or more catalogs to a prestissimo engine. -func (watsonxData *WatsonxDataV2) CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptions *CreatePrestissimoEngineCatalogsOptions) (result *Catalog, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreatePrestissimoEngineCatalogsWithContext(context.Background(), createPrestissimoEngineCatalogsOptions) +// CreateDb2Engine : Create db2 engine +// Create a new db2 engine. +func (watsonxData *WatsonxDataV3) CreateDb2Engine(createDb2EngineOptions *CreateDb2EngineOptions) (result *Db2Engine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateDb2EngineWithContext(context.Background(), createDb2EngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreatePrestissimoEngineCatalogsWithContext is an alternate form of the CreatePrestissimoEngineCatalogs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreatePrestissimoEngineCatalogsWithContext(ctx context.Context, createPrestissimoEngineCatalogsOptions *CreatePrestissimoEngineCatalogsOptions) (result *Catalog, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPrestissimoEngineCatalogsOptions, "createPrestissimoEngineCatalogsOptions cannot be nil") +// CreateDb2EngineWithContext is an alternate form of the CreateDb2Engine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateDb2EngineWithContext(ctx context.Context, createDb2EngineOptions *CreateDb2EngineOptions) (result *Db2Engine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDb2EngineOptions, "createDb2EngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createPrestissimoEngineCatalogsOptions, "createPrestissimoEngineCatalogsOptions") + err = core.ValidateStruct(createDb2EngineOptions, "createDb2EngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "engine_id": *createPrestissimoEngineCatalogsOptions.EngineID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}/catalogs`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/db2_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createPrestissimoEngineCatalogsOptions.Headers { + for headerName, headerValue := range createDb2EngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreatePrestissimoEngineCatalogs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateDb2Engine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if createPrestissimoEngineCatalogsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createPrestissimoEngineCatalogsOptions.AuthInstanceID)) + if createDb2EngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createDb2EngineOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if createPrestissimoEngineCatalogsOptions.CatalogName != nil { - body["catalog_name"] = createPrestissimoEngineCatalogsOptions.CatalogName + if createDb2EngineOptions.Configuration != nil { + body["configuration"] = createDb2EngineOptions.Configuration + } + if createDb2EngineOptions.DisplayName != nil { + body["display_name"] = createDb2EngineOptions.DisplayName + } + if createDb2EngineOptions.Origin != nil { + body["origin"] = createDb2EngineOptions.Origin + } + if createDb2EngineOptions.Description != nil { + body["description"] = createDb2EngineOptions.Description + } + if createDb2EngineOptions.Tags != nil { + body["tags"] = createDb2EngineOptions.Tags } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -3861,12 +4065,12 @@ func (watsonxData *WatsonxDataV2) CreatePrestissimoEngineCatalogsWithContext(ctx var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_prestissimo_engine_catalogs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_db2_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDb2Engine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -3877,54 +4081,52 @@ func (watsonxData *WatsonxDataV2) CreatePrestissimoEngineCatalogsWithContext(ctx return } -// DeletePrestissimoEngineCatalogs : Disassociate catalogs from a prestissimo engine -// Disassociate one or more catalogs from a prestissimo engine. -func (watsonxData *WatsonxDataV2) DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptions *DeletePrestissimoEngineCatalogsOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeletePrestissimoEngineCatalogsWithContext(context.Background(), deletePrestissimoEngineCatalogsOptions) +// DeleteDb2Engine : Delete db2 engine +// Delete a db2 engine. +func (watsonxData *WatsonxDataV3) DeleteDb2Engine(deleteDb2EngineOptions *DeleteDb2EngineOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteDb2EngineWithContext(context.Background(), deleteDb2EngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeletePrestissimoEngineCatalogsWithContext is an alternate form of the DeletePrestissimoEngineCatalogs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeletePrestissimoEngineCatalogsWithContext(ctx context.Context, deletePrestissimoEngineCatalogsOptions *DeletePrestissimoEngineCatalogsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePrestissimoEngineCatalogsOptions, "deletePrestissimoEngineCatalogsOptions cannot be nil") +// DeleteDb2EngineWithContext is an alternate form of the DeleteDb2Engine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteDb2EngineWithContext(ctx context.Context, deleteDb2EngineOptions *DeleteDb2EngineOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDb2EngineOptions, "deleteDb2EngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deletePrestissimoEngineCatalogsOptions, "deletePrestissimoEngineCatalogsOptions") + err = core.ValidateStruct(deleteDb2EngineOptions, "deleteDb2EngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *deletePrestissimoEngineCatalogsOptions.EngineID, + "id": *deleteDb2EngineOptions.ID, } builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}/catalogs`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/db2_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deletePrestissimoEngineCatalogsOptions.Headers { + for headerName, headerValue := range deleteDb2EngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeletePrestissimoEngineCatalogs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteDb2Engine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deletePrestissimoEngineCatalogsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deletePrestissimoEngineCatalogsOptions.AuthInstanceID)) + if deleteDb2EngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteDb2EngineOptions.AuthInstanceID)) } - builder.AddQuery("catalog_names", fmt.Sprint(*deletePrestissimoEngineCatalogsOptions.CatalogNames)) - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -3933,7 +4135,7 @@ func (watsonxData *WatsonxDataV2) DeletePrestissimoEngineCatalogsWithContext(ctx response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_prestissimo_engine_catalogs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_db2_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -3941,52 +4143,58 @@ func (watsonxData *WatsonxDataV2) DeletePrestissimoEngineCatalogsWithContext(ctx return } -// GetPrestissimoEngineCatalog : Get prestissimo engine catalog -// Get catalog attached to a prestissimo engine. -func (watsonxData *WatsonxDataV2) GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptions *GetPrestissimoEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetPrestissimoEngineCatalogWithContext(context.Background(), getPrestissimoEngineCatalogOptions) +// UpdateDb2Engine : Update db2 engine +// Update details of db2 engine. +func (watsonxData *WatsonxDataV3) UpdateDb2Engine(updateDb2EngineOptions *UpdateDb2EngineOptions) (result *Db2Engine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateDb2EngineWithContext(context.Background(), updateDb2EngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetPrestissimoEngineCatalogWithContext is an alternate form of the GetPrestissimoEngineCatalog method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetPrestissimoEngineCatalogWithContext(ctx context.Context, getPrestissimoEngineCatalogOptions *GetPrestissimoEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPrestissimoEngineCatalogOptions, "getPrestissimoEngineCatalogOptions cannot be nil") +// UpdateDb2EngineWithContext is an alternate form of the UpdateDb2Engine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateDb2EngineWithContext(ctx context.Context, updateDb2EngineOptions *UpdateDb2EngineOptions) (result *Db2Engine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDb2EngineOptions, "updateDb2EngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getPrestissimoEngineCatalogOptions, "getPrestissimoEngineCatalogOptions") + err = core.ValidateStruct(updateDb2EngineOptions, "updateDb2EngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *getPrestissimoEngineCatalogOptions.EngineID, - "catalog_id": *getPrestissimoEngineCatalogOptions.CatalogID, + "id": *updateDb2EngineOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}/catalogs/{catalog_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/db2_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getPrestissimoEngineCatalogOptions.Headers { + for headerName, headerValue := range updateDb2EngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetPrestissimoEngineCatalog") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateDb2Engine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getPrestissimoEngineCatalogOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getPrestissimoEngineCatalogOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateDb2EngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateDb2EngineOptions.AuthInstanceID)) + } + + _, err = builder.SetBodyContentJSON(updateDb2EngineOptions.Body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -3998,12 +4206,12 @@ func (watsonxData *WatsonxDataV2) GetPrestissimoEngineCatalogWithContext(ctx con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_prestissimo_engine_catalog", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_db2_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDb2Engine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4014,51 +4222,42 @@ func (watsonxData *WatsonxDataV2) GetPrestissimoEngineCatalogWithContext(ctx con return } -// PausePrestissimoEngine : Pause prestissimo engine -// Pause a running prestissimo engine. -func (watsonxData *WatsonxDataV2) PausePrestissimoEngine(pausePrestissimoEngineOptions *PausePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.PausePrestissimoEngineWithContext(context.Background(), pausePrestissimoEngineOptions) +// ListOtherEngines : Get list of other engines +// Get list of other engines. +func (watsonxData *WatsonxDataV3) ListOtherEngines(listOtherEnginesOptions *ListOtherEnginesOptions) (result *OtherEngineCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListOtherEnginesWithContext(context.Background(), listOtherEnginesOptions) err = core.RepurposeSDKProblem(err, "") return } -// PausePrestissimoEngineWithContext is an alternate form of the PausePrestissimoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) PausePrestissimoEngineWithContext(ctx context.Context, pausePrestissimoEngineOptions *PausePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(pausePrestissimoEngineOptions, "pausePrestissimoEngineOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(pausePrestissimoEngineOptions, "pausePrestissimoEngineOptions") +// ListOtherEnginesWithContext is an alternate form of the ListOtherEngines method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListOtherEnginesWithContext(ctx context.Context, listOtherEnginesOptions *ListOtherEnginesOptions) (result *OtherEngineCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listOtherEnginesOptions, "listOtherEnginesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "engine_id": *pausePrestissimoEngineOptions.EngineID, - } - - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}/pause`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/other_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range pausePrestissimoEngineOptions.Headers { + for headerName, headerValue := range listOtherEnginesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "PausePrestissimoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListOtherEngines") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if pausePrestissimoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*pausePrestissimoEngineOptions.AuthInstanceID)) + if listOtherEnginesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listOtherEnginesOptions.AuthInstanceID)) } request, err := builder.Build() @@ -4070,12 +4269,12 @@ func (watsonxData *WatsonxDataV2) PausePrestissimoEngineWithContext(ctx context. var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "pause_prestissimo_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_other_engines", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOtherEngineCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4086,63 +4285,65 @@ func (watsonxData *WatsonxDataV2) PausePrestissimoEngineWithContext(ctx context. return } -// RunPrestissimoExplainStatement : Explain query -// Explain a query statement. -func (watsonxData *WatsonxDataV2) RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptions *RunPrestissimoExplainStatementOptions) (result *ResultPrestissimoExplainStatement, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.RunPrestissimoExplainStatementWithContext(context.Background(), runPrestissimoExplainStatementOptions) +// CreateOtherEngine : Create other engine +// Create a new engine. +func (watsonxData *WatsonxDataV3) CreateOtherEngine(createOtherEngineOptions *CreateOtherEngineOptions) (result *OtherEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateOtherEngineWithContext(context.Background(), createOtherEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// RunPrestissimoExplainStatementWithContext is an alternate form of the RunPrestissimoExplainStatement method which supports a Context parameter -func (watsonxData *WatsonxDataV2) RunPrestissimoExplainStatementWithContext(ctx context.Context, runPrestissimoExplainStatementOptions *RunPrestissimoExplainStatementOptions) (result *ResultPrestissimoExplainStatement, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(runPrestissimoExplainStatementOptions, "runPrestissimoExplainStatementOptions cannot be nil") +// CreateOtherEngineWithContext is an alternate form of the CreateOtherEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateOtherEngineWithContext(ctx context.Context, createOtherEngineOptions *CreateOtherEngineOptions) (result *OtherEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createOtherEngineOptions, "createOtherEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(runPrestissimoExplainStatementOptions, "runPrestissimoExplainStatementOptions") + err = core.ValidateStruct(createOtherEngineOptions, "createOtherEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "engine_id": *runPrestissimoExplainStatementOptions.EngineID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}/query_explain`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/other_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range runPrestissimoExplainStatementOptions.Headers { + for headerName, headerValue := range createOtherEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "RunPrestissimoExplainStatement") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateOtherEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if runPrestissimoExplainStatementOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*runPrestissimoExplainStatementOptions.AuthInstanceID)) + if createOtherEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createOtherEngineOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if runPrestissimoExplainStatementOptions.Statement != nil { - body["statement"] = runPrestissimoExplainStatementOptions.Statement + if createOtherEngineOptions.Configuration != nil { + body["configuration"] = createOtherEngineOptions.Configuration } - if runPrestissimoExplainStatementOptions.Format != nil { - body["format"] = runPrestissimoExplainStatementOptions.Format + if createOtherEngineOptions.DisplayName != nil { + body["display_name"] = createOtherEngineOptions.DisplayName } - if runPrestissimoExplainStatementOptions.Type != nil { - body["type"] = runPrestissimoExplainStatementOptions.Type + if createOtherEngineOptions.Origin != nil { + body["origin"] = createOtherEngineOptions.Origin + } + if createOtherEngineOptions.Description != nil { + body["description"] = createOtherEngineOptions.Description + } + if createOtherEngineOptions.Tags != nil { + body["tags"] = createOtherEngineOptions.Tags } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -4159,12 +4360,12 @@ func (watsonxData *WatsonxDataV2) RunPrestissimoExplainStatementWithContext(ctx var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "run_prestissimo_explain_statement", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_other_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResultPrestissimoExplainStatement) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOtherEngine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4175,65 +4376,50 @@ func (watsonxData *WatsonxDataV2) RunPrestissimoExplainStatementWithContext(ctx return } -// RunPrestissimoExplainAnalyzeStatement : Explain analyze -// Return query metrics after query is complete. -func (watsonxData *WatsonxDataV2) RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptions *RunPrestissimoExplainAnalyzeStatementOptions) (result *ResultRunPrestissimoExplainAnalyzeStatement, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.RunPrestissimoExplainAnalyzeStatementWithContext(context.Background(), runPrestissimoExplainAnalyzeStatementOptions) +// DeleteOtherEngine : Delete engine +// Delete an engine from lakehouse. +func (watsonxData *WatsonxDataV3) DeleteOtherEngine(deleteOtherEngineOptions *DeleteOtherEngineOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteOtherEngineWithContext(context.Background(), deleteOtherEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// RunPrestissimoExplainAnalyzeStatementWithContext is an alternate form of the RunPrestissimoExplainAnalyzeStatement method which supports a Context parameter -func (watsonxData *WatsonxDataV2) RunPrestissimoExplainAnalyzeStatementWithContext(ctx context.Context, runPrestissimoExplainAnalyzeStatementOptions *RunPrestissimoExplainAnalyzeStatementOptions) (result *ResultRunPrestissimoExplainAnalyzeStatement, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(runPrestissimoExplainAnalyzeStatementOptions, "runPrestissimoExplainAnalyzeStatementOptions cannot be nil") +// DeleteOtherEngineWithContext is an alternate form of the DeleteOtherEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteOtherEngineWithContext(ctx context.Context, deleteOtherEngineOptions *DeleteOtherEngineOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteOtherEngineOptions, "deleteOtherEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(runPrestissimoExplainAnalyzeStatementOptions, "runPrestissimoExplainAnalyzeStatementOptions") + err = core.ValidateStruct(deleteOtherEngineOptions, "deleteOtherEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *runPrestissimoExplainAnalyzeStatementOptions.EngineID, + "id": *deleteOtherEngineOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}/query_explain_analyze`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/other_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range runPrestissimoExplainAnalyzeStatementOptions.Headers { + for headerName, headerValue := range deleteOtherEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "RunPrestissimoExplainAnalyzeStatement") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteOtherEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if runPrestissimoExplainAnalyzeStatementOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*runPrestissimoExplainAnalyzeStatementOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if runPrestissimoExplainAnalyzeStatementOptions.Statement != nil { - body["statement"] = runPrestissimoExplainAnalyzeStatementOptions.Statement - } - if runPrestissimoExplainAnalyzeStatementOptions.Verbose != nil { - body["verbose"] = runPrestissimoExplainAnalyzeStatementOptions.Verbose - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if deleteOtherEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteOtherEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -4242,70 +4428,52 @@ func (watsonxData *WatsonxDataV2) RunPrestissimoExplainAnalyzeStatementWithConte return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "run_prestissimo_explain_analyze_statement", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_other_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResultRunPrestissimoExplainAnalyzeStatement) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// RestartPrestissimoEngine : Restart a prestissimo engine -// Restart an existing prestissimo engine. -func (watsonxData *WatsonxDataV2) RestartPrestissimoEngine(restartPrestissimoEngineOptions *RestartPrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.RestartPrestissimoEngineWithContext(context.Background(), restartPrestissimoEngineOptions) +// ListNetezzaEngines : Get list of Netezza engines +// Get list of all netezza engines. +func (watsonxData *WatsonxDataV3) ListNetezzaEngines(listNetezzaEnginesOptions *ListNetezzaEnginesOptions) (result *NetezzaEngineCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListNetezzaEnginesWithContext(context.Background(), listNetezzaEnginesOptions) err = core.RepurposeSDKProblem(err, "") return } -// RestartPrestissimoEngineWithContext is an alternate form of the RestartPrestissimoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) RestartPrestissimoEngineWithContext(ctx context.Context, restartPrestissimoEngineOptions *RestartPrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(restartPrestissimoEngineOptions, "restartPrestissimoEngineOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(restartPrestissimoEngineOptions, "restartPrestissimoEngineOptions") +// ListNetezzaEnginesWithContext is an alternate form of the ListNetezzaEngines method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListNetezzaEnginesWithContext(ctx context.Context, listNetezzaEnginesOptions *ListNetezzaEnginesOptions) (result *NetezzaEngineCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listNetezzaEnginesOptions, "listNetezzaEnginesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "engine_id": *restartPrestissimoEngineOptions.EngineID, - } - - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}/restart`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/netezza_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range restartPrestissimoEngineOptions.Headers { + for headerName, headerValue := range listNetezzaEnginesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "RestartPrestissimoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListNetezzaEngines") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if restartPrestissimoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*restartPrestissimoEngineOptions.AuthInstanceID)) + if listNetezzaEnginesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listNetezzaEnginesOptions.AuthInstanceID)) } request, err := builder.Build() @@ -4317,12 +4485,12 @@ func (watsonxData *WatsonxDataV2) RestartPrestissimoEngineWithContext(ctx contex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "restart_prestissimo_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_netezza_engines", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetezzaEngineCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4333,51 +4501,70 @@ func (watsonxData *WatsonxDataV2) RestartPrestissimoEngineWithContext(ctx contex return } -// ResumePrestissimoEngine : Resume prestissimo engine -// Resume a paused prestissimo engine. -func (watsonxData *WatsonxDataV2) ResumePrestissimoEngine(resumePrestissimoEngineOptions *ResumePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ResumePrestissimoEngineWithContext(context.Background(), resumePrestissimoEngineOptions) +// CreateNetezzaEngine : Create netezza engine +// Create a new netezza engine. +func (watsonxData *WatsonxDataV3) CreateNetezzaEngine(createNetezzaEngineOptions *CreateNetezzaEngineOptions) (result *NetezzaEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateNetezzaEngineWithContext(context.Background(), createNetezzaEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// ResumePrestissimoEngineWithContext is an alternate form of the ResumePrestissimoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ResumePrestissimoEngineWithContext(ctx context.Context, resumePrestissimoEngineOptions *ResumePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(resumePrestissimoEngineOptions, "resumePrestissimoEngineOptions cannot be nil") +// CreateNetezzaEngineWithContext is an alternate form of the CreateNetezzaEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateNetezzaEngineWithContext(ctx context.Context, createNetezzaEngineOptions *CreateNetezzaEngineOptions) (result *NetezzaEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createNetezzaEngineOptions, "createNetezzaEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(resumePrestissimoEngineOptions, "resumePrestissimoEngineOptions") + err = core.ValidateStruct(createNetezzaEngineOptions, "createNetezzaEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "engine_id": *resumePrestissimoEngineOptions.EngineID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}/resume`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/netezza_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range resumePrestissimoEngineOptions.Headers { + for headerName, headerValue := range createNetezzaEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ResumePrestissimoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateNetezzaEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if resumePrestissimoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*resumePrestissimoEngineOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if createNetezzaEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createNetezzaEngineOptions.AuthInstanceID)) + } + + body := make(map[string]interface{}) + if createNetezzaEngineOptions.Configuration != nil { + body["configuration"] = createNetezzaEngineOptions.Configuration + } + if createNetezzaEngineOptions.DisplayName != nil { + body["display_name"] = createNetezzaEngineOptions.DisplayName + } + if createNetezzaEngineOptions.Origin != nil { + body["origin"] = createNetezzaEngineOptions.Origin + } + if createNetezzaEngineOptions.Description != nil { + body["description"] = createNetezzaEngineOptions.Description + } + if createNetezzaEngineOptions.Tags != nil { + body["tags"] = createNetezzaEngineOptions.Tags + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -4389,12 +4576,12 @@ func (watsonxData *WatsonxDataV2) ResumePrestissimoEngineWithContext(ctx context var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "resume_prestissimo_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_netezza_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetezzaEngine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4405,62 +4592,117 @@ func (watsonxData *WatsonxDataV2) ResumePrestissimoEngineWithContext(ctx context return } -// ScalePrestissimoEngine : Scale a prestissimo engine -// Scale an existing prestissimo engine. -func (watsonxData *WatsonxDataV2) ScalePrestissimoEngine(scalePrestissimoEngineOptions *ScalePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ScalePrestissimoEngineWithContext(context.Background(), scalePrestissimoEngineOptions) +// DeleteNetezzaEngine : Delete netezza engine +// Delete a netezza engine. +func (watsonxData *WatsonxDataV3) DeleteNetezzaEngine(deleteNetezzaEngineOptions *DeleteNetezzaEngineOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteNetezzaEngineWithContext(context.Background(), deleteNetezzaEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// ScalePrestissimoEngineWithContext is an alternate form of the ScalePrestissimoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ScalePrestissimoEngineWithContext(ctx context.Context, scalePrestissimoEngineOptions *ScalePrestissimoEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(scalePrestissimoEngineOptions, "scalePrestissimoEngineOptions cannot be nil") +// DeleteNetezzaEngineWithContext is an alternate form of the DeleteNetezzaEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteNetezzaEngineWithContext(ctx context.Context, deleteNetezzaEngineOptions *DeleteNetezzaEngineOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteNetezzaEngineOptions, "deleteNetezzaEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(scalePrestissimoEngineOptions, "scalePrestissimoEngineOptions") + err = core.ValidateStruct(deleteNetezzaEngineOptions, "deleteNetezzaEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *scalePrestissimoEngineOptions.EngineID, + "id": *deleteNetezzaEngineOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/prestissimo_engines/{engine_id}/scale`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/netezza_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range scalePrestissimoEngineOptions.Headers { + for headerName, headerValue := range deleteNetezzaEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ScalePrestissimoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteNetezzaEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if scalePrestissimoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*scalePrestissimoEngineOptions.AuthInstanceID)) + if deleteNetezzaEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteNetezzaEngineOptions.AuthInstanceID)) } - body := make(map[string]interface{}) - if scalePrestissimoEngineOptions.Coordinator != nil { - body["coordinator"] = scalePrestissimoEngineOptions.Coordinator + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if scalePrestissimoEngineOptions.Worker != nil { - body["worker"] = scalePrestissimoEngineOptions.Worker + + response, err = watsonxData.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_netezza_engine", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return } - _, err = builder.SetBodyContentJSON(body) + + return +} + +// UpdateNetezzaEngine : Update netezza engine +// Update details of netezza engine. +func (watsonxData *WatsonxDataV3) UpdateNetezzaEngine(updateNetezzaEngineOptions *UpdateNetezzaEngineOptions) (result *NetezzaEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateNetezzaEngineWithContext(context.Background(), updateNetezzaEngineOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// UpdateNetezzaEngineWithContext is an alternate form of the UpdateNetezzaEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateNetezzaEngineWithContext(ctx context.Context, updateNetezzaEngineOptions *UpdateNetezzaEngineOptions) (result *NetezzaEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateNetezzaEngineOptions, "updateNetezzaEngineOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(updateNetezzaEngineOptions, "updateNetezzaEngineOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + pathParamsMap := map[string]string{ + "id": *updateNetezzaEngineOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/netezza_engines/{id}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return + } + + for headerName, headerValue := range updateNetezzaEngineOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateNetezzaEngine") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateNetezzaEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateNetezzaEngineOptions.AuthInstanceID)) + } + + _, err = builder.SetBodyContentJSON(updateNetezzaEngineOptions.Body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -4475,12 +4717,12 @@ func (watsonxData *WatsonxDataV2) ScalePrestissimoEngineWithContext(ctx context. var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "scale_prestissimo_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_netezza_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetezzaEngine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4491,17 +4733,17 @@ func (watsonxData *WatsonxDataV2) ScalePrestissimoEngineWithContext(ctx context. return } -// ListPrestoEngines : Get list of presto engines -// Get list of all presto engines. -func (watsonxData *WatsonxDataV2) ListPrestoEngines(listPrestoEnginesOptions *ListPrestoEnginesOptions) (result *PrestoEngineCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListPrestoEnginesWithContext(context.Background(), listPrestoEnginesOptions) +// ListSparkEngines : Get list of spark engines +// Get list of spark engines. +func (watsonxData *WatsonxDataV3) ListSparkEngines(listSparkEnginesOptions *ListSparkEnginesOptions) (result *SparkEngineCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListSparkEnginesWithContext(context.Background(), listSparkEnginesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListPrestoEnginesWithContext is an alternate form of the ListPrestoEngines method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListPrestoEnginesWithContext(ctx context.Context, listPrestoEnginesOptions *ListPrestoEnginesOptions) (result *PrestoEngineCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listPrestoEnginesOptions, "listPrestoEnginesOptions") +// ListSparkEnginesWithContext is an alternate form of the ListSparkEngines method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListSparkEnginesWithContext(ctx context.Context, listSparkEnginesOptions *ListSparkEnginesOptions) (result *SparkEngineCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSparkEnginesOptions, "listSparkEnginesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -4510,23 +4752,23 @@ func (watsonxData *WatsonxDataV2) ListPrestoEnginesWithContext(ctx context.Conte builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPrestoEnginesOptions.Headers { + for headerName, headerValue := range listSparkEnginesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListPrestoEngines") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListSparkEngines") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listPrestoEnginesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listPrestoEnginesOptions.AuthInstanceID)) + if listSparkEnginesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSparkEnginesOptions.AuthInstanceID)) } request, err := builder.Build() @@ -4538,12 +4780,12 @@ func (watsonxData *WatsonxDataV2) ListPrestoEnginesWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_presto_engines", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_spark_engines", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngineCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngineCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4554,22 +4796,22 @@ func (watsonxData *WatsonxDataV2) ListPrestoEnginesWithContext(ctx context.Conte return } -// CreatePrestoEngine : Create presto engine -// Create a new presto engine. -func (watsonxData *WatsonxDataV2) CreatePrestoEngine(createPrestoEngineOptions *CreatePrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreatePrestoEngineWithContext(context.Background(), createPrestoEngineOptions) +// CreateSparkEngine : Create spark engine +// Create a new spark engine. +func (watsonxData *WatsonxDataV3) CreateSparkEngine(createSparkEngineOptions *CreateSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateSparkEngineWithContext(context.Background(), createSparkEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreatePrestoEngineWithContext is an alternate form of the CreatePrestoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreatePrestoEngineWithContext(ctx context.Context, createPrestoEngineOptions *CreatePrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPrestoEngineOptions, "createPrestoEngineOptions cannot be nil") +// CreateSparkEngineWithContext is an alternate form of the CreateSparkEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateSparkEngineWithContext(ctx context.Context, createSparkEngineOptions *CreateSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSparkEngineOptions, "createSparkEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createPrestoEngineOptions, "createPrestoEngineOptions") + err = core.ValidateStruct(createSparkEngineOptions, "createSparkEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -4578,50 +4820,53 @@ func (watsonxData *WatsonxDataV2) CreatePrestoEngineWithContext(ctx context.Cont builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createPrestoEngineOptions.Headers { + for headerName, headerValue := range createSparkEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreatePrestoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateSparkEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if createPrestoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createPrestoEngineOptions.AuthInstanceID)) + if createSparkEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSparkEngineOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if createPrestoEngineOptions.Origin != nil { - body["origin"] = createPrestoEngineOptions.Origin + if createSparkEngineOptions.DisplayName != nil { + body["display_name"] = createSparkEngineOptions.DisplayName } - if createPrestoEngineOptions.AssociatedCatalogs != nil { - body["associated_catalogs"] = createPrestoEngineOptions.AssociatedCatalogs + if createSparkEngineOptions.Origin != nil { + body["origin"] = createSparkEngineOptions.Origin } - if createPrestoEngineOptions.Description != nil { - body["description"] = createPrestoEngineOptions.Description + if createSparkEngineOptions.AssociatedCatalogs != nil { + body["associated_catalogs"] = createSparkEngineOptions.AssociatedCatalogs } - if createPrestoEngineOptions.EngineDetails != nil { - body["engine_details"] = createPrestoEngineOptions.EngineDetails + if createSparkEngineOptions.Configuration != nil { + body["configuration"] = createSparkEngineOptions.Configuration } - if createPrestoEngineOptions.EngineDisplayName != nil { - body["engine_display_name"] = createPrestoEngineOptions.EngineDisplayName + if createSparkEngineOptions.Description != nil { + body["description"] = createSparkEngineOptions.Description } - if createPrestoEngineOptions.Region != nil { - body["region"] = createPrestoEngineOptions.Region + if createSparkEngineOptions.ID != nil { + body["id"] = createSparkEngineOptions.ID } - if createPrestoEngineOptions.Tags != nil { - body["tags"] = createPrestoEngineOptions.Tags + if createSparkEngineOptions.Status != nil { + body["status"] = createSparkEngineOptions.Status + } + if createSparkEngineOptions.Tags != nil { + body["tags"] = createSparkEngineOptions.Tags } - if createPrestoEngineOptions.Version != nil { - body["version"] = createPrestoEngineOptions.Version + if createSparkEngineOptions.Type != nil { + body["type"] = createSparkEngineOptions.Type } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -4638,12 +4883,12 @@ func (watsonxData *WatsonxDataV2) CreatePrestoEngineWithContext(ctx context.Cont var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_presto_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_spark_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4654,51 +4899,52 @@ func (watsonxData *WatsonxDataV2) CreatePrestoEngineWithContext(ctx context.Cont return } -// GetPrestoEngine : Get presto engine -// Get details of one presto engine. -func (watsonxData *WatsonxDataV2) GetPrestoEngine(getPrestoEngineOptions *GetPrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetPrestoEngineWithContext(context.Background(), getPrestoEngineOptions) +// GetSparkEngineCatalog : Get spark engine catalog +// Get catalog attached to spark engine. +func (watsonxData *WatsonxDataV3) GetSparkEngineCatalog(getSparkEngineCatalogOptions *GetSparkEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetSparkEngineCatalogWithContext(context.Background(), getSparkEngineCatalogOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetPrestoEngineWithContext is an alternate form of the GetPrestoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetPrestoEngineWithContext(ctx context.Context, getPrestoEngineOptions *GetPrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPrestoEngineOptions, "getPrestoEngineOptions cannot be nil") +// GetSparkEngineCatalogWithContext is an alternate form of the GetSparkEngineCatalog method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSparkEngineCatalogWithContext(ctx context.Context, getSparkEngineCatalogOptions *GetSparkEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSparkEngineCatalogOptions, "getSparkEngineCatalogOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getPrestoEngineOptions, "getPrestoEngineOptions") + err = core.ValidateStruct(getSparkEngineCatalogOptions, "getSparkEngineCatalogOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *getPrestoEngineOptions.EngineID, + "engine_id": *getSparkEngineCatalogOptions.EngineID, + "id": *getSparkEngineCatalogOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{engine_id}/catalogs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getPrestoEngineOptions.Headers { + for headerName, headerValue := range getSparkEngineCatalogOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetPrestoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSparkEngineCatalog") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getPrestoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getPrestoEngineOptions.AuthInstanceID)) + if getSparkEngineCatalogOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSparkEngineCatalogOptions.AuthInstanceID)) } request, err := builder.Build() @@ -4710,12 +4956,12 @@ func (watsonxData *WatsonxDataV2) GetPrestoEngineWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_presto_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_spark_engine_catalog", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4726,50 +4972,51 @@ func (watsonxData *WatsonxDataV2) GetPrestoEngineWithContext(ctx context.Context return } -// DeleteEngine : Delete presto engine -// Delete a presto engine. -func (watsonxData *WatsonxDataV2) DeleteEngine(deleteEngineOptions *DeleteEngineOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteEngineWithContext(context.Background(), deleteEngineOptions) +// GetSparkEngine : Get spark engine +// Get spark engine by ID. +func (watsonxData *WatsonxDataV3) GetSparkEngine(getSparkEngineOptions *GetSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetSparkEngineWithContext(context.Background(), getSparkEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteEngineWithContext is an alternate form of the DeleteEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteEngineWithContext(ctx context.Context, deleteEngineOptions *DeleteEngineOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteEngineOptions, "deleteEngineOptions cannot be nil") +// GetSparkEngineWithContext is an alternate form of the GetSparkEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSparkEngineWithContext(ctx context.Context, getSparkEngineOptions *GetSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSparkEngineOptions, "getSparkEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteEngineOptions, "deleteEngineOptions") + err = core.ValidateStruct(getSparkEngineOptions, "getSparkEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *deleteEngineOptions.EngineID, + "id": *getSparkEngineOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteEngineOptions.Headers { + for headerName, headerValue := range getSparkEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSparkEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteEngineOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + if getSparkEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSparkEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -4778,68 +5025,69 @@ func (watsonxData *WatsonxDataV2) DeleteEngineWithContext(ctx context.Context, d return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_spark_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngine) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdatePrestoEngine : Update presto engine -// Update details of presto engine. -func (watsonxData *WatsonxDataV2) UpdatePrestoEngine(updatePrestoEngineOptions *UpdatePrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdatePrestoEngineWithContext(context.Background(), updatePrestoEngineOptions) +// DeleteSparkEngine : Delete spark engine +// Delete a spark engine. +func (watsonxData *WatsonxDataV3) DeleteSparkEngine(deleteSparkEngineOptions *DeleteSparkEngineOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteSparkEngineWithContext(context.Background(), deleteSparkEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdatePrestoEngineWithContext is an alternate form of the UpdatePrestoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdatePrestoEngineWithContext(ctx context.Context, updatePrestoEngineOptions *UpdatePrestoEngineOptions) (result *PrestoEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updatePrestoEngineOptions, "updatePrestoEngineOptions cannot be nil") +// DeleteSparkEngineWithContext is an alternate form of the DeleteSparkEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteSparkEngineWithContext(ctx context.Context, deleteSparkEngineOptions *DeleteSparkEngineOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSparkEngineOptions, "deleteSparkEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updatePrestoEngineOptions, "updatePrestoEngineOptions") + err = core.ValidateStruct(deleteSparkEngineOptions, "deleteSparkEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *updatePrestoEngineOptions.EngineID, + "id": *deleteSparkEngineOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updatePrestoEngineOptions.Headers { + for headerName, headerValue := range deleteSparkEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdatePrestoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteSparkEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updatePrestoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updatePrestoEngineOptions.AuthInstanceID)) - } - - _, err = builder.SetBodyContentJSON(updatePrestoEngineOptions.Body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if deleteSparkEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSparkEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -4848,70 +5096,68 @@ func (watsonxData *WatsonxDataV2) UpdatePrestoEngineWithContext(ctx context.Cont return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "update_presto_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_spark_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPrestoEngine) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListPrestoEngineCatalogs : Get presto engine catalogs -// Get list of all catalogs attached to a presto engine. -func (watsonxData *WatsonxDataV2) ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptions *ListPrestoEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListPrestoEngineCatalogsWithContext(context.Background(), listPrestoEngineCatalogsOptions) +// UpdateSparkEngine : Update spark engine +// Update details of spark engine. +func (watsonxData *WatsonxDataV3) UpdateSparkEngine(updateSparkEngineOptions *UpdateSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateSparkEngineWithContext(context.Background(), updateSparkEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListPrestoEngineCatalogsWithContext is an alternate form of the ListPrestoEngineCatalogs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListPrestoEngineCatalogsWithContext(ctx context.Context, listPrestoEngineCatalogsOptions *ListPrestoEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listPrestoEngineCatalogsOptions, "listPrestoEngineCatalogsOptions cannot be nil") +// UpdateSparkEngineWithContext is an alternate form of the UpdateSparkEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateSparkEngineWithContext(ctx context.Context, updateSparkEngineOptions *UpdateSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSparkEngineOptions, "updateSparkEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listPrestoEngineCatalogsOptions, "listPrestoEngineCatalogsOptions") + err = core.ValidateStruct(updateSparkEngineOptions, "updateSparkEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *listPrestoEngineCatalogsOptions.EngineID, + "id": *updateSparkEngineOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}/catalogs`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listPrestoEngineCatalogsOptions.Headers { + for headerName, headerValue := range updateSparkEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListPrestoEngineCatalogs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateSparkEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listPrestoEngineCatalogsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listPrestoEngineCatalogsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateSparkEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateSparkEngineOptions.AuthInstanceID)) + } + + _, err = builder.SetBodyContentJSON(updateSparkEngineOptions.Body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -4923,12 +5169,12 @@ func (watsonxData *WatsonxDataV2) ListPrestoEngineCatalogsWithContext(ctx contex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_presto_engine_catalogs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_spark_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngine) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -4939,62 +5185,51 @@ func (watsonxData *WatsonxDataV2) ListPrestoEngineCatalogsWithContext(ctx contex return } -// CreatePrestoEngineCatalogs : Associate catalogs to presto engine -// Associate one or more catalogs to a presto engine. -func (watsonxData *WatsonxDataV2) CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptions *CreatePrestoEngineCatalogsOptions) (result *Catalog, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreatePrestoEngineCatalogsWithContext(context.Background(), createPrestoEngineCatalogsOptions) +// ListSparkEngineCatalogs : Get spark engine catalogs +// Get list of all catalogs attached to a spark engine. +func (watsonxData *WatsonxDataV3) ListSparkEngineCatalogs(listSparkEngineCatalogsOptions *ListSparkEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListSparkEngineCatalogsWithContext(context.Background(), listSparkEngineCatalogsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreatePrestoEngineCatalogsWithContext is an alternate form of the CreatePrestoEngineCatalogs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreatePrestoEngineCatalogsWithContext(ctx context.Context, createPrestoEngineCatalogsOptions *CreatePrestoEngineCatalogsOptions) (result *Catalog, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPrestoEngineCatalogsOptions, "createPrestoEngineCatalogsOptions cannot be nil") +// ListSparkEngineCatalogsWithContext is an alternate form of the ListSparkEngineCatalogs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListSparkEngineCatalogsWithContext(ctx context.Context, listSparkEngineCatalogsOptions *ListSparkEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSparkEngineCatalogsOptions, "listSparkEngineCatalogsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createPrestoEngineCatalogsOptions, "createPrestoEngineCatalogsOptions") + err = core.ValidateStruct(listSparkEngineCatalogsOptions, "listSparkEngineCatalogsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *createPrestoEngineCatalogsOptions.EngineID, + "id": *listSparkEngineCatalogsOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}/catalogs`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/catalogs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createPrestoEngineCatalogsOptions.Headers { + for headerName, headerValue := range listSparkEngineCatalogsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreatePrestoEngineCatalogs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListSparkEngineCatalogs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createPrestoEngineCatalogsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createPrestoEngineCatalogsOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if createPrestoEngineCatalogsOptions.CatalogName != nil { - body["catalog_name"] = createPrestoEngineCatalogsOptions.CatalogName - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listSparkEngineCatalogsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSparkEngineCatalogsOptions.AuthInstanceID)) } request, err := builder.Build() @@ -5006,12 +5241,12 @@ func (watsonxData *WatsonxDataV2) CreatePrestoEngineCatalogsWithContext(ctx cont var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_presto_engine_catalogs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_spark_engine_catalogs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5022,53 +5257,63 @@ func (watsonxData *WatsonxDataV2) CreatePrestoEngineCatalogsWithContext(ctx cont return } -// DeletePrestoEngineCatalogs : Disassociate catalogs from a presto engine -// Disassociate one or more catalogs from a presto engine. -func (watsonxData *WatsonxDataV2) DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptions *DeletePrestoEngineCatalogsOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeletePrestoEngineCatalogsWithContext(context.Background(), deletePrestoEngineCatalogsOptions) +// CreateSparkEngineCatalogs : Associate catalogs to spark engine +// Associate one or more catalogs to a spark engine. +func (watsonxData *WatsonxDataV3) CreateSparkEngineCatalogs(createSparkEngineCatalogsOptions *CreateSparkEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateSparkEngineCatalogsWithContext(context.Background(), createSparkEngineCatalogsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeletePrestoEngineCatalogsWithContext is an alternate form of the DeletePrestoEngineCatalogs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeletePrestoEngineCatalogsWithContext(ctx context.Context, deletePrestoEngineCatalogsOptions *DeletePrestoEngineCatalogsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deletePrestoEngineCatalogsOptions, "deletePrestoEngineCatalogsOptions cannot be nil") +// CreateSparkEngineCatalogsWithContext is an alternate form of the CreateSparkEngineCatalogs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateSparkEngineCatalogsWithContext(ctx context.Context, createSparkEngineCatalogsOptions *CreateSparkEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSparkEngineCatalogsOptions, "createSparkEngineCatalogsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deletePrestoEngineCatalogsOptions, "deletePrestoEngineCatalogsOptions") + err = core.ValidateStruct(createSparkEngineCatalogsOptions, "createSparkEngineCatalogsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *deletePrestoEngineCatalogsOptions.EngineID, + "id": *createSparkEngineCatalogsOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}/catalogs`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/catalogs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deletePrestoEngineCatalogsOptions.Headers { + for headerName, headerValue := range createSparkEngineCatalogsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeletePrestoEngineCatalogs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateSparkEngineCatalogs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deletePrestoEngineCatalogsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deletePrestoEngineCatalogsOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if createSparkEngineCatalogsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSparkEngineCatalogsOptions.AuthInstanceID)) } - builder.AddQuery("catalog_names", fmt.Sprint(*deletePrestoEngineCatalogsOptions.CatalogNames)) + body := make(map[string]interface{}) + if createSparkEngineCatalogsOptions.CatalogNames != nil { + body["catalog_names"] = createSparkEngineCatalogsOptions.CatalogNames + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } request, err := builder.Build() if err != nil { @@ -5076,134 +5321,145 @@ func (watsonxData *WatsonxDataV2) DeletePrestoEngineCatalogsWithContext(ctx cont return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_presto_engine_catalogs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_spark_engine_catalogs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetPrestoEngineCatalog : Get presto engine catalog -// Get catalog attached to presto engine. -func (watsonxData *WatsonxDataV2) GetPrestoEngineCatalog(getPrestoEngineCatalogOptions *GetPrestoEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetPrestoEngineCatalogWithContext(context.Background(), getPrestoEngineCatalogOptions) +// DeleteSparkEngineCatalogs : Disassociate catalogs from a spark engine +// Disassociate one or more catalogs from a spark engine. +func (watsonxData *WatsonxDataV3) DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptions *DeleteSparkEngineCatalogsOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteSparkEngineCatalogsWithContext(context.Background(), deleteSparkEngineCatalogsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetPrestoEngineCatalogWithContext is an alternate form of the GetPrestoEngineCatalog method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetPrestoEngineCatalogWithContext(ctx context.Context, getPrestoEngineCatalogOptions *GetPrestoEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getPrestoEngineCatalogOptions, "getPrestoEngineCatalogOptions cannot be nil") +// DeleteSparkEngineCatalogsWithContext is an alternate form of the DeleteSparkEngineCatalogs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteSparkEngineCatalogsWithContext(ctx context.Context, deleteSparkEngineCatalogsOptions *DeleteSparkEngineCatalogsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSparkEngineCatalogsOptions, "deleteSparkEngineCatalogsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getPrestoEngineCatalogOptions, "getPrestoEngineCatalogOptions") + err = core.ValidateStruct(deleteSparkEngineCatalogsOptions, "deleteSparkEngineCatalogsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *getPrestoEngineCatalogOptions.EngineID, - "catalog_id": *getPrestoEngineCatalogOptions.CatalogID, + "id": *deleteSparkEngineCatalogsOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}/catalogs/{catalog_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/catalogs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getPrestoEngineCatalogOptions.Headers { + for headerName, headerValue := range deleteSparkEngineCatalogsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetPrestoEngineCatalog") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteSparkEngineCatalogs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if getPrestoEngineCatalogOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getPrestoEngineCatalogOptions.AuthInstanceID)) + if deleteSparkEngineCatalogsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSparkEngineCatalogsOptions.AuthInstanceID)) } + builder.AddQuery("catalog_names", fmt.Sprint(*deleteSparkEngineCatalogsOptions.CatalogNames)) + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_presto_engine_catalog", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_spark_engine_catalogs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// PausePrestoEngine : Pause presto engine -// Pause a running presto engine. -func (watsonxData *WatsonxDataV2) PausePrestoEngine(pausePrestoEngineOptions *PausePrestoEngineOptions) (result *CreateEnginePauseCreatedBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.PausePrestoEngineWithContext(context.Background(), pausePrestoEngineOptions) +// PauseSparkEngine : Pause engine +// Pause engine. this feature is only available in SAAS. +func (watsonxData *WatsonxDataV3) PauseSparkEngine(pauseSparkEngineOptions *PauseSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.PauseSparkEngineWithContext(context.Background(), pauseSparkEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// PausePrestoEngineWithContext is an alternate form of the PausePrestoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) PausePrestoEngineWithContext(ctx context.Context, pausePrestoEngineOptions *PausePrestoEngineOptions) (result *CreateEnginePauseCreatedBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(pausePrestoEngineOptions, "pausePrestoEngineOptions cannot be nil") +// PauseSparkEngineWithContext is an alternate form of the PauseSparkEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) PauseSparkEngineWithContext(ctx context.Context, pauseSparkEngineOptions *PauseSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(pauseSparkEngineOptions, "pauseSparkEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(pausePrestoEngineOptions, "pausePrestoEngineOptions") + err = core.ValidateStruct(pauseSparkEngineOptions, "pauseSparkEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *pausePrestoEngineOptions.EngineID, + "id": *pauseSparkEngineOptions.ID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}/pause`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/pause`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range pausePrestoEngineOptions.Headers { + for headerName, headerValue := range pauseSparkEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "PausePrestoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "PauseSparkEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if pausePrestoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*pausePrestoEngineOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if pauseSparkEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*pauseSparkEngineOptions.AuthInstanceID)) + } + + body := make(map[string]interface{}) + if pauseSparkEngineOptions.Force != nil { + body["force"] = pauseSparkEngineOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -5215,12 +5471,12 @@ func (watsonxData *WatsonxDataV2) PausePrestoEngineWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "pause_presto_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "pause_spark_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCreateEnginePauseCreatedBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5231,68 +5487,51 @@ func (watsonxData *WatsonxDataV2) PausePrestoEngineWithContext(ctx context.Conte return } -// RunExplainStatement : Explain presto query -// Explain a query statement. -func (watsonxData *WatsonxDataV2) RunExplainStatement(runExplainStatementOptions *RunExplainStatementOptions) (result *RunExplainStatementOKBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.RunExplainStatementWithContext(context.Background(), runExplainStatementOptions) +// ResumeSparkEngine : Resume engine. This feature is only available in SAAS +// Resume engine. This feature is only available in SAAS. +func (watsonxData *WatsonxDataV3) ResumeSparkEngine(resumeSparkEngineOptions *ResumeSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ResumeSparkEngineWithContext(context.Background(), resumeSparkEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// RunExplainStatementWithContext is an alternate form of the RunExplainStatement method which supports a Context parameter -func (watsonxData *WatsonxDataV2) RunExplainStatementWithContext(ctx context.Context, runExplainStatementOptions *RunExplainStatementOptions) (result *RunExplainStatementOKBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(runExplainStatementOptions, "runExplainStatementOptions cannot be nil") +// ResumeSparkEngineWithContext is an alternate form of the ResumeSparkEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ResumeSparkEngineWithContext(ctx context.Context, resumeSparkEngineOptions *ResumeSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(resumeSparkEngineOptions, "resumeSparkEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(runExplainStatementOptions, "runExplainStatementOptions") + err = core.ValidateStruct(resumeSparkEngineOptions, "resumeSparkEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *runExplainStatementOptions.EngineID, + "id": *resumeSparkEngineOptions.ID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}/query_explain`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/resume`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range runExplainStatementOptions.Headers { + for headerName, headerValue := range resumeSparkEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "RunExplainStatement") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ResumeSparkEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if runExplainStatementOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*runExplainStatementOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if runExplainStatementOptions.Statement != nil { - body["statement"] = runExplainStatementOptions.Statement - } - if runExplainStatementOptions.Format != nil { - body["format"] = runExplainStatementOptions.Format - } - if runExplainStatementOptions.Type != nil { - body["type"] = runExplainStatementOptions.Type - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if resumeSparkEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*resumeSparkEngineOptions.AuthInstanceID)) } request, err := builder.Build() @@ -5304,12 +5543,12 @@ func (watsonxData *WatsonxDataV2) RunExplainStatementWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "run_explain_statement", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "resume_spark_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRunExplainStatementOKBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5320,60 +5559,57 @@ func (watsonxData *WatsonxDataV2) RunExplainStatementWithContext(ctx context.Con return } -// RunExplainAnalyzeStatement : Explain presto analyze -// Return query metrics after query is complete. -func (watsonxData *WatsonxDataV2) RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptions *RunExplainAnalyzeStatementOptions) (result *RunExplainAnalyzeStatementOKBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.RunExplainAnalyzeStatementWithContext(context.Background(), runExplainAnalyzeStatementOptions) +// ScaleSparkEngine : Scale engine. This feature is only available in SAAS +// Scale engine. This feature is only available in SAAS. +func (watsonxData *WatsonxDataV3) ScaleSparkEngine(scaleSparkEngineOptions *ScaleSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ScaleSparkEngineWithContext(context.Background(), scaleSparkEngineOptions) err = core.RepurposeSDKProblem(err, "") return } -// RunExplainAnalyzeStatementWithContext is an alternate form of the RunExplainAnalyzeStatement method which supports a Context parameter -func (watsonxData *WatsonxDataV2) RunExplainAnalyzeStatementWithContext(ctx context.Context, runExplainAnalyzeStatementOptions *RunExplainAnalyzeStatementOptions) (result *RunExplainAnalyzeStatementOKBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(runExplainAnalyzeStatementOptions, "runExplainAnalyzeStatementOptions cannot be nil") +// ScaleSparkEngineWithContext is an alternate form of the ScaleSparkEngine method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ScaleSparkEngineWithContext(ctx context.Context, scaleSparkEngineOptions *ScaleSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(scaleSparkEngineOptions, "scaleSparkEngineOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(runExplainAnalyzeStatementOptions, "runExplainAnalyzeStatementOptions") + err = core.ValidateStruct(scaleSparkEngineOptions, "scaleSparkEngineOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *runExplainAnalyzeStatementOptions.EngineID, + "id": *scaleSparkEngineOptions.ID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}/query_explain_analyze`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/scale`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range runExplainAnalyzeStatementOptions.Headers { + for headerName, headerValue := range scaleSparkEngineOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "RunExplainAnalyzeStatement") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ScaleSparkEngine") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if runExplainAnalyzeStatementOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*runExplainAnalyzeStatementOptions.AuthInstanceID)) + if scaleSparkEngineOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*scaleSparkEngineOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if runExplainAnalyzeStatementOptions.Statement != nil { - body["statement"] = runExplainAnalyzeStatementOptions.Statement - } - if runExplainAnalyzeStatementOptions.Verbose != nil { - body["verbose"] = runExplainAnalyzeStatementOptions.Verbose + if scaleSparkEngineOptions.NumberOfNodes != nil { + body["number_of_nodes"] = scaleSparkEngineOptions.NumberOfNodes } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -5390,12 +5626,12 @@ func (watsonxData *WatsonxDataV2) RunExplainAnalyzeStatementWithContext(ctx cont var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "run_explain_analyze_statement", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "scale_spark_engine", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRunExplainAnalyzeStatementOKBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5406,51 +5642,52 @@ func (watsonxData *WatsonxDataV2) RunExplainAnalyzeStatementWithContext(ctx cont return } -// RestartPrestoEngine : Restart a presto engine -// Restart an existing presto engine. -func (watsonxData *WatsonxDataV2) RestartPrestoEngine(restartPrestoEngineOptions *RestartPrestoEngineOptions) (result *CreateEngineRestartCreatedBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.RestartPrestoEngineWithContext(context.Background(), restartPrestoEngineOptions) +// GetSparkEngineApplicationStatus : Get spark engine application details +// Get spark engine application details. +func (watsonxData *WatsonxDataV3) GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptions *GetSparkEngineApplicationStatusOptions) (result *SparkEngineApplicationResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetSparkEngineApplicationStatusWithContext(context.Background(), getSparkEngineApplicationStatusOptions) err = core.RepurposeSDKProblem(err, "") return } -// RestartPrestoEngineWithContext is an alternate form of the RestartPrestoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) RestartPrestoEngineWithContext(ctx context.Context, restartPrestoEngineOptions *RestartPrestoEngineOptions) (result *CreateEngineRestartCreatedBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(restartPrestoEngineOptions, "restartPrestoEngineOptions cannot be nil") +// GetSparkEngineApplicationStatusWithContext is an alternate form of the GetSparkEngineApplicationStatus method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSparkEngineApplicationStatusWithContext(ctx context.Context, getSparkEngineApplicationStatusOptions *GetSparkEngineApplicationStatusOptions) (result *SparkEngineApplicationResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSparkEngineApplicationStatusOptions, "getSparkEngineApplicationStatusOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(restartPrestoEngineOptions, "restartPrestoEngineOptions") + err = core.ValidateStruct(getSparkEngineApplicationStatusOptions, "getSparkEngineApplicationStatusOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *restartPrestoEngineOptions.EngineID, + "engine_id": *getSparkEngineApplicationStatusOptions.EngineID, + "id": *getSparkEngineApplicationStatusOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}/restart`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{engine_id}/applications/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range restartPrestoEngineOptions.Headers { + for headerName, headerValue := range getSparkEngineApplicationStatusOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "RestartPrestoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSparkEngineApplicationStatus") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if restartPrestoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*restartPrestoEngineOptions.AuthInstanceID)) + if getSparkEngineApplicationStatusOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSparkEngineApplicationStatusOptions.AuthInstanceID)) } request, err := builder.Build() @@ -5462,12 +5699,12 @@ func (watsonxData *WatsonxDataV2) RestartPrestoEngineWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "restart_presto_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_spark_engine_application_status", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCreateEngineRestartCreatedBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngineApplicationResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5478,51 +5715,51 @@ func (watsonxData *WatsonxDataV2) RestartPrestoEngineWithContext(ctx context.Con return } -// ResumePrestoEngine : Resume presto engine -// Resume a paused presto engine. -func (watsonxData *WatsonxDataV2) ResumePrestoEngine(resumePrestoEngineOptions *ResumePrestoEngineOptions) (result *CreateEngineResumeCreatedBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ResumePrestoEngineWithContext(context.Background(), resumePrestoEngineOptions) +// DeleteSparkEngineApplication : Stop Spark Applications +// Stop a running spark application. +func (watsonxData *WatsonxDataV3) DeleteSparkEngineApplication(deleteSparkEngineApplicationOptions *DeleteSparkEngineApplicationOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteSparkEngineApplicationWithContext(context.Background(), deleteSparkEngineApplicationOptions) err = core.RepurposeSDKProblem(err, "") return } -// ResumePrestoEngineWithContext is an alternate form of the ResumePrestoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ResumePrestoEngineWithContext(ctx context.Context, resumePrestoEngineOptions *ResumePrestoEngineOptions) (result *CreateEngineResumeCreatedBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(resumePrestoEngineOptions, "resumePrestoEngineOptions cannot be nil") +// DeleteSparkEngineApplicationWithContext is an alternate form of the DeleteSparkEngineApplication method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteSparkEngineApplicationWithContext(ctx context.Context, deleteSparkEngineApplicationOptions *DeleteSparkEngineApplicationOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSparkEngineApplicationOptions, "deleteSparkEngineApplicationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(resumePrestoEngineOptions, "resumePrestoEngineOptions") + err = core.ValidateStruct(deleteSparkEngineApplicationOptions, "deleteSparkEngineApplicationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *resumePrestoEngineOptions.EngineID, + "engine_id": *deleteSparkEngineApplicationOptions.EngineID, + "id": *deleteSparkEngineApplicationOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}/resume`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{engine_id}/applications/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range resumePrestoEngineOptions.Headers { + for headerName, headerValue := range deleteSparkEngineApplicationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ResumePrestoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteSparkEngineApplication") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if resumePrestoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*resumePrestoEngineOptions.AuthInstanceID)) + if deleteSparkEngineApplicationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSparkEngineApplicationOptions.AuthInstanceID)) } request, err := builder.Build() @@ -5531,84 +5768,61 @@ func (watsonxData *WatsonxDataV2) ResumePrestoEngineWithContext(ctx context.Cont return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "resume_presto_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_spark_engine_application", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCreateEngineResumeCreatedBody) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ScalePrestoEngine : Scale a presto engine -// Scale an existing presto engine. -func (watsonxData *WatsonxDataV2) ScalePrestoEngine(scalePrestoEngineOptions *ScalePrestoEngineOptions) (result *CreateEngineScaleCreatedBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ScalePrestoEngineWithContext(context.Background(), scalePrestoEngineOptions) +// GetSparkEngineApplicationUi : Redirect to spark UI +// Redirect to spark UI. +func (watsonxData *WatsonxDataV3) GetSparkEngineApplicationUi(getSparkEngineApplicationUiOptions *GetSparkEngineApplicationUiOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.GetSparkEngineApplicationUiWithContext(context.Background(), getSparkEngineApplicationUiOptions) err = core.RepurposeSDKProblem(err, "") return } -// ScalePrestoEngineWithContext is an alternate form of the ScalePrestoEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ScalePrestoEngineWithContext(ctx context.Context, scalePrestoEngineOptions *ScalePrestoEngineOptions) (result *CreateEngineScaleCreatedBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(scalePrestoEngineOptions, "scalePrestoEngineOptions cannot be nil") +// GetSparkEngineApplicationUiWithContext is an alternate form of the GetSparkEngineApplicationUi method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSparkEngineApplicationUiWithContext(ctx context.Context, getSparkEngineApplicationUiOptions *GetSparkEngineApplicationUiOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSparkEngineApplicationUiOptions, "getSparkEngineApplicationUiOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(scalePrestoEngineOptions, "scalePrestoEngineOptions") + err = core.ValidateStruct(getSparkEngineApplicationUiOptions, "getSparkEngineApplicationUiOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *scalePrestoEngineOptions.EngineID, + "engine_id": *getSparkEngineApplicationUiOptions.EngineID, + "id": *getSparkEngineApplicationUiOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/presto_engines/{engine_id}/scale`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{engine_id}/applications/{id}/ui`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range scalePrestoEngineOptions.Headers { + for headerName, headerValue := range getSparkEngineApplicationUiOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ScalePrestoEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSparkEngineApplicationUi") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if scalePrestoEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*scalePrestoEngineOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if scalePrestoEngineOptions.Coordinator != nil { - body["coordinator"] = scalePrestoEngineOptions.Coordinator - } - if scalePrestoEngineOptions.Worker != nil { - body["worker"] = scalePrestoEngineOptions.Worker - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if getSparkEngineApplicationUiOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSparkEngineApplicationUiOptions.AuthInstanceID)) } request, err := builder.Build() @@ -5617,61 +5831,80 @@ func (watsonxData *WatsonxDataV2) ScalePrestoEngineWithContext(ctx context.Conte return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "scale_presto_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_spark_engine_application_ui", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCreateEngineScaleCreatedBody) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetSalIntegration : Get SAL Integrations -// Get SAL Integration. -func (watsonxData *WatsonxDataV2) GetSalIntegration(getSalIntegrationOptions *GetSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSalIntegrationWithContext(context.Background(), getSalIntegrationOptions) +// ListSparkEngineApplications : List all applications in a spark engine +// List all applications in a spark engine. +func (watsonxData *WatsonxDataV3) ListSparkEngineApplications(listSparkEngineApplicationsOptions *ListSparkEngineApplicationsOptions) (result *SparkEngineApplicationCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListSparkEngineApplicationsWithContext(context.Background(), listSparkEngineApplicationsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSalIntegrationWithContext is an alternate form of the GetSalIntegration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSalIntegrationWithContext(ctx context.Context, getSalIntegrationOptions *GetSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getSalIntegrationOptions, "getSalIntegrationOptions") +// ListSparkEngineApplicationsWithContext is an alternate form of the ListSparkEngineApplications method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListSparkEngineApplicationsWithContext(ctx context.Context, listSparkEngineApplicationsOptions *ListSparkEngineApplicationsOptions) (result *SparkEngineApplicationCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSparkEngineApplicationsOptions, "listSparkEngineApplicationsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listSparkEngineApplicationsOptions, "listSparkEngineApplicationsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *listSparkEngineApplicationsOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/applications`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSalIntegrationOptions.Headers { + for headerName, headerValue := range listSparkEngineApplicationsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSalIntegration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListSparkEngineApplications") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSalIntegrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationOptions.AuthInstanceID)) + if listSparkEngineApplicationsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSparkEngineApplicationsOptions.AuthInstanceID)) + } + + if listSparkEngineApplicationsOptions.State != nil { + builder.AddQuery("state", strings.Join(listSparkEngineApplicationsOptions.State, ",")) + } + if listSparkEngineApplicationsOptions.SubmissionTimeInterval != nil { + builder.AddQuery("submission_time_interval", fmt.Sprint(*listSparkEngineApplicationsOptions.SubmissionTimeInterval)) + } + if listSparkEngineApplicationsOptions.StartTimeInterval != nil { + builder.AddQuery("start_time_interval", fmt.Sprint(*listSparkEngineApplicationsOptions.StartTimeInterval)) + } + if listSparkEngineApplicationsOptions.EndTimeInterval != nil { + builder.AddQuery("end_time_interval", fmt.Sprint(*listSparkEngineApplicationsOptions.EndTimeInterval)) + } + if listSparkEngineApplicationsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSparkEngineApplicationsOptions.Limit)) + } + if listSparkEngineApplicationsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSparkEngineApplicationsOptions.Start)) } request, err := builder.Build() @@ -5683,12 +5916,12 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_sal_integration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_spark_engine_applications", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngineApplicationCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5699,65 +5932,96 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationWithContext(ctx context.Conte return } -// CreateSalIntegration : Create sal integration with wxd -// Add or create a new sal integration. -func (watsonxData *WatsonxDataV2) CreateSalIntegration(createSalIntegrationOptions *CreateSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateSalIntegrationWithContext(context.Background(), createSalIntegrationOptions) +// CreateSparkEngineApplication : Create spark engine application +// Create spark engine application. +func (watsonxData *WatsonxDataV3) CreateSparkEngineApplication(createSparkEngineApplicationOptions *CreateSparkEngineApplicationOptions) (result *SparkEngineApplicationSummary, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateSparkEngineApplicationWithContext(context.Background(), createSparkEngineApplicationOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSalIntegrationWithContext is an alternate form of the CreateSalIntegration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateSalIntegrationWithContext(ctx context.Context, createSalIntegrationOptions *CreateSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSalIntegrationOptions, "createSalIntegrationOptions cannot be nil") +// CreateSparkEngineApplicationWithContext is an alternate form of the CreateSparkEngineApplication method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateSparkEngineApplicationWithContext(ctx context.Context, createSparkEngineApplicationOptions *CreateSparkEngineApplicationOptions) (result *SparkEngineApplicationSummary, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSparkEngineApplicationOptions, "createSparkEngineApplicationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSalIntegrationOptions, "createSalIntegrationOptions") + err = core.ValidateStruct(createSparkEngineApplicationOptions, "createSparkEngineApplicationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *createSparkEngineApplicationOptions.ID, + } + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/applications`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSalIntegrationOptions.Headers { + for headerName, headerValue := range createSparkEngineApplicationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateSalIntegration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateSparkEngineApplication") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if createSalIntegrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSalIntegrationOptions.AuthInstanceID)) + if createSparkEngineApplicationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSparkEngineApplicationOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if createSalIntegrationOptions.Apikey != nil { - body["apikey"] = createSalIntegrationOptions.Apikey + if createSparkEngineApplicationOptions.ApplicationDetails != nil { + body["application_details"] = createSparkEngineApplicationOptions.ApplicationDetails } - if createSalIntegrationOptions.EngineID != nil { - body["engine_id"] = createSalIntegrationOptions.EngineID + if createSparkEngineApplicationOptions.Callback != nil { + body["callback"] = createSparkEngineApplicationOptions.Callback } - if createSalIntegrationOptions.StorageResourceCrn != nil { - body["storage_resource_crn"] = createSalIntegrationOptions.StorageResourceCrn + if createSparkEngineApplicationOptions.ContextID != nil { + body["context_id"] = createSparkEngineApplicationOptions.ContextID } - if createSalIntegrationOptions.StorageType != nil { - body["storage_type"] = createSalIntegrationOptions.StorageType + if createSparkEngineApplicationOptions.ContextType != nil { + body["context_type"] = createSparkEngineApplicationOptions.ContextType } - if createSalIntegrationOptions.TrialPlan != nil { - body["trial_plan"] = createSalIntegrationOptions.TrialPlan + if createSparkEngineApplicationOptions.DeployMode != nil { + body["deploy_mode"] = createSparkEngineApplicationOptions.DeployMode + } + if createSparkEngineApplicationOptions.IdempotencyKey != nil { + body["idempotency_key"] = createSparkEngineApplicationOptions.IdempotencyKey + } + if createSparkEngineApplicationOptions.InitScripts != nil { + body["init_scripts"] = createSparkEngineApplicationOptions.InitScripts + } + if createSparkEngineApplicationOptions.JobEndpoint != nil { + body["job_endpoint"] = createSparkEngineApplicationOptions.JobEndpoint + } + if createSparkEngineApplicationOptions.MaxRetries != nil { + body["max_retries"] = createSparkEngineApplicationOptions.MaxRetries + } + if createSparkEngineApplicationOptions.MinRetryIntervalInSeconds != nil { + body["min_retry_interval_in_seconds"] = createSparkEngineApplicationOptions.MinRetryIntervalInSeconds + } + if createSparkEngineApplicationOptions.ServiceInstanceID != nil { + body["service_instance_id"] = createSparkEngineApplicationOptions.ServiceInstanceID + } + if createSparkEngineApplicationOptions.TimeoutInSeconds != nil { + body["timeout_in_seconds"] = createSparkEngineApplicationOptions.TimeoutInSeconds + } + if createSparkEngineApplicationOptions.Type != nil { + body["type"] = createSparkEngineApplicationOptions.Type + } + if createSparkEngineApplicationOptions.Volumes != nil { + body["volumes"] = createSparkEngineApplicationOptions.Volumes } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -5774,12 +6038,12 @@ func (watsonxData *WatsonxDataV2) CreateSalIntegrationWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_sal_integration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_spark_engine_application", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngineApplicationSummary) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5790,39 +6054,52 @@ func (watsonxData *WatsonxDataV2) CreateSalIntegrationWithContext(ctx context.Co return } -// DeleteSalIntegration : Delete sal-wxd integration -// Delete a sal-wxd integration. -func (watsonxData *WatsonxDataV2) DeleteSalIntegration(deleteSalIntegrationOptions *DeleteSalIntegrationOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteSalIntegrationWithContext(context.Background(), deleteSalIntegrationOptions) +// GetSparkEngineHistoryServer : Get Spark history server details +// Get Spark history server details. +func (watsonxData *WatsonxDataV3) GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptions *GetSparkEngineHistoryServerOptions) (result *SparkHistoryServer, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetSparkEngineHistoryServerWithContext(context.Background(), getSparkEngineHistoryServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSalIntegrationWithContext is an alternate form of the DeleteSalIntegration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteSalIntegrationWithContext(ctx context.Context, deleteSalIntegrationOptions *DeleteSalIntegrationOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateStruct(deleteSalIntegrationOptions, "deleteSalIntegrationOptions") +// GetSparkEngineHistoryServerWithContext is an alternate form of the GetSparkEngineHistoryServer method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSparkEngineHistoryServerWithContext(ctx context.Context, getSparkEngineHistoryServerOptions *GetSparkEngineHistoryServerOptions) (result *SparkHistoryServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSparkEngineHistoryServerOptions, "getSparkEngineHistoryServerOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getSparkEngineHistoryServerOptions, "getSparkEngineHistoryServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.DELETE) + pathParamsMap := map[string]string{ + "id": *getSparkEngineHistoryServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/history_server`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSalIntegrationOptions.Headers { + for headerName, headerValue := range getSparkEngineHistoryServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteSalIntegration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSparkEngineHistoryServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } + builder.AddHeader("Accept", "application/json") + if getSparkEngineHistoryServerOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSparkEngineHistoryServerOptions.AuthInstanceID)) + } request, err := builder.Build() if err != nil { @@ -5830,61 +6107,81 @@ func (watsonxData *WatsonxDataV2) DeleteSalIntegrationWithContext(ctx context.Co return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_sal_integration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_spark_engine_history_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkHistoryServer) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateSalIntegration : Update sal-wxd integration -// Update sal-wxd integration details. -func (watsonxData *WatsonxDataV2) UpdateSalIntegration(updateSalIntegrationOptions *UpdateSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateSalIntegrationWithContext(context.Background(), updateSalIntegrationOptions) +// StartSparkEngineHistoryServer : Start spark history server +// Start spark history server. +func (watsonxData *WatsonxDataV3) StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptions *StartSparkEngineHistoryServerOptions) (result *SparkHistoryServer, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.StartSparkEngineHistoryServerWithContext(context.Background(), startSparkEngineHistoryServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateSalIntegrationWithContext is an alternate form of the UpdateSalIntegration method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateSalIntegrationWithContext(ctx context.Context, updateSalIntegrationOptions *UpdateSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSalIntegrationOptions, "updateSalIntegrationOptions cannot be nil") +// StartSparkEngineHistoryServerWithContext is an alternate form of the StartSparkEngineHistoryServer method which supports a Context parameter +func (watsonxData *WatsonxDataV3) StartSparkEngineHistoryServerWithContext(ctx context.Context, startSparkEngineHistoryServerOptions *StartSparkEngineHistoryServerOptions) (result *SparkHistoryServer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(startSparkEngineHistoryServerOptions, "startSparkEngineHistoryServerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateSalIntegrationOptions, "updateSalIntegrationOptions") + err = core.ValidateStruct(startSparkEngineHistoryServerOptions, "startSparkEngineHistoryServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.PATCH) + pathParamsMap := map[string]string{ + "id": *startSparkEngineHistoryServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/history_server`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSalIntegrationOptions.Headers { + for headerName, headerValue := range startSparkEngineHistoryServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateSalIntegration") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "StartSparkEngineHistoryServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSalIntegrationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateSalIntegrationOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if startSparkEngineHistoryServerOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*startSparkEngineHistoryServerOptions.AuthInstanceID)) } - _, err = builder.SetBodyContentJSON(updateSalIntegrationOptions.Body) + body := make(map[string]interface{}) + if startSparkEngineHistoryServerOptions.Cores != nil { + body["cores"] = startSparkEngineHistoryServerOptions.Cores + } + if startSparkEngineHistoryServerOptions.Memory != nil { + body["memory"] = startSparkEngineHistoryServerOptions.Memory + } + _, err = builder.SetBodyContentJSON(body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -5899,12 +6196,12 @@ func (watsonxData *WatsonxDataV2) UpdateSalIntegrationWithContext(ctx context.Co var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_sal_integration", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "start_spark_engine_history_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegration) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkHistoryServer) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -5915,57 +6212,50 @@ func (watsonxData *WatsonxDataV2) UpdateSalIntegrationWithContext(ctx context.Co return } -// CreateSalIntegrationEnrichment : Trigger enrichment jobs on schemas and tables -// Trigger enrichment jobs on schemas and tables. -func (watsonxData *WatsonxDataV2) CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptions *CreateSalIntegrationEnrichmentOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.CreateSalIntegrationEnrichmentWithContext(context.Background(), createSalIntegrationEnrichmentOptions) +// DeleteSparkEngineHistoryServer : Stop spark history server +// Stop spark history server. +func (watsonxData *WatsonxDataV3) DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptions *DeleteSparkEngineHistoryServerOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteSparkEngineHistoryServerWithContext(context.Background(), deleteSparkEngineHistoryServerOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSalIntegrationEnrichmentWithContext is an alternate form of the CreateSalIntegrationEnrichment method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateSalIntegrationEnrichmentWithContext(ctx context.Context, createSalIntegrationEnrichmentOptions *CreateSalIntegrationEnrichmentOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSalIntegrationEnrichmentOptions, "createSalIntegrationEnrichmentOptions cannot be nil") +// DeleteSparkEngineHistoryServerWithContext is an alternate form of the DeleteSparkEngineHistoryServer method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteSparkEngineHistoryServerWithContext(ctx context.Context, deleteSparkEngineHistoryServerOptions *DeleteSparkEngineHistoryServerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSparkEngineHistoryServerOptions, "deleteSparkEngineHistoryServerOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSalIntegrationEnrichmentOptions, "createSalIntegrationEnrichmentOptions") + err = core.ValidateStruct(deleteSparkEngineHistoryServerOptions, "deleteSparkEngineHistoryServerOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *deleteSparkEngineHistoryServerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/enrichment`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/history_server`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSalIntegrationEnrichmentOptions.Headers { + for headerName, headerValue := range deleteSparkEngineHistoryServerOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateSalIntegrationEnrichment") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteSparkEngineHistoryServer") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Content-Type", "application/json") - if createSalIntegrationEnrichmentOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSalIntegrationEnrichmentOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if createSalIntegrationEnrichmentOptions.EnrichmentPrototype != nil { - body["enrichment_prototype"] = createSalIntegrationEnrichmentOptions.EnrichmentPrototype - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if deleteSparkEngineHistoryServerOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSparkEngineHistoryServerOptions.AuthInstanceID)) } request, err := builder.Build() @@ -5976,7 +6266,7 @@ func (watsonxData *WatsonxDataV2) CreateSalIntegrationEnrichmentWithContext(ctx response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_sal_integration_enrichment", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_spark_engine_history_server", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -5984,46 +6274,50 @@ func (watsonxData *WatsonxDataV2) CreateSalIntegrationEnrichmentWithContext(ctx return } -// GetSalIntegrationEnrichmentAssets : Get semantic enrichment assets associated with the schema -// Get semantic enrichment job runs associated with the schema. -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentAssets(getSalIntegrationEnrichmentAssetsOptions *GetSalIntegrationEnrichmentAssetsOptions) (result *SalIntegrationEnrichmentAssets, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSalIntegrationEnrichmentAssetsWithContext(context.Background(), getSalIntegrationEnrichmentAssetsOptions) +// GetSparkEngineHistoryServerUi : Redirect to spark history server UI +// Redirect to spark history server UI. +func (watsonxData *WatsonxDataV3) GetSparkEngineHistoryServerUi(getSparkEngineHistoryServerUiOptions *GetSparkEngineHistoryServerUiOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.GetSparkEngineHistoryServerUiWithContext(context.Background(), getSparkEngineHistoryServerUiOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSalIntegrationEnrichmentAssetsWithContext is an alternate form of the GetSalIntegrationEnrichmentAssets method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentAssetsWithContext(ctx context.Context, getSalIntegrationEnrichmentAssetsOptions *GetSalIntegrationEnrichmentAssetsOptions) (result *SalIntegrationEnrichmentAssets, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getSalIntegrationEnrichmentAssetsOptions, "getSalIntegrationEnrichmentAssetsOptions") +// GetSparkEngineHistoryServerUiWithContext is an alternate form of the GetSparkEngineHistoryServerUi method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSparkEngineHistoryServerUiWithContext(ctx context.Context, getSparkEngineHistoryServerUiOptions *GetSparkEngineHistoryServerUiOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSparkEngineHistoryServerUiOptions, "getSparkEngineHistoryServerUiOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getSparkEngineHistoryServerUiOptions, "getSparkEngineHistoryServerUiOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *getSparkEngineHistoryServerUiOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/enrichment_assets`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/spark_engines/{id}/history_server/ui`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSalIntegrationEnrichmentAssetsOptions.Headers { + for headerName, headerValue := range getSparkEngineHistoryServerUiOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSalIntegrationEnrichmentAssets") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSparkEngineHistoryServerUi") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if getSalIntegrationEnrichmentAssetsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationEnrichmentAssetsOptions.AuthInstanceID)) - } - - if getSalIntegrationEnrichmentAssetsOptions.ProjectID != nil { - builder.AddQuery("project_id", fmt.Sprint(*getSalIntegrationEnrichmentAssetsOptions.ProjectID)) + if getSparkEngineHistoryServerUiOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSparkEngineHistoryServerUiOptions.AuthInstanceID)) } request, err := builder.Build() @@ -6032,68 +6326,92 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentAssetsWithContext(c return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_sal_integration_enrichment_assets", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_spark_engine_history_server_ui", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationEnrichmentAssets) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetSalIntegrationEnrichmentDataAsset : Get semantic enrichment data asset associated with the table -// Get semantic enrichment data asset associated with the table. -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentDataAsset(getSalIntegrationEnrichmentDataAssetOptions *GetSalIntegrationEnrichmentDataAssetOptions) (result *SalIntegrationEnrichmentDataAsset, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSalIntegrationEnrichmentDataAssetWithContext(context.Background(), getSalIntegrationEnrichmentDataAssetOptions) +// ValidateIntegration : To validate an integration +// To validate the details of an integration. +func (watsonxData *WatsonxDataV3) ValidateIntegration(validateIntegrationOptions *ValidateIntegrationOptions) (result *ValidateIntegration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ValidateIntegrationWithContext(context.Background(), validateIntegrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSalIntegrationEnrichmentDataAssetWithContext is an alternate form of the GetSalIntegrationEnrichmentDataAsset method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentDataAssetWithContext(ctx context.Context, getSalIntegrationEnrichmentDataAssetOptions *GetSalIntegrationEnrichmentDataAssetOptions) (result *SalIntegrationEnrichmentDataAsset, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getSalIntegrationEnrichmentDataAssetOptions, "getSalIntegrationEnrichmentDataAssetOptions") +// ValidateIntegrationWithContext is an alternate form of the ValidateIntegration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ValidateIntegrationWithContext(ctx context.Context, validateIntegrationOptions *ValidateIntegrationOptions) (result *ValidateIntegration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(validateIntegrationOptions, "validateIntegrationOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(validateIntegrationOptions, "validateIntegrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/enrichment_data_asset`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/integration_validation`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSalIntegrationEnrichmentDataAssetOptions.Headers { + for headerName, headerValue := range validateIntegrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSalIntegrationEnrichmentDataAsset") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ValidateIntegration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSalIntegrationEnrichmentDataAssetOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationEnrichmentDataAssetOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if validateIntegrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*validateIntegrationOptions.AuthInstanceID)) } - if getSalIntegrationEnrichmentDataAssetOptions.ProjectID != nil { - builder.AddQuery("project_id", fmt.Sprint(*getSalIntegrationEnrichmentDataAssetOptions.ProjectID)) + body := make(map[string]interface{}) + if validateIntegrationOptions.Type != nil { + body["type"] = validateIntegrationOptions.Type + } + if validateIntegrationOptions.AccessToken != nil { + body["access_token"] = validateIntegrationOptions.AccessToken } - if getSalIntegrationEnrichmentDataAssetOptions.AssetID != nil { - builder.AddQuery("asset_id", fmt.Sprint(*getSalIntegrationEnrichmentDataAssetOptions.AssetID)) + if validateIntegrationOptions.Apikey != nil { + body["apikey"] = validateIntegrationOptions.Apikey + } + if validateIntegrationOptions.Catalogs != nil { + body["catalogs"] = validateIntegrationOptions.Catalogs + } + if validateIntegrationOptions.Certificate != nil { + body["certificate"] = validateIntegrationOptions.Certificate + } + if validateIntegrationOptions.Password != nil { + body["password"] = validateIntegrationOptions.Password + } + if validateIntegrationOptions.Ssl != nil { + body["ssl"] = validateIntegrationOptions.Ssl + } + if validateIntegrationOptions.URL != nil { + body["url"] = validateIntegrationOptions.URL + } + if validateIntegrationOptions.Username != nil { + body["username"] = validateIntegrationOptions.Username + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -6105,12 +6423,12 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentDataAssetWithContex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_sal_integration_enrichment_data_asset", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "validate_integration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationEnrichmentDataAsset) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalValidateIntegration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6121,17 +6439,17 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentDataAssetWithContex return } -// GetSalIntegrationEnrichmentJobRunLogs : Get semantic enrichment job run logs associated with the job run -// Get semantic enrichment job run logs associated with the job run. -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptions *GetSalIntegrationEnrichmentJobRunLogsOptions) (result *SalIntegrationEnrichmentJobRunLogs, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSalIntegrationEnrichmentJobRunLogsWithContext(context.Background(), getSalIntegrationEnrichmentJobRunLogsOptions) +// ListAllIntegrations : List integrations +// List all existing integrations (can be filtered based on `type`). +func (watsonxData *WatsonxDataV3) ListAllIntegrations(listAllIntegrationsOptions *ListAllIntegrationsOptions) (result *IntegrationCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListAllIntegrationsWithContext(context.Background(), listAllIntegrationsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSalIntegrationEnrichmentJobRunLogsWithContext is an alternate form of the GetSalIntegrationEnrichmentJobRunLogs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobRunLogsWithContext(ctx context.Context, getSalIntegrationEnrichmentJobRunLogsOptions *GetSalIntegrationEnrichmentJobRunLogsOptions) (result *SalIntegrationEnrichmentJobRunLogs, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getSalIntegrationEnrichmentJobRunLogsOptions, "getSalIntegrationEnrichmentJobRunLogsOptions") +// ListAllIntegrationsWithContext is an alternate form of the ListAllIntegrations method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListAllIntegrationsWithContext(ctx context.Context, listAllIntegrationsOptions *ListAllIntegrationsOptions) (result *IntegrationCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listAllIntegrationsOptions, "listAllIntegrationsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -6140,33 +6458,33 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobRunLogsWithConte builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/enrichment_job_run_logs`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/integrations`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSalIntegrationEnrichmentJobRunLogsOptions.Headers { + for headerName, headerValue := range listAllIntegrationsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSalIntegrationEnrichmentJobRunLogs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListAllIntegrations") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSalIntegrationEnrichmentJobRunLogsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationEnrichmentJobRunLogsOptions.AuthInstanceID)) + if listAllIntegrationsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listAllIntegrationsOptions.AuthInstanceID)) } - - if getSalIntegrationEnrichmentJobRunLogsOptions.JobID != nil { - builder.AddQuery("job_id", fmt.Sprint(*getSalIntegrationEnrichmentJobRunLogsOptions.JobID)) + if listAllIntegrationsOptions.Secret != nil { + builder.AddHeader("Secret", fmt.Sprint(*listAllIntegrationsOptions.Secret)) } - if getSalIntegrationEnrichmentJobRunLogsOptions.JobRunID != nil { - builder.AddQuery("job_run_id", fmt.Sprint(*getSalIntegrationEnrichmentJobRunLogsOptions.JobRunID)) + + if listAllIntegrationsOptions.Type != nil { + builder.AddQuery("type", strings.Join(listAllIntegrationsOptions.Type, ",")) } - if getSalIntegrationEnrichmentJobRunLogsOptions.ProjectID != nil { - builder.AddQuery("project_id", fmt.Sprint(*getSalIntegrationEnrichmentJobRunLogsOptions.ProjectID)) + if listAllIntegrationsOptions.State != nil { + builder.AddQuery("state", strings.Join(listAllIntegrationsOptions.State, ",")) } request, err := builder.Build() @@ -6178,12 +6496,12 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobRunLogsWithConte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_sal_integration_enrichment_job_run_logs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_all_integrations", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationEnrichmentJobRunLogs) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIntegrationCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6194,49 +6512,104 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobRunLogsWithConte return } -// GetSalIntegrationEnrichmentJobRuns : Get semantic enrichment job runs associated with the schema -// Get semantic enrichment job runs associated with the schema. -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobRuns(getSalIntegrationEnrichmentJobRunsOptions *GetSalIntegrationEnrichmentJobRunsOptions) (result *SalIntegrationEnrichmentJobRun, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSalIntegrationEnrichmentJobRunsWithContext(context.Background(), getSalIntegrationEnrichmentJobRunsOptions) +// CreateIntegration : Create an integration +// To create an integration of type Apache Ranger, IBM Knowlege Catalog, IBM Manta Data lineage or IBM Data +// Observability by Databand. +func (watsonxData *WatsonxDataV3) CreateIntegration(createIntegrationOptions *CreateIntegrationOptions) (result *Integration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateIntegrationWithContext(context.Background(), createIntegrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSalIntegrationEnrichmentJobRunsWithContext is an alternate form of the GetSalIntegrationEnrichmentJobRuns method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobRunsWithContext(ctx context.Context, getSalIntegrationEnrichmentJobRunsOptions *GetSalIntegrationEnrichmentJobRunsOptions) (result *SalIntegrationEnrichmentJobRun, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getSalIntegrationEnrichmentJobRunsOptions, "getSalIntegrationEnrichmentJobRunsOptions") +// CreateIntegrationWithContext is an alternate form of the CreateIntegration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateIntegrationWithContext(ctx context.Context, createIntegrationOptions *CreateIntegrationOptions) (result *Integration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createIntegrationOptions, "createIntegrationOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createIntegrationOptions, "createIntegrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/enrichment_job_runs`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/integrations`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSalIntegrationEnrichmentJobRunsOptions.Headers { + for headerName, headerValue := range createIntegrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSalIntegrationEnrichmentJobRuns") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateIntegration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSalIntegrationEnrichmentJobRunsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationEnrichmentJobRunsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if createIntegrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createIntegrationOptions.AuthInstanceID)) } - if getSalIntegrationEnrichmentJobRunsOptions.JobID != nil { - builder.AddQuery("job_id", fmt.Sprint(*getSalIntegrationEnrichmentJobRunsOptions.JobID)) + body := make(map[string]interface{}) + if createIntegrationOptions.AccessToken != nil { + body["access_token"] = createIntegrationOptions.AccessToken + } + if createIntegrationOptions.Apikey != nil { + body["apikey"] = createIntegrationOptions.Apikey + } + if createIntegrationOptions.Catalogs != nil { + body["catalogs"] = createIntegrationOptions.Catalogs + } + if createIntegrationOptions.Certificate != nil { + body["certificate"] = createIntegrationOptions.Certificate + } + if createIntegrationOptions.CertificateExtension != nil { + body["certificate_extension"] = createIntegrationOptions.CertificateExtension + } + if createIntegrationOptions.ConnectionMode != nil { + body["connection_mode"] = createIntegrationOptions.ConnectionMode + } + if createIntegrationOptions.CrossAccountIntegration != nil { + body["cross_account_integration"] = createIntegrationOptions.CrossAccountIntegration + } + if createIntegrationOptions.EnableDataPolicyWithinWxd != nil { + body["enable_data_policy_within_wxd"] = createIntegrationOptions.EnableDataPolicyWithinWxd + } + if createIntegrationOptions.IkcUserAccountID != nil { + body["ikc_user_account_id"] = createIntegrationOptions.IkcUserAccountID + } + if createIntegrationOptions.Password != nil { + body["password"] = createIntegrationOptions.Password + } + if createIntegrationOptions.PolicyCacheTimeConfiguration != nil { + body["policy_cache_time_configuration"] = createIntegrationOptions.PolicyCacheTimeConfiguration + } + if createIntegrationOptions.Resource != nil { + body["resource"] = createIntegrationOptions.Resource + } + if createIntegrationOptions.Ssl != nil { + body["ssl"] = createIntegrationOptions.Ssl + } + if createIntegrationOptions.Type != nil { + body["type"] = createIntegrationOptions.Type + } + if createIntegrationOptions.URL != nil { + body["url"] = createIntegrationOptions.URL + } + if createIntegrationOptions.Username != nil { + body["username"] = createIntegrationOptions.Username } - if getSalIntegrationEnrichmentJobRunsOptions.ProjectID != nil { - builder.AddQuery("project_id", fmt.Sprint(*getSalIntegrationEnrichmentJobRunsOptions.ProjectID)) + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -6248,12 +6621,12 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobRunsWithContext( var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_sal_integration_enrichment_job_runs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_integration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationEnrichmentJobRun) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIntegration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6264,46 +6637,51 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobRunsWithContext( return } -// GetSalIntegrationEnrichmentJobs : Get semantic enrichment jobs associated with the schema -// Get semantic enrichment jobs associated with the schema. -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobs(getSalIntegrationEnrichmentJobsOptions *GetSalIntegrationEnrichmentJobsOptions) (result *SalIntegrationEnrichmentJobs, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSalIntegrationEnrichmentJobsWithContext(context.Background(), getSalIntegrationEnrichmentJobsOptions) +// GetIntegrations : Get an Integration +// To get the details of an integration. +func (watsonxData *WatsonxDataV3) GetIntegrations(getIntegrationsOptions *GetIntegrationsOptions) (result *Integration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetIntegrationsWithContext(context.Background(), getIntegrationsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSalIntegrationEnrichmentJobsWithContext is an alternate form of the GetSalIntegrationEnrichmentJobs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobsWithContext(ctx context.Context, getSalIntegrationEnrichmentJobsOptions *GetSalIntegrationEnrichmentJobsOptions) (result *SalIntegrationEnrichmentJobs, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getSalIntegrationEnrichmentJobsOptions, "getSalIntegrationEnrichmentJobsOptions") +// GetIntegrationsWithContext is an alternate form of the GetIntegrations method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetIntegrationsWithContext(ctx context.Context, getIntegrationsOptions *GetIntegrationsOptions) (result *Integration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getIntegrationsOptions, "getIntegrationsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getIntegrationsOptions, "getIntegrationsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "id": *getIntegrationsOptions.ID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/enrichment_jobs`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/integrations/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSalIntegrationEnrichmentJobsOptions.Headers { + for headerName, headerValue := range getIntegrationsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSalIntegrationEnrichmentJobs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetIntegrations") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSalIntegrationEnrichmentJobsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationEnrichmentJobsOptions.AuthInstanceID)) - } - - if getSalIntegrationEnrichmentJobsOptions.WkcProjectID != nil { - builder.AddQuery("wkc_project_id", fmt.Sprint(*getSalIntegrationEnrichmentJobsOptions.WkcProjectID)) + if getIntegrationsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getIntegrationsOptions.AuthInstanceID)) } request, err := builder.Build() @@ -6315,12 +6693,12 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobsWithContext(ctx var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_sal_integration_enrichment_jobs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_integrations", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationEnrichmentJobs) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIntegration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6331,42 +6709,50 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentJobsWithContext(ctx return } -// GetSalIntegrationGlossaryTerms : Get list of uploaded glossary terms -// Get list of uploaded glossary terms. -func (watsonxData *WatsonxDataV2) GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptions *GetSalIntegrationGlossaryTermsOptions) (result *SalIntegrationGlossaryTerms, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSalIntegrationGlossaryTermsWithContext(context.Background(), getSalIntegrationGlossaryTermsOptions) +// DeleteIntegration : Delete an Integration +// Deletes an existing integration completely from WatsonX.data. +func (watsonxData *WatsonxDataV3) DeleteIntegration(deleteIntegrationOptions *DeleteIntegrationOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteIntegrationWithContext(context.Background(), deleteIntegrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSalIntegrationGlossaryTermsWithContext is an alternate form of the GetSalIntegrationGlossaryTerms method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSalIntegrationGlossaryTermsWithContext(ctx context.Context, getSalIntegrationGlossaryTermsOptions *GetSalIntegrationGlossaryTermsOptions) (result *SalIntegrationGlossaryTerms, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getSalIntegrationGlossaryTermsOptions, "getSalIntegrationGlossaryTermsOptions") +// DeleteIntegrationWithContext is an alternate form of the DeleteIntegration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteIntegrationWithContext(ctx context.Context, deleteIntegrationOptions *DeleteIntegrationOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteIntegrationOptions, "deleteIntegrationOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteIntegrationOptions, "deleteIntegrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *deleteIntegrationOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/glossary_terms`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/integrations/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSalIntegrationGlossaryTermsOptions.Headers { + for headerName, headerValue := range deleteIntegrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSalIntegrationGlossaryTerms") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteIntegration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if getSalIntegrationGlossaryTermsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationGlossaryTermsOptions.AuthInstanceID)) + if deleteIntegrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteIntegrationOptions.AuthInstanceID)) } request, err := builder.Build() @@ -6375,70 +6761,72 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationGlossaryTermsWithContext(ctx return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_sal_integration_glossary_terms", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_integration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationGlossaryTerms) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetSalIntegrationMappings : Get wkc catalog and project mapped to the schema -// Get wkc catalog and project mapped to the schema. -func (watsonxData *WatsonxDataV2) GetSalIntegrationMappings(getSalIntegrationMappingsOptions *GetSalIntegrationMappingsOptions) (result *SalIntegrationMappings, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSalIntegrationMappingsWithContext(context.Background(), getSalIntegrationMappingsOptions) +// UpdateIntegration : Update an Integration +// To Update information details and state of an existing integration. +func (watsonxData *WatsonxDataV3) UpdateIntegration(updateIntegrationOptions *UpdateIntegrationOptions) (result *Integration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateIntegrationWithContext(context.Background(), updateIntegrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSalIntegrationMappingsWithContext is an alternate form of the GetSalIntegrationMappings method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSalIntegrationMappingsWithContext(ctx context.Context, getSalIntegrationMappingsOptions *GetSalIntegrationMappingsOptions) (result *SalIntegrationMappings, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSalIntegrationMappingsOptions, "getSalIntegrationMappingsOptions cannot be nil") +// UpdateIntegrationWithContext is an alternate form of the UpdateIntegration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateIntegrationWithContext(ctx context.Context, updateIntegrationOptions *UpdateIntegrationOptions) (result *Integration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateIntegrationOptions, "updateIntegrationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSalIntegrationMappingsOptions, "getSalIntegrationMappingsOptions") + err = core.ValidateStruct(updateIntegrationOptions, "updateIntegrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *updateIntegrationOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/mappings`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/integrations/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSalIntegrationMappingsOptions.Headers { + for headerName, headerValue := range updateIntegrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSalIntegrationMappings") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateIntegration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSalIntegrationMappingsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationMappingsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateIntegrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateIntegrationOptions.AuthInstanceID)) + } + if updateIntegrationOptions.Secret != nil { + builder.AddHeader("Secret", fmt.Sprint(*updateIntegrationOptions.Secret)) } - builder.AddQuery("catalog_name", fmt.Sprint(*getSalIntegrationMappingsOptions.CatalogName)) - builder.AddQuery("schema_name", fmt.Sprint(*getSalIntegrationMappingsOptions.SchemaName)) + _, err = builder.SetBodyContentJSON(updateIntegrationOptions.Body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } request, err := builder.Build() if err != nil { @@ -6449,12 +6837,12 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationMappingsWithContext(ctx conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_sal_integration_mappings", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_integration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationMappings) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIntegration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6465,42 +6853,66 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationMappingsWithContext(ctx conte return } -// GetSalIntegrationEnrichmentGlobalSettings : Get metadata enrichment global settings -// Get metadata enrichment global settings. -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptions *GetSalIntegrationEnrichmentGlobalSettingsOptions) (result *SalIntegrationEnrichmentSettings, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSalIntegrationEnrichmentGlobalSettingsWithContext(context.Background(), getSalIntegrationEnrichmentGlobalSettingsOptions) +// RegisterTable : Register delta and hudi tables +// Register delta and hudi tables. +func (watsonxData *WatsonxDataV3) RegisterTable(registerTableOptions *RegisterTableOptions) (result *RegisterTableCreatedBody, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.RegisterTableWithContext(context.Background(), registerTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSalIntegrationEnrichmentGlobalSettingsWithContext is an alternate form of the GetSalIntegrationEnrichmentGlobalSettings method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentGlobalSettingsWithContext(ctx context.Context, getSalIntegrationEnrichmentGlobalSettingsOptions *GetSalIntegrationEnrichmentGlobalSettingsOptions) (result *SalIntegrationEnrichmentSettings, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getSalIntegrationEnrichmentGlobalSettingsOptions, "getSalIntegrationEnrichmentGlobalSettingsOptions") +// RegisterTableWithContext is an alternate form of the RegisterTable method which supports a Context parameter +func (watsonxData *WatsonxDataV3) RegisterTableWithContext(ctx context.Context, registerTableOptions *RegisterTableOptions) (result *RegisterTableCreatedBody, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(registerTableOptions, "registerTableOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(registerTableOptions, "registerTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "catalog_id": *registerTableOptions.CatalogID, + "schema_id": *registerTableOptions.SchemaID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/metadata_enrichment_global_settings`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_id}/schemas/{schema_id}/register`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSalIntegrationEnrichmentGlobalSettingsOptions.Headers { + for headerName, headerValue := range registerTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSalIntegrationEnrichmentGlobalSettings") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "RegisterTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSalIntegrationEnrichmentGlobalSettingsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationEnrichmentGlobalSettingsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if registerTableOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*registerTableOptions.AuthInstanceID)) + } + + body := make(map[string]interface{}) + if registerTableOptions.MetadataLocation != nil { + body["metadata_location"] = registerTableOptions.MetadataLocation + } + if registerTableOptions.TableName != nil { + body["table_name"] = registerTableOptions.TableName + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -6512,12 +6924,12 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentGlobalSettingsWithC var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_sal_integration_enrichment_global_settings", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "register_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationEnrichmentSettings) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegisterTableCreatedBody) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6528,61 +6940,53 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentGlobalSettingsWithC return } -// CreateSalIntegrationEnrichmentGlobalSettings : Add metadata enrichment global settings -// Add metadata enrichment global settings. -func (watsonxData *WatsonxDataV2) CreateSalIntegrationEnrichmentGlobalSettings(createSalIntegrationEnrichmentGlobalSettingsOptions *CreateSalIntegrationEnrichmentGlobalSettingsOptions) (result *SalIntegrationEnrichmentSettings, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateSalIntegrationEnrichmentGlobalSettingsWithContext(context.Background(), createSalIntegrationEnrichmentGlobalSettingsOptions) +// LoadTable : Load delta and hudi tables metadata +// Load delta and hudi tables metadata. +func (watsonxData *WatsonxDataV3) LoadTable(loadTableOptions *LoadTableOptions) (result *LoadTableResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.LoadTableWithContext(context.Background(), loadTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSalIntegrationEnrichmentGlobalSettingsWithContext is an alternate form of the CreateSalIntegrationEnrichmentGlobalSettings method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateSalIntegrationEnrichmentGlobalSettingsWithContext(ctx context.Context, createSalIntegrationEnrichmentGlobalSettingsOptions *CreateSalIntegrationEnrichmentGlobalSettingsOptions) (result *SalIntegrationEnrichmentSettings, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSalIntegrationEnrichmentGlobalSettingsOptions, "createSalIntegrationEnrichmentGlobalSettingsOptions cannot be nil") +// LoadTableWithContext is an alternate form of the LoadTable method which supports a Context parameter +func (watsonxData *WatsonxDataV3) LoadTableWithContext(ctx context.Context, loadTableOptions *LoadTableOptions) (result *LoadTableResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(loadTableOptions, "loadTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSalIntegrationEnrichmentGlobalSettingsOptions, "createSalIntegrationEnrichmentGlobalSettingsOptions") + err = core.ValidateStruct(loadTableOptions, "loadTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "catalog_id": *loadTableOptions.CatalogID, + "schema_id": *loadTableOptions.SchemaID, + "table_id": *loadTableOptions.TableID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/metadata_enrichment_global_settings`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_id}/schemas/{schema_id}/tables/{table_id}/metadata`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSalIntegrationEnrichmentGlobalSettingsOptions.Headers { + for headerName, headerValue := range loadTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateSalIntegrationEnrichmentGlobalSettings") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "LoadTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createSalIntegrationEnrichmentGlobalSettingsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSalIntegrationEnrichmentGlobalSettingsOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if createSalIntegrationEnrichmentGlobalSettingsOptions.SemanticExpansion != nil { - body["semantic_expansion"] = createSalIntegrationEnrichmentGlobalSettingsOptions.SemanticExpansion - } - if createSalIntegrationEnrichmentGlobalSettingsOptions.TermAssignment != nil { - body["term_assignment"] = createSalIntegrationEnrichmentGlobalSettingsOptions.TermAssignment - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if loadTableOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*loadTableOptions.AuthInstanceID)) } request, err := builder.Build() @@ -6594,12 +6998,12 @@ func (watsonxData *WatsonxDataV2) CreateSalIntegrationEnrichmentGlobalSettingsWi var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_sal_integration_enrichment_global_settings", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "load_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationEnrichmentSettings) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadTableResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6610,17 +7014,17 @@ func (watsonxData *WatsonxDataV2) CreateSalIntegrationEnrichmentGlobalSettingsWi return } -// GetSalIntegrationEnrichmentSettings : get metadata enrichment settings for a project -// get metadata enrichment settings for a project. -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentSettings(getSalIntegrationEnrichmentSettingsOptions *GetSalIntegrationEnrichmentSettingsOptions) (result *SalIntegrationEnrichmentSettings, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSalIntegrationEnrichmentSettingsWithContext(context.Background(), getSalIntegrationEnrichmentSettingsOptions) +// ListCatalogs : Get list of catalogs +// Get list of catalogs. +func (watsonxData *WatsonxDataV3) ListCatalogs(listCatalogsOptions *ListCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListCatalogsWithContext(context.Background(), listCatalogsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSalIntegrationEnrichmentSettingsWithContext is an alternate form of the GetSalIntegrationEnrichmentSettings method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentSettingsWithContext(ctx context.Context, getSalIntegrationEnrichmentSettingsOptions *GetSalIntegrationEnrichmentSettingsOptions) (result *SalIntegrationEnrichmentSettings, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getSalIntegrationEnrichmentSettingsOptions, "getSalIntegrationEnrichmentSettingsOptions") +// ListCatalogsWithContext is an alternate form of the ListCatalogs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListCatalogsWithContext(ctx context.Context, listCatalogsOptions *ListCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listCatalogsOptions, "listCatalogsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -6629,27 +7033,33 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentSettingsWithContext builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/metadata_enrichment_settings`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSalIntegrationEnrichmentSettingsOptions.Headers { + for headerName, headerValue := range listCatalogsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSalIntegrationEnrichmentSettings") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListCatalogs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSalIntegrationEnrichmentSettingsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationEnrichmentSettingsOptions.AuthInstanceID)) + if listCatalogsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listCatalogsOptions.AuthInstanceID)) + } + if listCatalogsOptions.Secret != nil { + builder.AddHeader("Secret", fmt.Sprint(*listCatalogsOptions.Secret)) } - if getSalIntegrationEnrichmentSettingsOptions.ProjectID != nil { - builder.AddQuery("project_id", fmt.Sprint(*getSalIntegrationEnrichmentSettingsOptions.ProjectID)) + if listCatalogsOptions.DefaultCatalogs != nil { + builder.AddQuery("default_catalogs", fmt.Sprint(*listCatalogsOptions.DefaultCatalogs)) + } + if listCatalogsOptions.View != nil { + builder.AddQuery("view", fmt.Sprint(*listCatalogsOptions.View)) } request, err := builder.Build() @@ -6661,12 +7071,12 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentSettingsWithContext var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_sal_integration_enrichment_settings", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_catalogs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationEnrichmentSettings) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6677,64 +7087,51 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationEnrichmentSettingsWithContext return } -// CreateSalIntegrationEnrichmentSettings : Add metadata enrichment settings for a project -// Add metadata enrichment settings for a project. -func (watsonxData *WatsonxDataV2) CreateSalIntegrationEnrichmentSettings(createSalIntegrationEnrichmentSettingsOptions *CreateSalIntegrationEnrichmentSettingsOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.CreateSalIntegrationEnrichmentSettingsWithContext(context.Background(), createSalIntegrationEnrichmentSettingsOptions) +// GetCatalogEngineAssociation : Get catalog engine association +// Get catalog engine association. +func (watsonxData *WatsonxDataV3) GetCatalogEngineAssociation(getCatalogEngineAssociationOptions *GetCatalogEngineAssociationOptions) (result *CatalogEngineResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetCatalogEngineAssociationWithContext(context.Background(), getCatalogEngineAssociationOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSalIntegrationEnrichmentSettingsWithContext is an alternate form of the CreateSalIntegrationEnrichmentSettings method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateSalIntegrationEnrichmentSettingsWithContext(ctx context.Context, createSalIntegrationEnrichmentSettingsOptions *CreateSalIntegrationEnrichmentSettingsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSalIntegrationEnrichmentSettingsOptions, "createSalIntegrationEnrichmentSettingsOptions cannot be nil") +// GetCatalogEngineAssociationWithContext is an alternate form of the GetCatalogEngineAssociation method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetCatalogEngineAssociationWithContext(ctx context.Context, getCatalogEngineAssociationOptions *GetCatalogEngineAssociationOptions) (result *CatalogEngineResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getCatalogEngineAssociationOptions, "getCatalogEngineAssociationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSalIntegrationEnrichmentSettingsOptions, "createSalIntegrationEnrichmentSettingsOptions") + err = core.ValidateStruct(getCatalogEngineAssociationOptions, "getCatalogEngineAssociationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "catalog_name": *getCatalogEngineAssociationOptions.CatalogName, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/metadata_enrichment_settings`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/engines`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSalIntegrationEnrichmentSettingsOptions.Headers { + for headerName, headerValue := range getCatalogEngineAssociationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateSalIntegrationEnrichmentSettings") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetCatalogEngineAssociation") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Content-Type", "application/json") - if createSalIntegrationEnrichmentSettingsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSalIntegrationEnrichmentSettingsOptions.AuthInstanceID)) - } - - if createSalIntegrationEnrichmentSettingsOptions.ProjectID != nil { - builder.AddQuery("project_id", fmt.Sprint(*createSalIntegrationEnrichmentSettingsOptions.ProjectID)) - } - - body := make(map[string]interface{}) - if createSalIntegrationEnrichmentSettingsOptions.SemanticExpansion != nil { - body["semantic_expansion"] = createSalIntegrationEnrichmentSettingsOptions.SemanticExpansion - } - if createSalIntegrationEnrichmentSettingsOptions.TermAssignment != nil { - body["term_assignment"] = createSalIntegrationEnrichmentSettingsOptions.TermAssignment - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + builder.AddHeader("Accept", "application/json") + if getCatalogEngineAssociationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getCatalogEngineAssociationOptions.AuthInstanceID)) } request, err := builder.Build() @@ -6743,64 +7140,73 @@ func (watsonxData *WatsonxDataV2) CreateSalIntegrationEnrichmentSettingsWithCont return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_sal_integration_enrichment_settings", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_catalog_engine_association", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - - return -} - -// CreateSalIntegrationUploadGlossary : Upload semantic enrichment business terms glossary -// Upload semantic enrichment business terms glossary. -func (watsonxData *WatsonxDataV2) CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptions *CreateSalIntegrationUploadGlossaryOptions) (result *SalIntegrationUploadGlossary, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateSalIntegrationUploadGlossaryWithContext(context.Background(), createSalIntegrationUploadGlossaryOptions) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogEngineResponse) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// DeleteSchema : Delete schema +// Delete a schema. +func (watsonxData *WatsonxDataV3) DeleteSchema(deleteSchemaOptions *DeleteSchemaOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteSchemaWithContext(context.Background(), deleteSchemaOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSalIntegrationUploadGlossaryWithContext is an alternate form of the CreateSalIntegrationUploadGlossary method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateSalIntegrationUploadGlossaryWithContext(ctx context.Context, createSalIntegrationUploadGlossaryOptions *CreateSalIntegrationUploadGlossaryOptions) (result *SalIntegrationUploadGlossary, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSalIntegrationUploadGlossaryOptions, "createSalIntegrationUploadGlossaryOptions cannot be nil") +// DeleteSchemaWithContext is an alternate form of the DeleteSchema method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteSchemaWithContext(ctx context.Context, deleteSchemaOptions *DeleteSchemaOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSchemaOptions, "deleteSchemaOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSalIntegrationUploadGlossaryOptions, "createSalIntegrationUploadGlossaryOptions") + err = core.ValidateStruct(deleteSchemaOptions, "deleteSchemaOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "catalog_name": *deleteSchemaOptions.CatalogName, + "schema_name": *deleteSchemaOptions.SchemaName, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/upload_glossary`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/schemas/{schema_name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSalIntegrationUploadGlossaryOptions.Headers { + for headerName, headerValue := range deleteSchemaOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateSalIntegrationUploadGlossary") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteSchema") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if createSalIntegrationUploadGlossaryOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSalIntegrationUploadGlossaryOptions.AuthInstanceID)) + if deleteSchemaOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSchemaOptions.AuthInstanceID)) } - builder.AddFormData("replace_option", "", "", fmt.Sprint(*createSalIntegrationUploadGlossaryOptions.ReplaceOption)) - if createSalIntegrationUploadGlossaryOptions.GlossaryCsv != nil { - builder.AddFormData("glossary_csv", "filename", - core.StringNilMapper(createSalIntegrationUploadGlossaryOptions.GlossaryCsvContentType), createSalIntegrationUploadGlossaryOptions.GlossaryCsv) - } + builder.AddQuery("engine_id", fmt.Sprint(*deleteSchemaOptions.EngineID)) request, err := builder.Build() if err != nil { @@ -6808,66 +7214,65 @@ func (watsonxData *WatsonxDataV2) CreateSalIntegrationUploadGlossaryWithContext( return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_sal_integration_upload_glossary", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_schema", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationUploadGlossary) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetSalIntegrationUploadGlossaryStatus : Get status of upload glossary job -// Get status of upload glossary job. -func (watsonxData *WatsonxDataV2) GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptions *GetSalIntegrationUploadGlossaryStatusOptions) (result *SalIntegrationUploadGlossaryStatus, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSalIntegrationUploadGlossaryStatusWithContext(context.Background(), getSalIntegrationUploadGlossaryStatusOptions) +// ListTables : List all tables +// List all tables in a schema in a catalog for a given engine. +func (watsonxData *WatsonxDataV3) ListTables(listTablesOptions *ListTablesOptions) (result *TableCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListTablesWithContext(context.Background(), listTablesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSalIntegrationUploadGlossaryStatusWithContext is an alternate form of the GetSalIntegrationUploadGlossaryStatus method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSalIntegrationUploadGlossaryStatusWithContext(ctx context.Context, getSalIntegrationUploadGlossaryStatusOptions *GetSalIntegrationUploadGlossaryStatusOptions) (result *SalIntegrationUploadGlossaryStatus, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getSalIntegrationUploadGlossaryStatusOptions, "getSalIntegrationUploadGlossaryStatusOptions") +// ListTablesWithContext is an alternate form of the ListTables method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListTablesWithContext(ctx context.Context, listTablesOptions *ListTablesOptions) (result *TableCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listTablesOptions, "listTablesOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(listTablesOptions, "listTablesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "catalog_name": *listTablesOptions.CatalogName, + "schema_name": *listTablesOptions.SchemaName, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/sal_integrations/upload_glossary_status`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/schemas/{schema_name}/tables`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSalIntegrationUploadGlossaryStatusOptions.Headers { + for headerName, headerValue := range listTablesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSalIntegrationUploadGlossaryStatus") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListTables") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSalIntegrationUploadGlossaryStatusOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationUploadGlossaryStatusOptions.AuthInstanceID)) + if listTablesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listTablesOptions.AuthInstanceID)) } - if getSalIntegrationUploadGlossaryStatusOptions.ProcessID != nil { - builder.AddQuery("process_id", fmt.Sprint(*getSalIntegrationUploadGlossaryStatusOptions.ProcessID)) - } + builder.AddQuery("engine_id", fmt.Sprint(*listTablesOptions.EngineID)) request, err := builder.Build() if err != nil { @@ -6878,12 +7283,12 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationUploadGlossaryStatusWithConte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_sal_integration_upload_glossary_status", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_tables", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationUploadGlossaryStatus) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTableCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6894,42 +7299,58 @@ func (watsonxData *WatsonxDataV2) GetSalIntegrationUploadGlossaryStatusWithConte return } -// ListSparkEngines : List all spark engines -// List all spark engines. -func (watsonxData *WatsonxDataV2) ListSparkEngines(listSparkEnginesOptions *ListSparkEnginesOptions) (result *SparkEngineCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListSparkEnginesWithContext(context.Background(), listSparkEnginesOptions) +// GetTable : Get table details +// Get details of a given table in a catalog and schema. +func (watsonxData *WatsonxDataV3) GetTable(getTableOptions *GetTableOptions) (result *Table, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetTableWithContext(context.Background(), getTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSparkEnginesWithContext is an alternate form of the ListSparkEngines method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListSparkEnginesWithContext(ctx context.Context, listSparkEnginesOptions *ListSparkEnginesOptions) (result *SparkEngineCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSparkEnginesOptions, "listSparkEnginesOptions") +// GetTableWithContext is an alternate form of the GetTable method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetTableWithContext(ctx context.Context, getTableOptions *GetTableOptions) (result *Table, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getTableOptions, "getTableOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getTableOptions, "getTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "catalog_name": *getTableOptions.CatalogName, + "schema_name": *getTableOptions.SchemaName, + "table_name": *getTableOptions.TableName, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSparkEnginesOptions.Headers { + for headerName, headerValue := range getTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListSparkEngines") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listSparkEnginesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSparkEnginesOptions.AuthInstanceID)) + if getTableOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getTableOptions.AuthInstanceID)) + } + + builder.AddQuery("engine_id", fmt.Sprint(*getTableOptions.EngineID)) + if getTableOptions.Type != nil { + builder.AddQuery("type", fmt.Sprint(*getTableOptions.Type)) } request, err := builder.Build() @@ -6941,12 +7362,12 @@ func (watsonxData *WatsonxDataV2) ListSparkEnginesWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_spark_engines", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngineCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -6957,76 +7378,131 @@ func (watsonxData *WatsonxDataV2) ListSparkEnginesWithContext(ctx context.Contex return } -// CreateSparkEngine : Create spark engine -// Create a new spark engine. -func (watsonxData *WatsonxDataV2) CreateSparkEngine(createSparkEngineOptions *CreateSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateSparkEngineWithContext(context.Background(), createSparkEngineOptions) +// DeleteTable : Delete table +// Delete table for a given schema and catalog. +func (watsonxData *WatsonxDataV3) DeleteTable(deleteTableOptions *DeleteTableOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteTableWithContext(context.Background(), deleteTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSparkEngineWithContext is an alternate form of the CreateSparkEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateSparkEngineWithContext(ctx context.Context, createSparkEngineOptions *CreateSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSparkEngineOptions, "createSparkEngineOptions cannot be nil") +// DeleteTableWithContext is an alternate form of the DeleteTable method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteTableWithContext(ctx context.Context, deleteTableOptions *DeleteTableOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteTableOptions, "deleteTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSparkEngineOptions, "createSparkEngineOptions") + err = core.ValidateStruct(deleteTableOptions, "deleteTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "catalog_name": *deleteTableOptions.CatalogName, + "schema_name": *deleteTableOptions.SchemaName, + "table_name": *deleteTableOptions.TableName, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSparkEngineOptions.Headers { + for headerName, headerValue := range deleteTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateSparkEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createSparkEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSparkEngineOptions.AuthInstanceID)) + if deleteTableOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteTableOptions.AuthInstanceID)) } - body := make(map[string]interface{}) - if createSparkEngineOptions.Origin != nil { - body["origin"] = createSparkEngineOptions.Origin + builder.AddQuery("engine_id", fmt.Sprint(*deleteTableOptions.EngineID)) + if deleteTableOptions.Type != nil { + builder.AddQuery("type", fmt.Sprint(*deleteTableOptions.Type)) } - if createSparkEngineOptions.AssociatedCatalogs != nil { - body["associated_catalogs"] = createSparkEngineOptions.AssociatedCatalogs + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - if createSparkEngineOptions.Description != nil { - body["description"] = createSparkEngineOptions.Description + + response, err = watsonxData.Service.Request(request, nil) + if err != nil { + core.EnrichHTTPProblem(err, "delete_table", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return } - if createSparkEngineOptions.EngineDetails != nil { - body["engine_details"] = createSparkEngineOptions.EngineDetails + + return +} + +// UpdateTable : Rename table +// Rename table. +func (watsonxData *WatsonxDataV3) UpdateTable(updateTableOptions *UpdateTableOptions) (result *Table, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateTableWithContext(context.Background(), updateTableOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// UpdateTableWithContext is an alternate form of the UpdateTable method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateTableWithContext(ctx context.Context, updateTableOptions *UpdateTableOptions) (result *Table, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateTableOptions, "updateTableOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return } - if createSparkEngineOptions.EngineDisplayName != nil { - body["engine_display_name"] = createSparkEngineOptions.EngineDisplayName + err = core.ValidateStruct(updateTableOptions, "updateTableOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return } - if createSparkEngineOptions.Status != nil { - body["status"] = createSparkEngineOptions.Status + + pathParamsMap := map[string]string{ + "catalog_name": *updateTableOptions.CatalogName, + "schema_name": *updateTableOptions.SchemaName, + "table_name": *updateTableOptions.TableName, } - if createSparkEngineOptions.Tags != nil { - body["tags"] = createSparkEngineOptions.Tags + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}`, pathParamsMap) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) + return } - if createSparkEngineOptions.Type != nil { - body["type"] = createSparkEngineOptions.Type + + for headerName, headerValue := range updateTableOptions.Headers { + builder.AddHeader(headerName, headerValue) } - _, err = builder.SetBodyContentJSON(body) + + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateTableOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateTableOptions.AuthInstanceID)) + } + + builder.AddQuery("engine_id", fmt.Sprint(*updateTableOptions.EngineID)) + if updateTableOptions.Type != nil { + builder.AddQuery("type", fmt.Sprint(*updateTableOptions.Type)) + } + + _, err = builder.SetBodyContentJSON(updateTableOptions.Body) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -7041,12 +7517,12 @@ func (watsonxData *WatsonxDataV2) CreateSparkEngineWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_spark_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTable) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7057,53 +7533,57 @@ func (watsonxData *WatsonxDataV2) CreateSparkEngineWithContext(ctx context.Conte return } -// GetSparkEngine : Get spark engine -// Get spark engine by ID. -func (watsonxData *WatsonxDataV2) GetSparkEngine(getSparkEngineOptions *GetSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSparkEngineWithContext(context.Background(), getSparkEngineOptions) +// ListColumns : List all columns of a table +// List all columns of a table in a given a schema for a given catalog. +func (watsonxData *WatsonxDataV3) ListColumns(listColumnsOptions *ListColumnsOptions) (result *ColumnCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListColumnsWithContext(context.Background(), listColumnsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSparkEngineWithContext is an alternate form of the GetSparkEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSparkEngineWithContext(ctx context.Context, getSparkEngineOptions *GetSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSparkEngineOptions, "getSparkEngineOptions cannot be nil") +// ListColumnsWithContext is an alternate form of the ListColumns method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListColumnsWithContext(ctx context.Context, listColumnsOptions *ListColumnsOptions) (result *ColumnCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listColumnsOptions, "listColumnsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSparkEngineOptions, "getSparkEngineOptions") + err = core.ValidateStruct(listColumnsOptions, "listColumnsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *getSparkEngineOptions.EngineID, + "catalog_name": *listColumnsOptions.CatalogName, + "schema_name": *listColumnsOptions.SchemaName, + "table_name": *listColumnsOptions.TableName, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}/columns`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSparkEngineOptions.Headers { + for headerName, headerValue := range listColumnsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSparkEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListColumns") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSparkEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSparkEngineOptions.AuthInstanceID)) + if listColumnsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listColumnsOptions.AuthInstanceID)) } + builder.AddQuery("engine_id", fmt.Sprint(*listColumnsOptions.EngineID)) + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -7113,12 +7593,12 @@ func (watsonxData *WatsonxDataV2) GetSparkEngineWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_spark_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_columns", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngine) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalColumnCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7129,50 +7609,66 @@ func (watsonxData *WatsonxDataV2) GetSparkEngineWithContext(ctx context.Context, return } -// DeleteSparkEngine : Delete spark engine -// Delete a spark engine. -func (watsonxData *WatsonxDataV2) DeleteSparkEngine(deleteSparkEngineOptions *DeleteSparkEngineOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteSparkEngineWithContext(context.Background(), deleteSparkEngineOptions) +// CreateColumns : Add column(s) +// Add one or multiple columns to a table in a schema for a given catalog. +func (watsonxData *WatsonxDataV3) CreateColumns(createColumnsOptions *CreateColumnsOptions) (result *ColumnCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateColumnsWithContext(context.Background(), createColumnsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSparkEngineWithContext is an alternate form of the DeleteSparkEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteSparkEngineWithContext(ctx context.Context, deleteSparkEngineOptions *DeleteSparkEngineOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSparkEngineOptions, "deleteSparkEngineOptions cannot be nil") +// CreateColumnsWithContext is an alternate form of the CreateColumns method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateColumnsWithContext(ctx context.Context, createColumnsOptions *CreateColumnsOptions) (result *ColumnCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createColumnsOptions, "createColumnsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSparkEngineOptions, "deleteSparkEngineOptions") + err = core.ValidateStruct(createColumnsOptions, "createColumnsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *deleteSparkEngineOptions.EngineID, + "catalog_name": *createColumnsOptions.CatalogName, + "schema_name": *createColumnsOptions.SchemaName, + "table_name": *createColumnsOptions.TableName, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}/columns`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSparkEngineOptions.Headers { + for headerName, headerValue := range createColumnsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteSparkEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateColumns") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteSparkEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSparkEngineOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if createColumnsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createColumnsOptions.AuthInstanceID)) + } + + builder.AddQuery("engine_id", fmt.Sprint(*createColumnsOptions.EngineID)) + + body := make(map[string]interface{}) + if createColumnsOptions.Columns != nil { + body["columns"] = createColumnsOptions.Columns + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -7181,69 +7677,75 @@ func (watsonxData *WatsonxDataV2) DeleteSparkEngineWithContext(ctx context.Conte return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_spark_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_columns", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalColumnCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateSparkEngine : Update spark engine -// Update details of spark engine. -func (watsonxData *WatsonxDataV2) UpdateSparkEngine(updateSparkEngineOptions *UpdateSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateSparkEngineWithContext(context.Background(), updateSparkEngineOptions) +// DeleteColumn : Delete column +// Delete column in a table for a given schema and catalog. +func (watsonxData *WatsonxDataV3) DeleteColumn(deleteColumnOptions *DeleteColumnOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteColumnWithContext(context.Background(), deleteColumnOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateSparkEngineWithContext is an alternate form of the UpdateSparkEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateSparkEngineWithContext(ctx context.Context, updateSparkEngineOptions *UpdateSparkEngineOptions) (result *SparkEngine, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSparkEngineOptions, "updateSparkEngineOptions cannot be nil") +// DeleteColumnWithContext is an alternate form of the DeleteColumn method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteColumnWithContext(ctx context.Context, deleteColumnOptions *DeleteColumnOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteColumnOptions, "deleteColumnOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateSparkEngineOptions, "updateSparkEngineOptions") + err = core.ValidateStruct(deleteColumnOptions, "deleteColumnOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *updateSparkEngineOptions.EngineID, + "catalog_name": *deleteColumnOptions.CatalogName, + "schema_name": *deleteColumnOptions.SchemaName, + "table_name": *deleteColumnOptions.TableName, + "column_name": *deleteColumnOptions.ColumnName, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}/columns/{column_name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSparkEngineOptions.Headers { + for headerName, headerValue := range deleteColumnOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateSparkEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteColumn") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSparkEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateSparkEngineOptions.AuthInstanceID)) + if deleteColumnOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteColumnOptions.AuthInstanceID)) } - _, err = builder.SetBodyContentJSON(updateSparkEngineOptions.Body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } + builder.AddQuery("engine_id", fmt.Sprint(*deleteColumnOptions.EngineID)) request, err := builder.Build() if err != nil { @@ -7251,74 +7753,73 @@ func (watsonxData *WatsonxDataV2) UpdateSparkEngineWithContext(ctx context.Conte return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "update_spark_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_column", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngine) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListSparkEngineApplications : List all applications in a spark engine -// List all applications in a spark engine. -func (watsonxData *WatsonxDataV2) ListSparkEngineApplications(listSparkEngineApplicationsOptions *ListSparkEngineApplicationsOptions) (result *SparkEngineApplicationStatusCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListSparkEngineApplicationsWithContext(context.Background(), listSparkEngineApplicationsOptions) +// UpdateColumn : Alter column +// Update the given column - rename column. +func (watsonxData *WatsonxDataV3) UpdateColumn(updateColumnOptions *UpdateColumnOptions) (result *Column, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateColumnWithContext(context.Background(), updateColumnOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSparkEngineApplicationsWithContext is an alternate form of the ListSparkEngineApplications method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListSparkEngineApplicationsWithContext(ctx context.Context, listSparkEngineApplicationsOptions *ListSparkEngineApplicationsOptions) (result *SparkEngineApplicationStatusCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSparkEngineApplicationsOptions, "listSparkEngineApplicationsOptions cannot be nil") +// UpdateColumnWithContext is an alternate form of the UpdateColumn method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateColumnWithContext(ctx context.Context, updateColumnOptions *UpdateColumnOptions) (result *Column, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateColumnOptions, "updateColumnOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listSparkEngineApplicationsOptions, "listSparkEngineApplicationsOptions") + err = core.ValidateStruct(updateColumnOptions, "updateColumnOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *listSparkEngineApplicationsOptions.EngineID, + "catalog_name": *updateColumnOptions.CatalogName, + "schema_name": *updateColumnOptions.SchemaName, + "table_name": *updateColumnOptions.TableName, + "column_name": *updateColumnOptions.ColumnName, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/applications`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}/columns/{column_name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSparkEngineApplicationsOptions.Headers { + for headerName, headerValue := range updateColumnOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListSparkEngineApplications") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateColumn") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listSparkEngineApplicationsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSparkEngineApplicationsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateColumnOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateColumnOptions.AuthInstanceID)) } - if listSparkEngineApplicationsOptions.State != nil { - builder.AddQuery("state", strings.Join(listSparkEngineApplicationsOptions.State, ",")) + builder.AddQuery("engine_id", fmt.Sprint(*updateColumnOptions.EngineID)) + + _, err = builder.SetBodyContentJSON(updateColumnOptions.Body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -7330,12 +7831,12 @@ func (watsonxData *WatsonxDataV2) ListSparkEngineApplicationsWithContext(ctx con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_spark_engine_applications", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_column", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngineApplicationStatusCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalColumn) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7346,73 +7847,63 @@ func (watsonxData *WatsonxDataV2) ListSparkEngineApplicationsWithContext(ctx con return } -// CreateSparkEngineApplication : Submit engine applications -// Submit engine applications. -func (watsonxData *WatsonxDataV2) CreateSparkEngineApplication(createSparkEngineApplicationOptions *CreateSparkEngineApplicationOptions) (result *SparkEngineApplicationStatus, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateSparkEngineApplicationWithContext(context.Background(), createSparkEngineApplicationOptions) +// RollbackTable : Rollback snapshot +// Rollback table to snapshot. +func (watsonxData *WatsonxDataV3) RollbackTable(rollbackTableOptions *RollbackTableOptions) (result *SuccessResponsePrototype, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.RollbackTableWithContext(context.Background(), rollbackTableOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSparkEngineApplicationWithContext is an alternate form of the CreateSparkEngineApplication method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateSparkEngineApplicationWithContext(ctx context.Context, createSparkEngineApplicationOptions *CreateSparkEngineApplicationOptions) (result *SparkEngineApplicationStatus, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSparkEngineApplicationOptions, "createSparkEngineApplicationOptions cannot be nil") +// RollbackTableWithContext is an alternate form of the RollbackTable method which supports a Context parameter +func (watsonxData *WatsonxDataV3) RollbackTableWithContext(ctx context.Context, rollbackTableOptions *RollbackTableOptions) (result *SuccessResponsePrototype, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(rollbackTableOptions, "rollbackTableOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSparkEngineApplicationOptions, "createSparkEngineApplicationOptions") + err = core.ValidateStruct(rollbackTableOptions, "rollbackTableOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *createSparkEngineApplicationOptions.EngineID, + "catalog_name": *rollbackTableOptions.CatalogName, + "schema_name": *rollbackTableOptions.SchemaName, + "table_name": *rollbackTableOptions.TableName, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/applications`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}/rollback`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSparkEngineApplicationOptions.Headers { + for headerName, headerValue := range rollbackTableOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateSparkEngineApplication") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "RollbackTable") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if createSparkEngineApplicationOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSparkEngineApplicationOptions.AuthInstanceID)) + if rollbackTableOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*rollbackTableOptions.AuthInstanceID)) } - if createSparkEngineApplicationOptions.State != nil { - builder.AddQuery("state", strings.Join(createSparkEngineApplicationOptions.State, ",")) + if rollbackTableOptions.EngineID != nil { + builder.AddQuery("engine_id", fmt.Sprint(*rollbackTableOptions.EngineID)) } body := make(map[string]interface{}) - if createSparkEngineApplicationOptions.ApplicationDetails != nil { - body["application_details"] = createSparkEngineApplicationOptions.ApplicationDetails - } - if createSparkEngineApplicationOptions.JobEndpoint != nil { - body["job_endpoint"] = createSparkEngineApplicationOptions.JobEndpoint - } - if createSparkEngineApplicationOptions.ServiceInstanceID != nil { - body["service_instance_id"] = createSparkEngineApplicationOptions.ServiceInstanceID - } - if createSparkEngineApplicationOptions.Type != nil { - body["type"] = createSparkEngineApplicationOptions.Type - } - if createSparkEngineApplicationOptions.Volumes != nil { - body["volumes"] = createSparkEngineApplicationOptions.Volumes + if rollbackTableOptions.SnapshotID != nil { + body["snapshot_id"] = rollbackTableOptions.SnapshotID } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -7429,12 +7920,12 @@ func (watsonxData *WatsonxDataV2) CreateSparkEngineApplicationWithContext(ctx co var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_spark_engine_application", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "rollback_table", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngineApplicationStatus) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponsePrototype) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7445,55 +7936,57 @@ func (watsonxData *WatsonxDataV2) CreateSparkEngineApplicationWithContext(ctx co return } -// DeleteSparkEngineApplications : Stop Spark Applications -// Stop a running spark application. -func (watsonxData *WatsonxDataV2) DeleteSparkEngineApplications(deleteSparkEngineApplicationsOptions *DeleteSparkEngineApplicationsOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteSparkEngineApplicationsWithContext(context.Background(), deleteSparkEngineApplicationsOptions) +// ListTableSnapshots : Get table snapshots +// List all table snapshots. +func (watsonxData *WatsonxDataV3) ListTableSnapshots(listTableSnapshotsOptions *ListTableSnapshotsOptions) (result *TableSnapshotCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListTableSnapshotsWithContext(context.Background(), listTableSnapshotsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSparkEngineApplicationsWithContext is an alternate form of the DeleteSparkEngineApplications method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteSparkEngineApplicationsWithContext(ctx context.Context, deleteSparkEngineApplicationsOptions *DeleteSparkEngineApplicationsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSparkEngineApplicationsOptions, "deleteSparkEngineApplicationsOptions cannot be nil") +// ListTableSnapshotsWithContext is an alternate form of the ListTableSnapshots method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListTableSnapshotsWithContext(ctx context.Context, listTableSnapshotsOptions *ListTableSnapshotsOptions) (result *TableSnapshotCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listTableSnapshotsOptions, "listTableSnapshotsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSparkEngineApplicationsOptions, "deleteSparkEngineApplicationsOptions") + err = core.ValidateStruct(listTableSnapshotsOptions, "listTableSnapshotsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *deleteSparkEngineApplicationsOptions.EngineID, + "catalog_name": *listTableSnapshotsOptions.CatalogName, + "schema_name": *listTableSnapshotsOptions.SchemaName, + "table_name": *listTableSnapshotsOptions.TableName, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/applications`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{catalog_name}/schemas/{schema_name}/tables/{table_name}/snapshots`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSparkEngineApplicationsOptions.Headers { + for headerName, headerValue := range listTableSnapshotsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteSparkEngineApplications") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListTableSnapshots") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteSparkEngineApplicationsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSparkEngineApplicationsOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + if listTableSnapshotsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listTableSnapshotsOptions.AuthInstanceID)) } - builder.AddQuery("application_id", fmt.Sprint(*deleteSparkEngineApplicationsOptions.ApplicationID)) - if deleteSparkEngineApplicationsOptions.State != nil { - builder.AddQuery("state", strings.Join(deleteSparkEngineApplicationsOptions.State, ",")) + if listTableSnapshotsOptions.EngineID != nil { + builder.AddQuery("engine_id", fmt.Sprint(*listTableSnapshotsOptions.EngineID)) } request, err := builder.Build() @@ -7502,64 +7995,74 @@ func (watsonxData *WatsonxDataV2) DeleteSparkEngineApplicationsWithContext(ctx c return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_spark_engine_applications", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_table_snapshots", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTableSnapshotCollection) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetSparkEngineApplicationStatus : Get spark application -// Get status of spark application. -func (watsonxData *WatsonxDataV2) GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptions *GetSparkEngineApplicationStatusOptions) (result *SparkEngineApplicationStatus, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSparkEngineApplicationStatusWithContext(context.Background(), getSparkEngineApplicationStatusOptions) +// ListSchemas : List all schemas +// List all schemas in catalog. +func (watsonxData *WatsonxDataV3) ListSchemas(listSchemasOptions *ListSchemasOptions) (result *SchemasCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListSchemasWithContext(context.Background(), listSchemasOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSparkEngineApplicationStatusWithContext is an alternate form of the GetSparkEngineApplicationStatus method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSparkEngineApplicationStatusWithContext(ctx context.Context, getSparkEngineApplicationStatusOptions *GetSparkEngineApplicationStatusOptions) (result *SparkEngineApplicationStatus, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSparkEngineApplicationStatusOptions, "getSparkEngineApplicationStatusOptions cannot be nil") +// ListSchemasWithContext is an alternate form of the ListSchemas method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListSchemasWithContext(ctx context.Context, listSchemasOptions *ListSchemasOptions) (result *SchemasCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSchemasOptions, "listSchemasOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSparkEngineApplicationStatusOptions, "getSparkEngineApplicationStatusOptions") + err = core.ValidateStruct(listSchemasOptions, "listSchemasOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *getSparkEngineApplicationStatusOptions.EngineID, - "application_id": *getSparkEngineApplicationStatusOptions.ApplicationID, + "id": *listSchemasOptions.ID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/applications/{application_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{id}/schemas`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSparkEngineApplicationStatusOptions.Headers { + for headerName, headerValue := range listSchemasOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSparkEngineApplicationStatus") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListSchemas") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSparkEngineApplicationStatusOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSparkEngineApplicationStatusOptions.AuthInstanceID)) + if listSchemasOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSchemasOptions.AuthInstanceID)) } + builder.AddQuery("engine_id", fmt.Sprint(*listSchemasOptions.EngineID)) + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -7569,12 +8072,12 @@ func (watsonxData *WatsonxDataV2) GetSparkEngineApplicationStatusWithContext(ctx var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_spark_engine_application_status", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_schemas", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkEngineApplicationStatus) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSchemasCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7585,51 +8088,76 @@ func (watsonxData *WatsonxDataV2) GetSparkEngineApplicationStatusWithContext(ctx return } -// ListSparkEngineCatalogs : Get spark engine catalogs -// Get list of all catalogs attached to a spark engine. -func (watsonxData *WatsonxDataV2) ListSparkEngineCatalogs(listSparkEngineCatalogsOptions *ListSparkEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListSparkEngineCatalogsWithContext(context.Background(), listSparkEngineCatalogsOptions) +// CreateSchema : Create schema +// Create a new schema. +func (watsonxData *WatsonxDataV3) CreateSchema(createSchemaOptions *CreateSchemaOptions) (result *SchemaPrototype, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateSchemaWithContext(context.Background(), createSchemaOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSparkEngineCatalogsWithContext is an alternate form of the ListSparkEngineCatalogs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListSparkEngineCatalogsWithContext(ctx context.Context, listSparkEngineCatalogsOptions *ListSparkEngineCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSparkEngineCatalogsOptions, "listSparkEngineCatalogsOptions cannot be nil") +// CreateSchemaWithContext is an alternate form of the CreateSchema method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateSchemaWithContext(ctx context.Context, createSchemaOptions *CreateSchemaOptions) (result *SchemaPrototype, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSchemaOptions, "createSchemaOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listSparkEngineCatalogsOptions, "listSparkEngineCatalogsOptions") + err = core.ValidateStruct(createSchemaOptions, "createSchemaOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *listSparkEngineCatalogsOptions.EngineID, + "id": *createSchemaOptions.ID, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/catalogs`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{id}/schemas`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSparkEngineCatalogsOptions.Headers { + for headerName, headerValue := range createSchemaOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListSparkEngineCatalogs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateSchema") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listSparkEngineCatalogsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSparkEngineCatalogsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if createSchemaOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSchemaOptions.AuthInstanceID)) + } + + builder.AddQuery("engine_id", fmt.Sprint(*createSchemaOptions.EngineID)) + + body := make(map[string]interface{}) + if createSchemaOptions.CustomPath != nil { + body["custom_path"] = createSchemaOptions.CustomPath + } + if createSchemaOptions.Name != nil { + body["name"] = createSchemaOptions.Name + } + if createSchemaOptions.Hostname != nil { + body["hostname"] = createSchemaOptions.Hostname + } + if createSchemaOptions.Port != nil { + body["port"] = createSchemaOptions.Port + } + if createSchemaOptions.StorageName != nil { + body["storage_name"] = createSchemaOptions.StorageName + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -7641,12 +8169,12 @@ func (watsonxData *WatsonxDataV2) ListSparkEngineCatalogsWithContext(ctx context var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_spark_engine_catalogs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_schema", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSchemaPrototype) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7657,57 +8185,69 @@ func (watsonxData *WatsonxDataV2) ListSparkEngineCatalogsWithContext(ctx context return } -// CreateSparkEngineCatalogs : Associate catalogs to spark engine -// Associate one or more catalogs to a spark engine. -func (watsonxData *WatsonxDataV2) CreateSparkEngineCatalogs(createSparkEngineCatalogsOptions *CreateSparkEngineCatalogsOptions) (result *Catalog, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateSparkEngineCatalogsWithContext(context.Background(), createSparkEngineCatalogsOptions) +// UpdateSyncCatalog : External Iceberg table registration +// Synchronize the external Iceberg table registration for a catalog identified by catalog_id. +func (watsonxData *WatsonxDataV3) UpdateSyncCatalog(updateSyncCatalogOptions *UpdateSyncCatalogOptions) (result *SuccessResponsePrototype, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateSyncCatalogWithContext(context.Background(), updateSyncCatalogOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSparkEngineCatalogsWithContext is an alternate form of the CreateSparkEngineCatalogs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateSparkEngineCatalogsWithContext(ctx context.Context, createSparkEngineCatalogsOptions *CreateSparkEngineCatalogsOptions) (result *Catalog, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSparkEngineCatalogsOptions, "createSparkEngineCatalogsOptions cannot be nil") +// UpdateSyncCatalogWithContext is an alternate form of the UpdateSyncCatalog method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateSyncCatalogWithContext(ctx context.Context, updateSyncCatalogOptions *UpdateSyncCatalogOptions) (result *SuccessResponsePrototype, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSyncCatalogOptions, "updateSyncCatalogOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSparkEngineCatalogsOptions, "createSparkEngineCatalogsOptions") + err = core.ValidateStruct(updateSyncCatalogOptions, "updateSyncCatalogOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *createSparkEngineCatalogsOptions.EngineID, + "id": *updateSyncCatalogOptions.ID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/catalogs`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{id}/sync`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSparkEngineCatalogsOptions.Headers { + for headerName, headerValue := range updateSyncCatalogOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateSparkEngineCatalogs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateSyncCatalog") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if createSparkEngineCatalogsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSparkEngineCatalogsOptions.AuthInstanceID)) + if updateSyncCatalogOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateSyncCatalogOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if createSparkEngineCatalogsOptions.CatalogName != nil { - body["catalog_name"] = createSparkEngineCatalogsOptions.CatalogName + if updateSyncCatalogOptions.AutoAddNewTables != nil { + body["auto_add_new_tables"] = updateSyncCatalogOptions.AutoAddNewTables + } + if updateSyncCatalogOptions.RegisterNewTables != nil { + body["register_new_tables"] = updateSyncCatalogOptions.RegisterNewTables + } + if updateSyncCatalogOptions.SyncExistingTables != nil { + body["sync_existing_tables"] = updateSyncCatalogOptions.SyncExistingTables + } + if updateSyncCatalogOptions.SyncIcebergMd != nil { + body["sync_iceberg_md"] = updateSyncCatalogOptions.SyncIcebergMd + } + if updateSyncCatalogOptions.SyncPath != nil { + body["sync_path"] = updateSyncCatalogOptions.SyncPath } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -7724,12 +8264,12 @@ func (watsonxData *WatsonxDataV2) CreateSparkEngineCatalogsWithContext(ctx conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_spark_engine_catalogs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_sync_catalog", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponsePrototype) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7740,116 +8280,126 @@ func (watsonxData *WatsonxDataV2) CreateSparkEngineCatalogsWithContext(ctx conte return } -// DeleteSparkEngineCatalogs : Disassociate catalogs from a spark engine -// Disassociate one or more catalogs from a spark engine. -func (watsonxData *WatsonxDataV2) DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptions *DeleteSparkEngineCatalogsOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteSparkEngineCatalogsWithContext(context.Background(), deleteSparkEngineCatalogsOptions) +// GetCatalog : Get catalog properties by catalog_id +// Get catalog properties of a catalog identified by catalog_id. +func (watsonxData *WatsonxDataV3) GetCatalog(getCatalogOptions *GetCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetCatalogWithContext(context.Background(), getCatalogOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSparkEngineCatalogsWithContext is an alternate form of the DeleteSparkEngineCatalogs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteSparkEngineCatalogsWithContext(ctx context.Context, deleteSparkEngineCatalogsOptions *DeleteSparkEngineCatalogsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSparkEngineCatalogsOptions, "deleteSparkEngineCatalogsOptions cannot be nil") +// GetCatalogWithContext is an alternate form of the GetCatalog method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetCatalogWithContext(ctx context.Context, getCatalogOptions *GetCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getCatalogOptions, "getCatalogOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSparkEngineCatalogsOptions, "deleteSparkEngineCatalogsOptions") + err = core.ValidateStruct(getCatalogOptions, "getCatalogOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *deleteSparkEngineCatalogsOptions.EngineID, + "name": *getCatalogOptions.Name, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/catalogs`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSparkEngineCatalogsOptions.Headers { + for headerName, headerValue := range getCatalogOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteSparkEngineCatalogs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetCatalog") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteSparkEngineCatalogsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSparkEngineCatalogsOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + if getCatalogOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getCatalogOptions.AuthInstanceID)) } - builder.AddQuery("catalog_names", fmt.Sprint(*deleteSparkEngineCatalogsOptions.CatalogNames)) - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_spark_engine_catalogs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_catalog", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// GetSparkEngineCatalog : Get spark engine catalog -// Get catalog attached to spark engine. -func (watsonxData *WatsonxDataV2) GetSparkEngineCatalog(getSparkEngineCatalogOptions *GetSparkEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSparkEngineCatalogWithContext(context.Background(), getSparkEngineCatalogOptions) +// DeleteCatalog : Delete catalog catalog_id +// Delete catalog identified by catalog_id. +func (watsonxData *WatsonxDataV3) DeleteCatalog(deleteCatalogOptions *DeleteCatalogOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteCatalogWithContext(context.Background(), deleteCatalogOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSparkEngineCatalogWithContext is an alternate form of the GetSparkEngineCatalog method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSparkEngineCatalogWithContext(ctx context.Context, getSparkEngineCatalogOptions *GetSparkEngineCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSparkEngineCatalogOptions, "getSparkEngineCatalogOptions cannot be nil") +// DeleteCatalogWithContext is an alternate form of the DeleteCatalog method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteCatalogWithContext(ctx context.Context, deleteCatalogOptions *DeleteCatalogOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteCatalogOptions, "deleteCatalogOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSparkEngineCatalogOptions, "getSparkEngineCatalogOptions") + err = core.ValidateStruct(deleteCatalogOptions, "deleteCatalogOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *getSparkEngineCatalogOptions.EngineID, - "catalog_id": *getSparkEngineCatalogOptions.CatalogID, + "name": *deleteCatalogOptions.Name, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/catalogs/{catalog_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/catalogs/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSparkEngineCatalogOptions.Headers { + for headerName, headerValue := range deleteCatalogOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSparkEngineCatalog") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteCatalog") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if getSparkEngineCatalogOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSparkEngineCatalogOptions.AuthInstanceID)) + if deleteCatalogOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteCatalogOptions.AuthInstanceID)) + } + + if deleteCatalogOptions.SkipMdsCall != nil { + builder.AddQuery("skip_mds_call", fmt.Sprint(*deleteCatalogOptions.SkipMdsCall)) } request, err := builder.Build() @@ -7858,70 +8408,52 @@ func (watsonxData *WatsonxDataV2) GetSparkEngineCatalogWithContext(ctx context.C return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_spark_engine_catalog", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_catalog", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetSparkEngineHistoryServer : Get spark history server -// Get spark history server. -func (watsonxData *WatsonxDataV2) GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptions *GetSparkEngineHistoryServerOptions) (result *SparkHistoryServer, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSparkEngineHistoryServerWithContext(context.Background(), getSparkEngineHistoryServerOptions) +// ListMilvusServices : Get list of milvus services +// Get list milvus services. +func (watsonxData *WatsonxDataV3) ListMilvusServices(listMilvusServicesOptions *ListMilvusServicesOptions) (result *MilvusServiceCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListMilvusServicesWithContext(context.Background(), listMilvusServicesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSparkEngineHistoryServerWithContext is an alternate form of the GetSparkEngineHistoryServer method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSparkEngineHistoryServerWithContext(ctx context.Context, getSparkEngineHistoryServerOptions *GetSparkEngineHistoryServerOptions) (result *SparkHistoryServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSparkEngineHistoryServerOptions, "getSparkEngineHistoryServerOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getSparkEngineHistoryServerOptions, "getSparkEngineHistoryServerOptions") +// ListMilvusServicesWithContext is an alternate form of the ListMilvusServices method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListMilvusServicesWithContext(ctx context.Context, listMilvusServicesOptions *ListMilvusServicesOptions) (result *MilvusServiceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listMilvusServicesOptions, "listMilvusServicesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "engine_id": *getSparkEngineHistoryServerOptions.EngineID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/history_server`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSparkEngineHistoryServerOptions.Headers { + for headerName, headerValue := range listMilvusServicesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSparkEngineHistoryServer") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListMilvusServices") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSparkEngineHistoryServerOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSparkEngineHistoryServerOptions.AuthInstanceID)) + if listMilvusServicesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listMilvusServicesOptions.AuthInstanceID)) } request, err := builder.Build() @@ -7933,12 +8465,12 @@ func (watsonxData *WatsonxDataV2) GetSparkEngineHistoryServerWithContext(ctx con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_spark_engine_history_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_milvus_services", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkHistoryServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusServiceCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -7949,60 +8481,158 @@ func (watsonxData *WatsonxDataV2) GetSparkEngineHistoryServerWithContext(ctx con return } -// StartSparkEngineHistoryServer : Start spark history server -// Start spark history server. -func (watsonxData *WatsonxDataV2) StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptions *StartSparkEngineHistoryServerOptions) (result *SparkHistoryServer, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.StartSparkEngineHistoryServerWithContext(context.Background(), startSparkEngineHistoryServerOptions) +// CreateMilvusService : Create milvus service +// Create milvus service. +func (watsonxData *WatsonxDataV3) CreateMilvusService(createMilvusServiceOptions *CreateMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateMilvusServiceWithContext(context.Background(), createMilvusServiceOptions) err = core.RepurposeSDKProblem(err, "") return } -// StartSparkEngineHistoryServerWithContext is an alternate form of the StartSparkEngineHistoryServer method which supports a Context parameter -func (watsonxData *WatsonxDataV2) StartSparkEngineHistoryServerWithContext(ctx context.Context, startSparkEngineHistoryServerOptions *StartSparkEngineHistoryServerOptions) (result *SparkHistoryServer, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(startSparkEngineHistoryServerOptions, "startSparkEngineHistoryServerOptions cannot be nil") +// CreateMilvusServiceWithContext is an alternate form of the CreateMilvusService method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateMilvusServiceWithContext(ctx context.Context, createMilvusServiceOptions *CreateMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createMilvusServiceOptions, "createMilvusServiceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(startSparkEngineHistoryServerOptions, "startSparkEngineHistoryServerOptions") + err = core.ValidateStruct(createMilvusServiceOptions, "createMilvusServiceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "engine_id": *startSparkEngineHistoryServerOptions.EngineID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/history_server`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range startSparkEngineHistoryServerOptions.Headers { + for headerName, headerValue := range createMilvusServiceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "StartSparkEngineHistoryServer") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateMilvusService") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if startSparkEngineHistoryServerOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*startSparkEngineHistoryServerOptions.AuthInstanceID)) + if createMilvusServiceOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createMilvusServiceOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if startSparkEngineHistoryServerOptions.Cores != nil { - body["cores"] = startSparkEngineHistoryServerOptions.Cores + if createMilvusServiceOptions.DisplayName != nil { + body["display_name"] = createMilvusServiceOptions.DisplayName } - if startSparkEngineHistoryServerOptions.Memory != nil { - body["memory"] = startSparkEngineHistoryServerOptions.Memory + if createMilvusServiceOptions.Origin != nil { + body["origin"] = createMilvusServiceOptions.Origin + } + if createMilvusServiceOptions.RootPath != nil { + body["root_path"] = createMilvusServiceOptions.RootPath + } + if createMilvusServiceOptions.TshirtSize != nil { + body["tshirt_size"] = createMilvusServiceOptions.TshirtSize + } + if createMilvusServiceOptions.DcCpu != nil { + body["dc_cpu"] = createMilvusServiceOptions.DcCpu + } + if createMilvusServiceOptions.DcMemory != nil { + body["dc_memory"] = createMilvusServiceOptions.DcMemory + } + if createMilvusServiceOptions.DcReplicas != nil { + body["dc_replicas"] = createMilvusServiceOptions.DcReplicas + } + if createMilvusServiceOptions.Description != nil { + body["description"] = createMilvusServiceOptions.Description + } + if createMilvusServiceOptions.DwCpu != nil { + body["dw_cpu"] = createMilvusServiceOptions.DwCpu + } + if createMilvusServiceOptions.DwMemory != nil { + body["dw_memory"] = createMilvusServiceOptions.DwMemory + } + if createMilvusServiceOptions.DwReplicas != nil { + body["dw_replicas"] = createMilvusServiceOptions.DwReplicas + } + if createMilvusServiceOptions.EtcdCpu != nil { + body["etcd_cpu"] = createMilvusServiceOptions.EtcdCpu + } + if createMilvusServiceOptions.EtcdMemory != nil { + body["etcd_memory"] = createMilvusServiceOptions.EtcdMemory + } + if createMilvusServiceOptions.ID != nil { + body["id"] = createMilvusServiceOptions.ID + } + if createMilvusServiceOptions.IndexType != nil { + body["index_type"] = createMilvusServiceOptions.IndexType + } + if createMilvusServiceOptions.IwCpu != nil { + body["iw_cpu"] = createMilvusServiceOptions.IwCpu + } + if createMilvusServiceOptions.IwMemory != nil { + body["iw_memory"] = createMilvusServiceOptions.IwMemory + } + if createMilvusServiceOptions.IwReplicas != nil { + body["iw_replicas"] = createMilvusServiceOptions.IwReplicas + } + if createMilvusServiceOptions.KafkaCpu != nil { + body["kafka_cpu"] = createMilvusServiceOptions.KafkaCpu + } + if createMilvusServiceOptions.KafkaMemory != nil { + body["kafka_memory"] = createMilvusServiceOptions.KafkaMemory + } + if createMilvusServiceOptions.ProxyCpu != nil { + body["proxy_cpu"] = createMilvusServiceOptions.ProxyCpu + } + if createMilvusServiceOptions.ProxyMemory != nil { + body["proxy_memory"] = createMilvusServiceOptions.ProxyMemory + } + if createMilvusServiceOptions.ProxyReplicas != nil { + body["proxy_replicas"] = createMilvusServiceOptions.ProxyReplicas + } + if createMilvusServiceOptions.QcCpu != nil { + body["qc_cpu"] = createMilvusServiceOptions.QcCpu + } + if createMilvusServiceOptions.QcMemory != nil { + body["qc_memory"] = createMilvusServiceOptions.QcMemory + } + if createMilvusServiceOptions.QcReplicas != nil { + body["qc_replicas"] = createMilvusServiceOptions.QcReplicas + } + if createMilvusServiceOptions.QwCpu != nil { + body["qw_cpu"] = createMilvusServiceOptions.QwCpu + } + if createMilvusServiceOptions.QwMemory != nil { + body["qw_memory"] = createMilvusServiceOptions.QwMemory + } + if createMilvusServiceOptions.QwReplicas != nil { + body["qw_replicas"] = createMilvusServiceOptions.QwReplicas + } + if createMilvusServiceOptions.RcCpu != nil { + body["rc_cpu"] = createMilvusServiceOptions.RcCpu + } + if createMilvusServiceOptions.RcMemory != nil { + body["rc_memory"] = createMilvusServiceOptions.RcMemory + } + if createMilvusServiceOptions.RcReplicas != nil { + body["rc_replicas"] = createMilvusServiceOptions.RcReplicas + } + if createMilvusServiceOptions.StorageName != nil { + body["storage_name"] = createMilvusServiceOptions.StorageName + } + if createMilvusServiceOptions.Tags != nil { + body["tags"] = createMilvusServiceOptions.Tags + } + if createMilvusServiceOptions.Vector != nil { + body["vector"] = createMilvusServiceOptions.Vector + } + if createMilvusServiceOptions.VectorDimension != nil { + body["vector_dimension"] = createMilvusServiceOptions.VectorDimension } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -8019,12 +8649,12 @@ func (watsonxData *WatsonxDataV2) StartSparkEngineHistoryServerWithContext(ctx c var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "start_spark_engine_history_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_milvus_service", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSparkHistoryServer) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusService) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8035,50 +8665,51 @@ func (watsonxData *WatsonxDataV2) StartSparkEngineHistoryServerWithContext(ctx c return } -// DeleteSparkEngineHistoryServer : Stop spark history server -// Stop spark history server. -func (watsonxData *WatsonxDataV2) DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptions *DeleteSparkEngineHistoryServerOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteSparkEngineHistoryServerWithContext(context.Background(), deleteSparkEngineHistoryServerOptions) +// GetMilvusService : Get milvus service +// Get milvus service. +func (watsonxData *WatsonxDataV3) GetMilvusService(getMilvusServiceOptions *GetMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetMilvusServiceWithContext(context.Background(), getMilvusServiceOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSparkEngineHistoryServerWithContext is an alternate form of the DeleteSparkEngineHistoryServer method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteSparkEngineHistoryServerWithContext(ctx context.Context, deleteSparkEngineHistoryServerOptions *DeleteSparkEngineHistoryServerOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSparkEngineHistoryServerOptions, "deleteSparkEngineHistoryServerOptions cannot be nil") +// GetMilvusServiceWithContext is an alternate form of the GetMilvusService method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetMilvusServiceWithContext(ctx context.Context, getMilvusServiceOptions *GetMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getMilvusServiceOptions, "getMilvusServiceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSparkEngineHistoryServerOptions, "deleteSparkEngineHistoryServerOptions") + err = core.ValidateStruct(getMilvusServiceOptions, "getMilvusServiceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *deleteSparkEngineHistoryServerOptions.EngineID, + "id": *getMilvusServiceOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/history_server`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSparkEngineHistoryServerOptions.Headers { + for headerName, headerValue := range getMilvusServiceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteSparkEngineHistoryServer") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetMilvusService") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteSparkEngineHistoryServerOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSparkEngineHistoryServerOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + if getMilvusServiceOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getMilvusServiceOptions.AuthInstanceID)) } request, err := builder.Build() @@ -8087,72 +8718,69 @@ func (watsonxData *WatsonxDataV2) DeleteSparkEngineHistoryServerWithContext(ctx return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_spark_engine_history_server", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_milvus_service", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusService) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// PauseSparkEngine : Pause engine -// Pause engine. -func (watsonxData *WatsonxDataV2) PauseSparkEngine(pauseSparkEngineOptions *PauseSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.PauseSparkEngineWithContext(context.Background(), pauseSparkEngineOptions) +// DeleteMilvusService : Delete milvus service +// Delete milvus service. +func (watsonxData *WatsonxDataV3) DeleteMilvusService(deleteMilvusServiceOptions *DeleteMilvusServiceOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteMilvusServiceWithContext(context.Background(), deleteMilvusServiceOptions) err = core.RepurposeSDKProblem(err, "") return } -// PauseSparkEngineWithContext is an alternate form of the PauseSparkEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) PauseSparkEngineWithContext(ctx context.Context, pauseSparkEngineOptions *PauseSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(pauseSparkEngineOptions, "pauseSparkEngineOptions cannot be nil") +// DeleteMilvusServiceWithContext is an alternate form of the DeleteMilvusService method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteMilvusServiceWithContext(ctx context.Context, deleteMilvusServiceOptions *DeleteMilvusServiceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteMilvusServiceOptions, "deleteMilvusServiceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(pauseSparkEngineOptions, "pauseSparkEngineOptions") + err = core.ValidateStruct(deleteMilvusServiceOptions, "deleteMilvusServiceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *pauseSparkEngineOptions.EngineID, + "id": *deleteMilvusServiceOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/pause`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range pauseSparkEngineOptions.Headers { + for headerName, headerValue := range deleteMilvusServiceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "PauseSparkEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteMilvusService") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if pauseSparkEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*pauseSparkEngineOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if pauseSparkEngineOptions.Force != nil { - body["force"] = pauseSparkEngineOptions.Force - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if deleteMilvusServiceOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteMilvusServiceOptions.AuthInstanceID)) } request, err := builder.Build() @@ -8161,87 +8789,85 @@ func (watsonxData *WatsonxDataV2) PauseSparkEngineWithContext(ctx context.Contex return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "pause_spark_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_milvus_service", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ResumeSparkEngine : Resume engine -// Resume engine. -func (watsonxData *WatsonxDataV2) ResumeSparkEngine(resumeSparkEngineOptions *ResumeSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ResumeSparkEngineWithContext(context.Background(), resumeSparkEngineOptions) +// UpdateMilvusService : Update milvus service +// Update details of milvus service. +func (watsonxData *WatsonxDataV3) UpdateMilvusService(updateMilvusServiceOptions *UpdateMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateMilvusServiceWithContext(context.Background(), updateMilvusServiceOptions) err = core.RepurposeSDKProblem(err, "") return } -// ResumeSparkEngineWithContext is an alternate form of the ResumeSparkEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ResumeSparkEngineWithContext(ctx context.Context, resumeSparkEngineOptions *ResumeSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(resumeSparkEngineOptions, "resumeSparkEngineOptions cannot be nil") +// UpdateMilvusServiceWithContext is an alternate form of the UpdateMilvusService method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateMilvusServiceWithContext(ctx context.Context, updateMilvusServiceOptions *UpdateMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateMilvusServiceOptions, "updateMilvusServiceOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(resumeSparkEngineOptions, "resumeSparkEngineOptions") + err = core.ValidateStruct(updateMilvusServiceOptions, "updateMilvusServiceOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *resumeSparkEngineOptions.EngineID, + "id": *updateMilvusServiceOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/resume`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range resumeSparkEngineOptions.Headers { + for headerName, headerValue := range updateMilvusServiceOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ResumeSparkEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateMilvusService") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if resumeSparkEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*resumeSparkEngineOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/merge-patch+json") + if updateMilvusServiceOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateMilvusServiceOptions.AuthInstanceID)) } - request, err := builder.Build() + _, err = builder.SetBodyContentJSON(updateMilvusServiceOptions.Body) if err != nil { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } + + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "resume_spark_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_milvus_service", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusService) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8252,62 +8878,51 @@ func (watsonxData *WatsonxDataV2) ResumeSparkEngineWithContext(ctx context.Conte return } -// ScaleSparkEngine : Scale Spark engine -// Scale Saprk engine. -func (watsonxData *WatsonxDataV2) ScaleSparkEngine(scaleSparkEngineOptions *ScaleSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ScaleSparkEngineWithContext(context.Background(), scaleSparkEngineOptions) +// CreateMilvusServicePause : Pause milvus service +// Pause a running milvus service. +func (watsonxData *WatsonxDataV3) CreateMilvusServicePause(createMilvusServicePauseOptions *CreateMilvusServicePauseOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateMilvusServicePauseWithContext(context.Background(), createMilvusServicePauseOptions) err = core.RepurposeSDKProblem(err, "") return } -// ScaleSparkEngineWithContext is an alternate form of the ScaleSparkEngine method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ScaleSparkEngineWithContext(ctx context.Context, scaleSparkEngineOptions *ScaleSparkEngineOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(scaleSparkEngineOptions, "scaleSparkEngineOptions cannot be nil") +// CreateMilvusServicePauseWithContext is an alternate form of the CreateMilvusServicePause method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateMilvusServicePauseWithContext(ctx context.Context, createMilvusServicePauseOptions *CreateMilvusServicePauseOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createMilvusServicePauseOptions, "createMilvusServicePauseOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(scaleSparkEngineOptions, "scaleSparkEngineOptions") + err = core.ValidateStruct(createMilvusServicePauseOptions, "createMilvusServicePauseOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "engine_id": *scaleSparkEngineOptions.EngineID, + "id": *createMilvusServicePauseOptions.ID, } builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_engines/{engine_id}/scale`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services/{id}/pause`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range scaleSparkEngineOptions.Headers { + for headerName, headerValue := range createMilvusServicePauseOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ScaleSparkEngine") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateMilvusServicePause") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if scaleSparkEngineOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*scaleSparkEngineOptions.AuthInstanceID)) - } - - body := make(map[string]interface{}) - if scaleSparkEngineOptions.NumberOfNodes != nil { - body["number_of_nodes"] = scaleSparkEngineOptions.NumberOfNodes - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if createMilvusServicePauseOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createMilvusServicePauseOptions.AuthInstanceID)) } request, err := builder.Build() @@ -8319,7 +8934,7 @@ func (watsonxData *WatsonxDataV2) ScaleSparkEngineWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "scale_spark_engine", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_milvus_service_pause", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -8335,42 +8950,51 @@ func (watsonxData *WatsonxDataV2) ScaleSparkEngineWithContext(ctx context.Contex return } -// ListSparkVersions : List spark version -// List spark version. -func (watsonxData *WatsonxDataV2) ListSparkVersions(listSparkVersionsOptions *ListSparkVersionsOptions) (result *ListSparkVersionsOKBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListSparkVersionsWithContext(context.Background(), listSparkVersionsOptions) +// CreateMilvusServiceResume : Resume milvus service +// Resume a paused milvus service. +func (watsonxData *WatsonxDataV3) CreateMilvusServiceResume(createMilvusServiceResumeOptions *CreateMilvusServiceResumeOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateMilvusServiceResumeWithContext(context.Background(), createMilvusServiceResumeOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSparkVersionsWithContext is an alternate form of the ListSparkVersions method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListSparkVersionsWithContext(ctx context.Context, listSparkVersionsOptions *ListSparkVersionsOptions) (result *ListSparkVersionsOKBody, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listSparkVersionsOptions, "listSparkVersionsOptions") +// CreateMilvusServiceResumeWithContext is an alternate form of the CreateMilvusServiceResume method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateMilvusServiceResumeWithContext(ctx context.Context, createMilvusServiceResumeOptions *CreateMilvusServiceResumeOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createMilvusServiceResumeOptions, "createMilvusServiceResumeOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createMilvusServiceResumeOptions, "createMilvusServiceResumeOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *createMilvusServiceResumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/spark_versions`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services/{id}/resume`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSparkVersionsOptions.Headers { + for headerName, headerValue := range createMilvusServiceResumeOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListSparkVersions") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateMilvusServiceResume") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listSparkVersionsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSparkVersionsOptions.AuthInstanceID)) + if createMilvusServiceResumeOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createMilvusServiceResumeOptions.AuthInstanceID)) } request, err := builder.Build() @@ -8382,12 +9006,12 @@ func (watsonxData *WatsonxDataV2) ListSparkVersionsWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_spark_versions", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_milvus_service_resume", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalListSparkVersionsOKBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8398,42 +9022,146 @@ func (watsonxData *WatsonxDataV2) ListSparkVersionsWithContext(ctx context.Conte return } -// ListCatalogs : List all registered catalogs -// List all registered catalogs. -func (watsonxData *WatsonxDataV2) ListCatalogs(listCatalogsOptions *ListCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListCatalogsWithContext(context.Background(), listCatalogsOptions) +// CreateMilvusServiceScale : Scale a milvus service +// Scale an existing milvus service. +func (watsonxData *WatsonxDataV3) CreateMilvusServiceScale(createMilvusServiceScaleOptions *CreateMilvusServiceScaleOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateMilvusServiceScaleWithContext(context.Background(), createMilvusServiceScaleOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListCatalogsWithContext is an alternate form of the ListCatalogs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListCatalogsWithContext(ctx context.Context, listCatalogsOptions *ListCatalogsOptions) (result *CatalogCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listCatalogsOptions, "listCatalogsOptions") +// CreateMilvusServiceScaleWithContext is an alternate form of the CreateMilvusServiceScale method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateMilvusServiceScaleWithContext(ctx context.Context, createMilvusServiceScaleOptions *CreateMilvusServiceScaleOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createMilvusServiceScaleOptions, "createMilvusServiceScaleOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(createMilvusServiceScaleOptions, "createMilvusServiceScaleOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "id": *createMilvusServiceScaleOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services/{id}/scale`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listCatalogsOptions.Headers { + for headerName, headerValue := range createMilvusServiceScaleOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListCatalogs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateMilvusServiceScale") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listCatalogsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listCatalogsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if createMilvusServiceScaleOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createMilvusServiceScaleOptions.AuthInstanceID)) + } + + body := make(map[string]interface{}) + if createMilvusServiceScaleOptions.TshirtSize != nil { + body["tshirt_size"] = createMilvusServiceScaleOptions.TshirtSize + } + if createMilvusServiceScaleOptions.DcCpu != nil { + body["dc_cpu"] = createMilvusServiceScaleOptions.DcCpu + } + if createMilvusServiceScaleOptions.DcMemory != nil { + body["dc_memory"] = createMilvusServiceScaleOptions.DcMemory + } + if createMilvusServiceScaleOptions.DcReplicas != nil { + body["dc_replicas"] = createMilvusServiceScaleOptions.DcReplicas + } + if createMilvusServiceScaleOptions.DwCpu != nil { + body["dw_cpu"] = createMilvusServiceScaleOptions.DwCpu + } + if createMilvusServiceScaleOptions.DwMemory != nil { + body["dw_memory"] = createMilvusServiceScaleOptions.DwMemory + } + if createMilvusServiceScaleOptions.DwReplicas != nil { + body["dw_replicas"] = createMilvusServiceScaleOptions.DwReplicas + } + if createMilvusServiceScaleOptions.EtcdCpu != nil { + body["etcd_cpu"] = createMilvusServiceScaleOptions.EtcdCpu + } + if createMilvusServiceScaleOptions.EtcdMemory != nil { + body["etcd_memory"] = createMilvusServiceScaleOptions.EtcdMemory + } + if createMilvusServiceScaleOptions.IndexType != nil { + body["index_type"] = createMilvusServiceScaleOptions.IndexType + } + if createMilvusServiceScaleOptions.IwCpu != nil { + body["iw_cpu"] = createMilvusServiceScaleOptions.IwCpu + } + if createMilvusServiceScaleOptions.IwMemory != nil { + body["iw_memory"] = createMilvusServiceScaleOptions.IwMemory + } + if createMilvusServiceScaleOptions.IwReplicas != nil { + body["iw_replicas"] = createMilvusServiceScaleOptions.IwReplicas + } + if createMilvusServiceScaleOptions.KafkaCpu != nil { + body["kafka_cpu"] = createMilvusServiceScaleOptions.KafkaCpu + } + if createMilvusServiceScaleOptions.KafkaMemory != nil { + body["kafka_memory"] = createMilvusServiceScaleOptions.KafkaMemory + } + if createMilvusServiceScaleOptions.ProxyCpu != nil { + body["proxy_cpu"] = createMilvusServiceScaleOptions.ProxyCpu + } + if createMilvusServiceScaleOptions.ProxyMemory != nil { + body["proxy_memory"] = createMilvusServiceScaleOptions.ProxyMemory + } + if createMilvusServiceScaleOptions.ProxyReplicas != nil { + body["proxy_replicas"] = createMilvusServiceScaleOptions.ProxyReplicas + } + if createMilvusServiceScaleOptions.QcCpu != nil { + body["qc_cpu"] = createMilvusServiceScaleOptions.QcCpu + } + if createMilvusServiceScaleOptions.QcMemory != nil { + body["qc_memory"] = createMilvusServiceScaleOptions.QcMemory + } + if createMilvusServiceScaleOptions.QcReplicas != nil { + body["qc_replicas"] = createMilvusServiceScaleOptions.QcReplicas + } + if createMilvusServiceScaleOptions.QwCpu != nil { + body["qw_cpu"] = createMilvusServiceScaleOptions.QwCpu + } + if createMilvusServiceScaleOptions.QwMemory != nil { + body["qw_memory"] = createMilvusServiceScaleOptions.QwMemory + } + if createMilvusServiceScaleOptions.QwReplicas != nil { + body["qw_replicas"] = createMilvusServiceScaleOptions.QwReplicas + } + if createMilvusServiceScaleOptions.RcCpu != nil { + body["rc_cpu"] = createMilvusServiceScaleOptions.RcCpu + } + if createMilvusServiceScaleOptions.RcMemory != nil { + body["rc_memory"] = createMilvusServiceScaleOptions.RcMemory + } + if createMilvusServiceScaleOptions.RcReplicas != nil { + body["rc_replicas"] = createMilvusServiceScaleOptions.RcReplicas + } + if createMilvusServiceScaleOptions.Vector != nil { + body["vector"] = createMilvusServiceScaleOptions.Vector + } + if createMilvusServiceScaleOptions.VectorDimension != nil { + body["vector_dimension"] = createMilvusServiceScaleOptions.VectorDimension + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -8445,12 +9173,12 @@ func (watsonxData *WatsonxDataV2) ListCatalogsWithContext(ctx context.Context, l var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_catalogs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_milvus_service_scale", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8461,51 +9189,51 @@ func (watsonxData *WatsonxDataV2) ListCatalogsWithContext(ctx context.Context, l return } -// GetCatalog : Get catalog properties by catalog_id -// Get catalog properties of a catalog identified by catalog_id. -func (watsonxData *WatsonxDataV2) GetCatalog(getCatalogOptions *GetCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetCatalogWithContext(context.Background(), getCatalogOptions) +// ListMilvusServiceDatabases : Get milvus service databases +// Get milvus service databases. +func (watsonxData *WatsonxDataV3) ListMilvusServiceDatabases(listMilvusServiceDatabasesOptions *ListMilvusServiceDatabasesOptions) (result *MilvusServiceDatabases, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListMilvusServiceDatabasesWithContext(context.Background(), listMilvusServiceDatabasesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetCatalogWithContext is an alternate form of the GetCatalog method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetCatalogWithContext(ctx context.Context, getCatalogOptions *GetCatalogOptions) (result *Catalog, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getCatalogOptions, "getCatalogOptions cannot be nil") +// ListMilvusServiceDatabasesWithContext is an alternate form of the ListMilvusServiceDatabases method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListMilvusServiceDatabasesWithContext(ctx context.Context, listMilvusServiceDatabasesOptions *ListMilvusServiceDatabasesOptions) (result *MilvusServiceDatabases, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listMilvusServiceDatabasesOptions, "listMilvusServiceDatabasesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getCatalogOptions, "getCatalogOptions") + err = core.ValidateStruct(listMilvusServiceDatabasesOptions, "listMilvusServiceDatabasesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "catalog_id": *getCatalogOptions.CatalogID, + "service_id": *listMilvusServiceDatabasesOptions.ServiceID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services/{service_id}/databases`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getCatalogOptions.Headers { + for headerName, headerValue := range listMilvusServiceDatabasesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetCatalog") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListMilvusServiceDatabases") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getCatalogOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getCatalogOptions.AuthInstanceID)) + if listMilvusServiceDatabasesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listMilvusServiceDatabasesOptions.AuthInstanceID)) } request, err := builder.Build() @@ -8517,12 +9245,12 @@ func (watsonxData *WatsonxDataV2) GetCatalogWithContext(ctx context.Context, get var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_catalog", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_milvus_service_databases", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalog) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusServiceDatabases) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8533,55 +9261,54 @@ func (watsonxData *WatsonxDataV2) GetCatalogWithContext(ctx context.Context, get return } -// ListSchemas : List all schemas -// List all schemas in catalog. -func (watsonxData *WatsonxDataV2) ListSchemas(listSchemasOptions *ListSchemasOptions) (result *ListSchemasOKBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListSchemasWithContext(context.Background(), listSchemasOptions) +// ListMilvusDatabaseCollections : Get milvus database collections +// Get milvus database collections. +func (watsonxData *WatsonxDataV3) ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptions *ListMilvusDatabaseCollectionsOptions) (result *MilvusDatabaseCollections, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListMilvusDatabaseCollectionsWithContext(context.Background(), listMilvusDatabaseCollectionsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListSchemasWithContext is an alternate form of the ListSchemas method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListSchemasWithContext(ctx context.Context, listSchemasOptions *ListSchemasOptions) (result *ListSchemasOKBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listSchemasOptions, "listSchemasOptions cannot be nil") +// ListMilvusDatabaseCollectionsWithContext is an alternate form of the ListMilvusDatabaseCollections method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListMilvusDatabaseCollectionsWithContext(ctx context.Context, listMilvusDatabaseCollectionsOptions *ListMilvusDatabaseCollectionsOptions) (result *MilvusDatabaseCollections, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listMilvusDatabaseCollectionsOptions, "listMilvusDatabaseCollectionsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listSchemasOptions, "listSchemasOptions") + err = core.ValidateStruct(listMilvusDatabaseCollectionsOptions, "listMilvusDatabaseCollectionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "catalog_id": *listSchemasOptions.CatalogID, + "service_id": *listMilvusDatabaseCollectionsOptions.ServiceID, + "database_id": *listMilvusDatabaseCollectionsOptions.DatabaseID, } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services/{service_id}/databases/{database_id}/collections`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listSchemasOptions.Headers { + for headerName, headerValue := range listMilvusDatabaseCollectionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListSchemas") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListMilvusDatabaseCollections") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listSchemasOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSchemasOptions.AuthInstanceID)) + if listMilvusDatabaseCollectionsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listMilvusDatabaseCollectionsOptions.AuthInstanceID)) } - builder.AddQuery("engine_id", fmt.Sprint(*listSchemasOptions.EngineID)) - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -8591,12 +9318,12 @@ func (watsonxData *WatsonxDataV2) ListSchemasWithContext(ctx context.Context, li var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_schemas", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_milvus_database_collections", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalListSchemasOKBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusDatabaseCollections) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8607,76 +9334,53 @@ func (watsonxData *WatsonxDataV2) ListSchemasWithContext(ctx context.Context, li return } -// CreateSchema : Create schema -// Create a new schema. -func (watsonxData *WatsonxDataV2) CreateSchema(createSchemaOptions *CreateSchemaOptions) (result *CreateSchemaCreatedBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateSchemaWithContext(context.Background(), createSchemaOptions) +// ListMilvusDatabasePartitions : Get milvus database collection partitions +// Get milvus database collection partitions. +func (watsonxData *WatsonxDataV3) ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptions *ListMilvusDatabasePartitionsOptions) (result *MilvusDatabasePartitions, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListMilvusDatabasePartitionsWithContext(context.Background(), listMilvusDatabasePartitionsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateSchemaWithContext is an alternate form of the CreateSchema method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateSchemaWithContext(ctx context.Context, createSchemaOptions *CreateSchemaOptions) (result *CreateSchemaCreatedBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createSchemaOptions, "createSchemaOptions cannot be nil") +// ListMilvusDatabasePartitionsWithContext is an alternate form of the ListMilvusDatabasePartitions method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListMilvusDatabasePartitionsWithContext(ctx context.Context, listMilvusDatabasePartitionsOptions *ListMilvusDatabasePartitionsOptions) (result *MilvusDatabasePartitions, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listMilvusDatabasePartitionsOptions, "listMilvusDatabasePartitionsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createSchemaOptions, "createSchemaOptions") + err = core.ValidateStruct(listMilvusDatabasePartitionsOptions, "listMilvusDatabasePartitionsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "catalog_id": *createSchemaOptions.CatalogID, + "service_id": *listMilvusDatabasePartitionsOptions.ServiceID, + "database_id": *listMilvusDatabasePartitionsOptions.DatabaseID, + "collection_name": *listMilvusDatabasePartitionsOptions.CollectionName, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services/{service_id}/databases/{database_id}/collections/{collection_name}/partitions`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createSchemaOptions.Headers { + for headerName, headerValue := range listMilvusDatabasePartitionsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateSchema") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListMilvusDatabasePartitions") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createSchemaOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSchemaOptions.AuthInstanceID)) - } - - builder.AddQuery("engine_id", fmt.Sprint(*createSchemaOptions.EngineID)) - - body := make(map[string]interface{}) - if createSchemaOptions.CustomPath != nil { - body["custom_path"] = createSchemaOptions.CustomPath - } - if createSchemaOptions.SchemaName != nil { - body["schema_name"] = createSchemaOptions.SchemaName - } - if createSchemaOptions.BucketName != nil { - body["bucket_name"] = createSchemaOptions.BucketName - } - if createSchemaOptions.Hostname != nil { - body["hostname"] = createSchemaOptions.Hostname - } - if createSchemaOptions.Port != nil { - body["port"] = createSchemaOptions.Port - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listMilvusDatabasePartitionsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listMilvusDatabasePartitionsOptions.AuthInstanceID)) } request, err := builder.Build() @@ -8688,12 +9392,12 @@ func (watsonxData *WatsonxDataV2) CreateSchemaWithContext(ctx context.Context, c var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_schema", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_milvus_database_partitions", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCreateSchemaCreatedBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusDatabasePartitions) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8704,54 +9408,59 @@ func (watsonxData *WatsonxDataV2) CreateSchemaWithContext(ctx context.Context, c return } -// DeleteSchema : Delete schema -// Delete a schema. -func (watsonxData *WatsonxDataV2) DeleteSchema(deleteSchemaOptions *DeleteSchemaOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteSchemaWithContext(context.Background(), deleteSchemaOptions) +// UpdateMilvusServiceBucket : Update milvus service storage +// Update details of milvus service bucket. +func (watsonxData *WatsonxDataV3) UpdateMilvusServiceBucket(updateMilvusServiceBucketOptions *UpdateMilvusServiceBucketOptions) (result *MilvusService, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateMilvusServiceBucketWithContext(context.Background(), updateMilvusServiceBucketOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteSchemaWithContext is an alternate form of the DeleteSchema method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteSchemaWithContext(ctx context.Context, deleteSchemaOptions *DeleteSchemaOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteSchemaOptions, "deleteSchemaOptions cannot be nil") +// UpdateMilvusServiceBucketWithContext is an alternate form of the UpdateMilvusServiceBucket method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateMilvusServiceBucketWithContext(ctx context.Context, updateMilvusServiceBucketOptions *UpdateMilvusServiceBucketOptions) (result *MilvusService, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateMilvusServiceBucketOptions, "updateMilvusServiceBucketOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteSchemaOptions, "deleteSchemaOptions") + err = core.ValidateStruct(updateMilvusServiceBucketOptions, "updateMilvusServiceBucketOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "catalog_id": *deleteSchemaOptions.CatalogID, - "schema_id": *deleteSchemaOptions.SchemaID, + "service_id": *updateMilvusServiceBucketOptions.ServiceID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/milvus_services/{service_id}/storage`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteSchemaOptions.Headers { + for headerName, headerValue := range updateMilvusServiceBucketOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteSchema") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateMilvusServiceBucket") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteSchemaOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSchemaOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json-patch+json") + if updateMilvusServiceBucketOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateMilvusServiceBucketOptions.AuthInstanceID)) } - builder.AddQuery("engine_id", fmt.Sprint(*deleteSchemaOptions.EngineID)) + _, err = builder.SetBodyContentJSON(updateMilvusServiceBucketOptions.Body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } request, err := builder.Build() if err != nil { @@ -8759,66 +9468,63 @@ func (watsonxData *WatsonxDataV2) DeleteSchemaWithContext(ctx context.Context, d return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_schema", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_milvus_service_bucket", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusService) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// ListTables : List all tables -// List all tables in a schema in a catalog for a given engine. -func (watsonxData *WatsonxDataV2) ListTables(listTablesOptions *ListTablesOptions) (result *TableCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListTablesWithContext(context.Background(), listTablesOptions) +// GetSalIntegration : Get semantic automation layer Integration of the instance +// Get basic details of the semantic automation layer(SAL) integration with IBM Knowledge Catalog(IKC). +func (watsonxData *WatsonxDataV3) GetSalIntegration(getSalIntegrationOptions *GetSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetSalIntegrationWithContext(context.Background(), getSalIntegrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListTablesWithContext is an alternate form of the ListTables method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListTablesWithContext(ctx context.Context, listTablesOptions *ListTablesOptions) (result *TableCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listTablesOptions, "listTablesOptions cannot be nil") +// GetSalIntegrationWithContext is an alternate form of the GetSalIntegration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSalIntegrationWithContext(ctx context.Context, getSalIntegrationOptions *GetSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(getSalIntegrationOptions, "getSalIntegrationOptions") if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - err = core.ValidateStruct(listTablesOptions, "listTablesOptions") - if err != nil { - err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) - return - } - - pathParamsMap := map[string]string{ - "catalog_id": *listTablesOptions.CatalogID, - "schema_id": *listTablesOptions.SchemaID, - } builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/tables`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listTablesOptions.Headers { + for headerName, headerValue := range getSalIntegrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListTables") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSalIntegration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listTablesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listTablesOptions.AuthInstanceID)) + if getSalIntegrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationOptions.AuthInstanceID)) } - builder.AddQuery("engine_id", fmt.Sprint(*listTablesOptions.EngineID)) - request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -8828,12 +9534,12 @@ func (watsonxData *WatsonxDataV2) ListTablesWithContext(ctx context.Context, lis var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_tables", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_sal_integration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTableCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8844,58 +9550,70 @@ func (watsonxData *WatsonxDataV2) ListTablesWithContext(ctx context.Context, lis return } -// GetTable : Get table details -// Get details of a given table in a catalog and schema. -func (watsonxData *WatsonxDataV2) GetTable(getTableOptions *GetTableOptions) (result *Table, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetTableWithContext(context.Background(), getTableOptions) +// CreateSalIntegration : Create semantic automation layer integration with IBM Knowledge Catalog +// Create semantic automation layer integration(SAL) with IBM Knowledge Catalog(IKC). +func (watsonxData *WatsonxDataV3) CreateSalIntegration(createSalIntegrationOptions *CreateSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateSalIntegrationWithContext(context.Background(), createSalIntegrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetTableWithContext is an alternate form of the GetTable method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetTableWithContext(ctx context.Context, getTableOptions *GetTableOptions) (result *Table, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getTableOptions, "getTableOptions cannot be nil") +// CreateSalIntegrationWithContext is an alternate form of the CreateSalIntegration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateSalIntegrationWithContext(ctx context.Context, createSalIntegrationOptions *CreateSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSalIntegrationOptions, "createSalIntegrationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getTableOptions, "getTableOptions") + err = core.ValidateStruct(createSalIntegrationOptions, "createSalIntegrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "catalog_id": *getTableOptions.CatalogID, - "schema_id": *getTableOptions.SchemaID, - "table_id": *getTableOptions.TableID, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/tables/{table_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getTableOptions.Headers { + for headerName, headerValue := range createSalIntegrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetTable") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateSalIntegration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getTableOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getTableOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if createSalIntegrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSalIntegrationOptions.AuthInstanceID)) } - builder.AddQuery("engine_id", fmt.Sprint(*getTableOptions.EngineID)) - if getTableOptions.Type != nil { - builder.AddQuery("type", fmt.Sprint(*getTableOptions.Type)) + body := make(map[string]interface{}) + if createSalIntegrationOptions.Apikey != nil { + body["apikey"] = createSalIntegrationOptions.Apikey + } + if createSalIntegrationOptions.EngineID != nil { + body["engine_id"] = createSalIntegrationOptions.EngineID + } + if createSalIntegrationOptions.StorageResourceCrn != nil { + body["storage_resource_crn"] = createSalIntegrationOptions.StorageResourceCrn + } + if createSalIntegrationOptions.StorageType != nil { + body["storage_type"] = createSalIntegrationOptions.StorageType + } + if createSalIntegrationOptions.TrialPlan != nil { + body["trial_plan"] = createSalIntegrationOptions.TrialPlan + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -8907,12 +9625,12 @@ func (watsonxData *WatsonxDataV2) GetTableWithContext(ctx context.Context, getTa var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_sal_integration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -8923,58 +9641,39 @@ func (watsonxData *WatsonxDataV2) GetTableWithContext(ctx context.Context, getTa return } -// DeleteTable : Delete table -// Delete table for a given schema and catalog. -func (watsonxData *WatsonxDataV2) DeleteTable(deleteTableOptions *DeleteTableOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteTableWithContext(context.Background(), deleteTableOptions) +// DeleteSalIntegration : Delete Semantic Automation Layer(SAL) integration +// Remove Semantic automation layer integration. +func (watsonxData *WatsonxDataV3) DeleteSalIntegration(deleteSalIntegrationOptions *DeleteSalIntegrationOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteSalIntegrationWithContext(context.Background(), deleteSalIntegrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteTableWithContext is an alternate form of the DeleteTable method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteTableWithContext(ctx context.Context, deleteTableOptions *DeleteTableOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteTableOptions, "deleteTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteTableOptions, "deleteTableOptions") +// DeleteSalIntegrationWithContext is an alternate form of the DeleteSalIntegration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteSalIntegrationWithContext(ctx context.Context, deleteSalIntegrationOptions *DeleteSalIntegrationOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateStruct(deleteSalIntegrationOptions, "deleteSalIntegrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "catalog_id": *deleteTableOptions.CatalogID, - "schema_id": *deleteTableOptions.SchemaID, - "table_id": *deleteTableOptions.TableID, - } - builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/tables/{table_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteTableOptions.Headers { + for headerName, headerValue := range deleteSalIntegrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteTable") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteSalIntegration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteTableOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteTableOptions.AuthInstanceID)) - } - - builder.AddQuery("engine_id", fmt.Sprint(*deleteTableOptions.EngineID)) - if deleteTableOptions.Type != nil { - builder.AddQuery("type", fmt.Sprint(*deleteTableOptions.Type)) - } request, err := builder.Build() if err != nil { @@ -8984,7 +9683,7 @@ func (watsonxData *WatsonxDataV2) DeleteTableWithContext(ctx context.Context, de response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "delete_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_sal_integration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -8992,62 +9691,51 @@ func (watsonxData *WatsonxDataV2) DeleteTableWithContext(ctx context.Context, de return } -// UpdateTable : Rename table -// Rename table. -func (watsonxData *WatsonxDataV2) UpdateTable(updateTableOptions *UpdateTableOptions) (result *Table, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateTableWithContext(context.Background(), updateTableOptions) +// UpdateSalIntegration : Patch Semantic automation layer integration +// Update Semantic automation layer(SAL) integration properties. +func (watsonxData *WatsonxDataV3) UpdateSalIntegration(updateSalIntegrationOptions *UpdateSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateSalIntegrationWithContext(context.Background(), updateSalIntegrationOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateTableWithContext is an alternate form of the UpdateTable method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateTableWithContext(ctx context.Context, updateTableOptions *UpdateTableOptions) (result *Table, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateTableOptions, "updateTableOptions cannot be nil") +// UpdateSalIntegrationWithContext is an alternate form of the UpdateSalIntegration method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateSalIntegrationWithContext(ctx context.Context, updateSalIntegrationOptions *UpdateSalIntegrationOptions) (result *SalIntegration, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSalIntegrationOptions, "updateSalIntegrationOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateTableOptions, "updateTableOptions") + err = core.ValidateStruct(updateSalIntegrationOptions, "updateSalIntegrationOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "catalog_id": *updateTableOptions.CatalogID, - "schema_id": *updateTableOptions.SchemaID, - "table_id": *updateTableOptions.TableID, - } - builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/tables/{table_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateTableOptions.Headers { + for headerName, headerValue := range updateSalIntegrationOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateTable") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateSalIntegration") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateTableOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateTableOptions.AuthInstanceID)) - } - - builder.AddQuery("engine_id", fmt.Sprint(*updateTableOptions.EngineID)) - if updateTableOptions.Type != nil { - builder.AddQuery("type", fmt.Sprint(*updateTableOptions.Type)) + if updateSalIntegrationOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateSalIntegrationOptions.AuthInstanceID)) } - _, err = builder.SetBodyContentJSON(updateTableOptions.Body) + _, err = builder.SetBodyContentJSON(updateSalIntegrationOptions.SalIntegrationPatch) if err != nil { err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) return @@ -9062,12 +9750,12 @@ func (watsonxData *WatsonxDataV2) UpdateTableWithContext(ctx context.Context, up var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_sal_integration", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTable) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegration) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9078,56 +9766,59 @@ func (watsonxData *WatsonxDataV2) UpdateTableWithContext(ctx context.Context, up return } -// ListColumns : List all columns of a table -// List all columns of a table in a given a schema for a given catalog. -func (watsonxData *WatsonxDataV2) ListColumns(listColumnsOptions *ListColumnsOptions) (result *ColumnCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListColumnsWithContext(context.Background(), listColumnsOptions) +// CreateSalIntegrationEnrichment : create enrichment jobs of schema(or tables in schema) +// create enrichment job of schemas, notifing the schema(tables) changes to IBM Knowledge Catalog(IKC) and kick off an +// import and metadata enrichment job. +func (watsonxData *WatsonxDataV3) CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptions *CreateSalIntegrationEnrichmentOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.CreateSalIntegrationEnrichmentWithContext(context.Background(), createSalIntegrationEnrichmentOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListColumnsWithContext is an alternate form of the ListColumns method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListColumnsWithContext(ctx context.Context, listColumnsOptions *ListColumnsOptions) (result *ColumnCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listColumnsOptions, "listColumnsOptions cannot be nil") +// CreateSalIntegrationEnrichmentWithContext is an alternate form of the CreateSalIntegrationEnrichment method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateSalIntegrationEnrichmentWithContext(ctx context.Context, createSalIntegrationEnrichmentOptions *CreateSalIntegrationEnrichmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSalIntegrationEnrichmentOptions, "createSalIntegrationEnrichmentOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listColumnsOptions, "listColumnsOptions") + err = core.ValidateStruct(createSalIntegrationEnrichmentOptions, "createSalIntegrationEnrichmentOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "catalog_id": *listColumnsOptions.CatalogID, - "schema_id": *listColumnsOptions.SchemaID, - "table_id": *listColumnsOptions.TableID, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/tables/{table_id}/columns`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/enrichment`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listColumnsOptions.Headers { + for headerName, headerValue := range createSalIntegrationEnrichmentOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListColumns") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateSalIntegrationEnrichment") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if listColumnsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listColumnsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if createSalIntegrationEnrichmentOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSalIntegrationEnrichmentOptions.AuthInstanceID)) } - builder.AddQuery("engine_id", fmt.Sprint(*listColumnsOptions.EngineID)) + body := make(map[string]interface{}) + if createSalIntegrationEnrichmentOptions.Changes != nil { + body["changes"] = createSalIntegrationEnrichmentOptions.Changes + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } request, err := builder.Build() if err != nil { @@ -9135,86 +9826,61 @@ func (watsonxData *WatsonxDataV2) ListColumnsWithContext(ctx context.Context, li return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "list_columns", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_sal_integration_enrichment", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalColumnCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateColumns : Add column(s) -// Add one or multiple columns to a table in a schema for a given catalog. -func (watsonxData *WatsonxDataV2) CreateColumns(createColumnsOptions *CreateColumnsOptions) (result *ColumnCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateColumnsWithContext(context.Background(), createColumnsOptions) +// ListSalIntegrationEnrichmentAssets : List semantic enriched data_assets in IBM Knowledge catalog +// List semantic enrichment data_assets(enriched tables) associated with the schema by IBM Knowledge Catalog project id, +// which can be fetched from /sal_integration/mappings. +func (watsonxData *WatsonxDataV3) ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptions *ListSalIntegrationEnrichmentAssetsOptions) (result *SalEnrichmentDataAssetCollection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListSalIntegrationEnrichmentAssetsWithContext(context.Background(), listSalIntegrationEnrichmentAssetsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateColumnsWithContext is an alternate form of the CreateColumns method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateColumnsWithContext(ctx context.Context, createColumnsOptions *CreateColumnsOptions) (result *ColumnCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createColumnsOptions, "createColumnsOptions cannot be nil") +// ListSalIntegrationEnrichmentAssetsWithContext is an alternate form of the ListSalIntegrationEnrichmentAssets method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListSalIntegrationEnrichmentAssetsWithContext(ctx context.Context, listSalIntegrationEnrichmentAssetsOptions *ListSalIntegrationEnrichmentAssetsOptions) (result *SalEnrichmentDataAssetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSalIntegrationEnrichmentAssetsOptions, "listSalIntegrationEnrichmentAssetsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createColumnsOptions, "createColumnsOptions") + err = core.ValidateStruct(listSalIntegrationEnrichmentAssetsOptions, "listSalIntegrationEnrichmentAssetsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "catalog_id": *createColumnsOptions.CatalogID, - "schema_id": *createColumnsOptions.SchemaID, - "table_id": *createColumnsOptions.TableID, - } - - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/tables/{table_id}/columns`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/enrichment/data_assets`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createColumnsOptions.Headers { + for headerName, headerValue := range listSalIntegrationEnrichmentAssetsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateColumns") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListSalIntegrationEnrichmentAssets") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createColumnsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createColumnsOptions.AuthInstanceID)) + if listSalIntegrationEnrichmentAssetsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSalIntegrationEnrichmentAssetsOptions.AuthInstanceID)) } - builder.AddQuery("engine_id", fmt.Sprint(*createColumnsOptions.EngineID)) - - body := make(map[string]interface{}) - if createColumnsOptions.Columns != nil { - body["columns"] = createColumnsOptions.Columns - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } + builder.AddQuery("project_id", fmt.Sprint(*listSalIntegrationEnrichmentAssetsOptions.ProjectID)) request, err := builder.Build() if err != nil { @@ -9225,12 +9891,12 @@ func (watsonxData *WatsonxDataV2) CreateColumnsWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_columns", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_sal_integration_enrichment_assets", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalColumnCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalEnrichmentDataAssetCollection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9241,56 +9907,55 @@ func (watsonxData *WatsonxDataV2) CreateColumnsWithContext(ctx context.Context, return } -// DeleteColumn : Delete column -// Delete column in a table for a given schema and catalog. -func (watsonxData *WatsonxDataV2) DeleteColumn(deleteColumnOptions *DeleteColumnOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteColumnWithContext(context.Background(), deleteColumnOptions) +// GetSalIntegrationEnrichmentAssetsByID : Get semantic enrichment data_asset associated with the table +// Get semantic enrichment data_asset associated with the table by IBM Knowledge Catalog project id and asset id, which +// can be retrived by /sal_integration/enrichement/data_assets. +func (watsonxData *WatsonxDataV3) GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptions *GetSalIntegrationEnrichmentAssetsByIdOptions) (result *SalEnrichmentDataAsset, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetSalIntegrationEnrichmentAssetsByIDWithContext(context.Background(), getSalIntegrationEnrichmentAssetsByIdOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteColumnWithContext is an alternate form of the DeleteColumn method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteColumnWithContext(ctx context.Context, deleteColumnOptions *DeleteColumnOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteColumnOptions, "deleteColumnOptions cannot be nil") +// GetSalIntegrationEnrichmentAssetsByIDWithContext is an alternate form of the GetSalIntegrationEnrichmentAssetsByID method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSalIntegrationEnrichmentAssetsByIDWithContext(ctx context.Context, getSalIntegrationEnrichmentAssetsByIdOptions *GetSalIntegrationEnrichmentAssetsByIdOptions) (result *SalEnrichmentDataAsset, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSalIntegrationEnrichmentAssetsByIdOptions, "getSalIntegrationEnrichmentAssetsByIdOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteColumnOptions, "deleteColumnOptions") + err = core.ValidateStruct(getSalIntegrationEnrichmentAssetsByIdOptions, "getSalIntegrationEnrichmentAssetsByIdOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "catalog_id": *deleteColumnOptions.CatalogID, - "schema_id": *deleteColumnOptions.SchemaID, - "table_id": *deleteColumnOptions.TableID, - "column_id": *deleteColumnOptions.ColumnID, + "id": *getSalIntegrationEnrichmentAssetsByIdOptions.ID, } - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/tables/{table_id}/columns/{column_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/enrichment/data_assets/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteColumnOptions.Headers { + for headerName, headerValue := range getSalIntegrationEnrichmentAssetsByIdOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteColumn") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSalIntegrationEnrichmentAssetsByID") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteColumnOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteColumnOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + if getSalIntegrationEnrichmentAssetsByIdOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationEnrichmentAssetsByIdOptions.AuthInstanceID)) } - builder.AddQuery("engine_id", fmt.Sprint(*deleteColumnOptions.EngineID)) + builder.AddQuery("project_id", fmt.Sprint(*getSalIntegrationEnrichmentAssetsByIdOptions.ProjectID)) request, err := builder.Build() if err != nil { @@ -9298,90 +9963,78 @@ func (watsonxData *WatsonxDataV2) DeleteColumnWithContext(ctx context.Context, d return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_column", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_sal_integration_enrichment_assets_by_id", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalEnrichmentDataAsset) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateColumn : Alter column -// Update the given column - rename column. -func (watsonxData *WatsonxDataV2) UpdateColumn(updateColumnOptions *UpdateColumnOptions) (result *Column, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateColumnWithContext(context.Background(), updateColumnOptions) +// GetSalIntegrationEnrichmentGlobalSettings : Get metadata enrichment global settings +// Get metadata enrichment global settings. +func (watsonxData *WatsonxDataV3) GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptions *GetSalIntegrationEnrichmentGlobalSettingsOptions) (result *SalEnrichmentSettings, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetSalIntegrationEnrichmentGlobalSettingsWithContext(context.Background(), getSalIntegrationEnrichmentGlobalSettingsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateColumnWithContext is an alternate form of the UpdateColumn method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateColumnWithContext(ctx context.Context, updateColumnOptions *UpdateColumnOptions) (result *Column, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateColumnOptions, "updateColumnOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(updateColumnOptions, "updateColumnOptions") +// GetSalIntegrationEnrichmentGlobalSettingsWithContext is an alternate form of the GetSalIntegrationEnrichmentGlobalSettings method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSalIntegrationEnrichmentGlobalSettingsWithContext(ctx context.Context, getSalIntegrationEnrichmentGlobalSettingsOptions *GetSalIntegrationEnrichmentGlobalSettingsOptions) (result *SalEnrichmentSettings, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(getSalIntegrationEnrichmentGlobalSettingsOptions, "getSalIntegrationEnrichmentGlobalSettingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "catalog_id": *updateColumnOptions.CatalogID, - "schema_id": *updateColumnOptions.SchemaID, - "table_id": *updateColumnOptions.TableID, - "column_id": *updateColumnOptions.ColumnID, - } - - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/tables/{table_id}/columns/{column_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/enrichment/global_settings`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateColumnOptions.Headers { + for headerName, headerValue := range getSalIntegrationEnrichmentGlobalSettingsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateColumn") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSalIntegrationEnrichmentGlobalSettings") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateColumnOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateColumnOptions.AuthInstanceID)) + if getSalIntegrationEnrichmentGlobalSettingsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationEnrichmentGlobalSettingsOptions.AuthInstanceID)) } - builder.AddQuery("engine_id", fmt.Sprint(*updateColumnOptions.EngineID)) - - _, err = builder.SetBodyContentJSON(updateColumnOptions.Body) + request, err := builder.Build() if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } - - request, err := builder.Build() - if err != nil { - err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_column", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_sal_integration_enrichment_global_settings", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalColumn) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalEnrichmentSettings) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9392,56 +10045,62 @@ func (watsonxData *WatsonxDataV2) UpdateColumnWithContext(ctx context.Context, u return } -// ListTableSnapshots : Get table snapshots -// List all table snapshots. -func (watsonxData *WatsonxDataV2) ListTableSnapshots(listTableSnapshotsOptions *ListTableSnapshotsOptions) (result *TableSnapshotCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListTableSnapshotsWithContext(context.Background(), listTableSnapshotsOptions) +// ReplaceSalIntegrationEnrichmentGlobalSettings : Create or update metadata enrichment global settings +// Create or update metadata enrichment global settings. +func (watsonxData *WatsonxDataV3) ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptions *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) (result *SalEnrichmentSettings, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ReplaceSalIntegrationEnrichmentGlobalSettingsWithContext(context.Background(), replaceSalIntegrationEnrichmentGlobalSettingsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListTableSnapshotsWithContext is an alternate form of the ListTableSnapshots method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListTableSnapshotsWithContext(ctx context.Context, listTableSnapshotsOptions *ListTableSnapshotsOptions) (result *TableSnapshotCollection, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listTableSnapshotsOptions, "listTableSnapshotsOptions cannot be nil") +// ReplaceSalIntegrationEnrichmentGlobalSettingsWithContext is an alternate form of the ReplaceSalIntegrationEnrichmentGlobalSettings method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ReplaceSalIntegrationEnrichmentGlobalSettingsWithContext(ctx context.Context, replaceSalIntegrationEnrichmentGlobalSettingsOptions *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) (result *SalEnrichmentSettings, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSalIntegrationEnrichmentGlobalSettingsOptions, "replaceSalIntegrationEnrichmentGlobalSettingsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(listTableSnapshotsOptions, "listTableSnapshotsOptions") + err = core.ValidateStruct(replaceSalIntegrationEnrichmentGlobalSettingsOptions, "replaceSalIntegrationEnrichmentGlobalSettingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "catalog_id": *listTableSnapshotsOptions.CatalogID, - "schema_id": *listTableSnapshotsOptions.SchemaID, - "table_id": *listTableSnapshotsOptions.TableID, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/tables/{table_id}/snapshots`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/enrichment/global_settings`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listTableSnapshotsOptions.Headers { + for headerName, headerValue := range replaceSalIntegrationEnrichmentGlobalSettingsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListTableSnapshots") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ReplaceSalIntegrationEnrichmentGlobalSettings") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listTableSnapshotsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listTableSnapshotsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if replaceSalIntegrationEnrichmentGlobalSettingsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*replaceSalIntegrationEnrichmentGlobalSettingsOptions.AuthInstanceID)) } - builder.AddQuery("engine_id", fmt.Sprint(*listTableSnapshotsOptions.EngineID)) + body := make(map[string]interface{}) + if replaceSalIntegrationEnrichmentGlobalSettingsOptions.Expansion != nil { + body["expansion"] = replaceSalIntegrationEnrichmentGlobalSettingsOptions.Expansion + } + if replaceSalIntegrationEnrichmentGlobalSettingsOptions.TermAssignment != nil { + body["term_assignment"] = replaceSalIntegrationEnrichmentGlobalSettingsOptions.TermAssignment + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return + } request, err := builder.Build() if err != nil { @@ -9452,12 +10111,12 @@ func (watsonxData *WatsonxDataV2) ListTableSnapshotsWithContext(ctx context.Cont var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_table_snapshots", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "replace_sal_integration_enrichment_global_settings", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTableSnapshotCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalEnrichmentSettings) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9468,67 +10127,51 @@ func (watsonxData *WatsonxDataV2) ListTableSnapshotsWithContext(ctx context.Cont return } -// RollbackTable : Rollback table to snapshot -// Rollback table to a snapshot. -func (watsonxData *WatsonxDataV2) RollbackTable(rollbackTableOptions *RollbackTableOptions) (result *ReplaceSnapshotCreatedBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.RollbackTableWithContext(context.Background(), rollbackTableOptions) +// ListSalIntegrationEnrichmentJobs : List semantic enrichment jobs associated with the schema +// List semantic enrichment jobs in wkc that associated with the schema by project id(in the given project from IBM +// Knowledge Catalog perspective). +func (watsonxData *WatsonxDataV3) ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptions *ListSalIntegrationEnrichmentJobsOptions) (result *SalEnrichmentJobs, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListSalIntegrationEnrichmentJobsWithContext(context.Background(), listSalIntegrationEnrichmentJobsOptions) err = core.RepurposeSDKProblem(err, "") return } -// RollbackTableWithContext is an alternate form of the RollbackTable method which supports a Context parameter -func (watsonxData *WatsonxDataV2) RollbackTableWithContext(ctx context.Context, rollbackTableOptions *RollbackTableOptions) (result *ReplaceSnapshotCreatedBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(rollbackTableOptions, "rollbackTableOptions cannot be nil") +// ListSalIntegrationEnrichmentJobsWithContext is an alternate form of the ListSalIntegrationEnrichmentJobs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListSalIntegrationEnrichmentJobsWithContext(ctx context.Context, listSalIntegrationEnrichmentJobsOptions *ListSalIntegrationEnrichmentJobsOptions) (result *SalEnrichmentJobs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSalIntegrationEnrichmentJobsOptions, "listSalIntegrationEnrichmentJobsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(rollbackTableOptions, "rollbackTableOptions") + err = core.ValidateStruct(listSalIntegrationEnrichmentJobsOptions, "listSalIntegrationEnrichmentJobsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "catalog_id": *rollbackTableOptions.CatalogID, - "schema_id": *rollbackTableOptions.SchemaID, - "table_id": *rollbackTableOptions.TableID, - } - - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/tables/{table_id}/rollback`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/enrichment/jobs`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range rollbackTableOptions.Headers { + for headerName, headerValue := range listSalIntegrationEnrichmentJobsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "RollbackTable") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListSalIntegrationEnrichmentJobs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if rollbackTableOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*rollbackTableOptions.AuthInstanceID)) + if listSalIntegrationEnrichmentJobsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSalIntegrationEnrichmentJobsOptions.AuthInstanceID)) } - builder.AddQuery("engine_id", fmt.Sprint(*rollbackTableOptions.EngineID)) - - body := make(map[string]interface{}) - if rollbackTableOptions.SnapshotID != nil { - body["snapshot_id"] = rollbackTableOptions.SnapshotID - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } + builder.AddQuery("project_id", fmt.Sprint(*listSalIntegrationEnrichmentJobsOptions.ProjectID)) request, err := builder.Build() if err != nil { @@ -9539,12 +10182,12 @@ func (watsonxData *WatsonxDataV2) RollbackTableWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "rollback_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_sal_integration_enrichment_jobs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReplaceSnapshotCreatedBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalEnrichmentJobs) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9555,59 +10198,54 @@ func (watsonxData *WatsonxDataV2) RollbackTableWithContext(ctx context.Context, return } -// UpdateSyncCatalog : External Iceberg table registration -// Synchronize the external Iceberg table registration for a catalog identified by catalog_id. -func (watsonxData *WatsonxDataV2) UpdateSyncCatalog(updateSyncCatalogOptions *UpdateSyncCatalogOptions) (result *UpdateSyncCatalogOKBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateSyncCatalogWithContext(context.Background(), updateSyncCatalogOptions) +// ListSalIntegrationEnrichmentJobRuns : List semantic enrichment job runs associated with the schema +// List runs of an SAL enrichement job associated with the schema(project in IBM Knowledge Catalog perspective). +func (watsonxData *WatsonxDataV3) ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptions *ListSalIntegrationEnrichmentJobRunsOptions) (result *SalEnrichmentJobRuns, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListSalIntegrationEnrichmentJobRunsWithContext(context.Background(), listSalIntegrationEnrichmentJobRunsOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateSyncCatalogWithContext is an alternate form of the UpdateSyncCatalog method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateSyncCatalogWithContext(ctx context.Context, updateSyncCatalogOptions *UpdateSyncCatalogOptions) (result *UpdateSyncCatalogOKBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateSyncCatalogOptions, "updateSyncCatalogOptions cannot be nil") +// ListSalIntegrationEnrichmentJobRunsWithContext is an alternate form of the ListSalIntegrationEnrichmentJobRuns method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListSalIntegrationEnrichmentJobRunsWithContext(ctx context.Context, listSalIntegrationEnrichmentJobRunsOptions *ListSalIntegrationEnrichmentJobRunsOptions) (result *SalEnrichmentJobRuns, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSalIntegrationEnrichmentJobRunsOptions, "listSalIntegrationEnrichmentJobRunsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateSyncCatalogOptions, "updateSyncCatalogOptions") + err = core.ValidateStruct(listSalIntegrationEnrichmentJobRunsOptions, "listSalIntegrationEnrichmentJobRunsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "catalog_id": *updateSyncCatalogOptions.CatalogID, + "job_id": *listSalIntegrationEnrichmentJobRunsOptions.JobID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/sync`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/enrichment/jobs/{job_id}/runs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateSyncCatalogOptions.Headers { + for headerName, headerValue := range listSalIntegrationEnrichmentJobRunsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateSyncCatalog") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListSalIntegrationEnrichmentJobRuns") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateSyncCatalogOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateSyncCatalogOptions.AuthInstanceID)) + if listSalIntegrationEnrichmentJobRunsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSalIntegrationEnrichmentJobRunsOptions.AuthInstanceID)) } - _, err = builder.SetBodyContentJSON(updateSyncCatalogOptions.Body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } + builder.AddQuery("project_id", fmt.Sprint(*listSalIntegrationEnrichmentJobRunsOptions.ProjectID)) request, err := builder.Build() if err != nil { @@ -9618,12 +10256,12 @@ func (watsonxData *WatsonxDataV2) UpdateSyncCatalogWithContext(ctx context.Conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_sync_catalog", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_sal_integration_enrichment_job_runs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalUpdateSyncCatalogOKBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalEnrichmentJobRuns) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9634,44 +10272,56 @@ func (watsonxData *WatsonxDataV2) UpdateSyncCatalogWithContext(ctx context.Conte return } -// ListMilvusServices : Get list of milvus services -// Get list milvus services. -func (watsonxData *WatsonxDataV2) ListMilvusServices(listMilvusServicesOptions *ListMilvusServicesOptions) (result *MilvusServiceCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListMilvusServicesWithContext(context.Background(), listMilvusServicesOptions) +// GetSalIntegrationEnrichmentJobRunLogs : Get semantic enrichment job run logs associated with the job run +// Get semantic enrichment job run logs associated with the job run. +func (watsonxData *WatsonxDataV3) GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptions *GetSalIntegrationEnrichmentJobRunLogsOptions) (result *SalEnrichmentJobRunLogs, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetSalIntegrationEnrichmentJobRunLogsWithContext(context.Background(), getSalIntegrationEnrichmentJobRunLogsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListMilvusServicesWithContext is an alternate form of the ListMilvusServices method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListMilvusServicesWithContext(ctx context.Context, listMilvusServicesOptions *ListMilvusServicesOptions) (result *MilvusServiceCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listMilvusServicesOptions, "listMilvusServicesOptions") +// GetSalIntegrationEnrichmentJobRunLogsWithContext is an alternate form of the GetSalIntegrationEnrichmentJobRunLogs method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSalIntegrationEnrichmentJobRunLogsWithContext(ctx context.Context, getSalIntegrationEnrichmentJobRunLogsOptions *GetSalIntegrationEnrichmentJobRunLogsOptions) (result *SalEnrichmentJobRunLogs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSalIntegrationEnrichmentJobRunLogsOptions, "getSalIntegrationEnrichmentJobRunLogsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getSalIntegrationEnrichmentJobRunLogsOptions, "getSalIntegrationEnrichmentJobRunLogsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "job_id": *getSalIntegrationEnrichmentJobRunLogsOptions.JobID, + "run_id": *getSalIntegrationEnrichmentJobRunLogsOptions.RunID, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/milvus_services`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/enrichment/jobs/{job_id}/runs/{run_id}/logs`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listMilvusServicesOptions.Headers { + for headerName, headerValue := range getSalIntegrationEnrichmentJobRunLogsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListMilvusServices") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSalIntegrationEnrichmentJobRunLogs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listMilvusServicesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listMilvusServicesOptions.AuthInstanceID)) + if getSalIntegrationEnrichmentJobRunLogsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationEnrichmentJobRunLogsOptions.AuthInstanceID)) } + builder.AddQuery("project_id", fmt.Sprint(*getSalIntegrationEnrichmentJobRunLogsOptions.ProjectID)) + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) @@ -9681,12 +10331,12 @@ func (watsonxData *WatsonxDataV2) ListMilvusServicesWithContext(ctx context.Cont var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_milvus_services", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_sal_integration_enrichment_job_run_logs", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusServiceCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalEnrichmentJobRunLogs) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9697,80 +10347,50 @@ func (watsonxData *WatsonxDataV2) ListMilvusServicesWithContext(ctx context.Cont return } -// CreateMilvusService : Create milvus service -// Create milvus service. -func (watsonxData *WatsonxDataV2) CreateMilvusService(createMilvusServiceOptions *CreateMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateMilvusServiceWithContext(context.Background(), createMilvusServiceOptions) +// GetSalIntegrationEnrichmentProjectSettings : get metadata enrichment settings for a IBM Knowledge Catalog project(schema) +// get metadata enrichment settings for a IBM Knowledge Catalog project(schema). +func (watsonxData *WatsonxDataV3) GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptions *GetSalIntegrationEnrichmentProjectSettingsOptions) (result *SalEnrichmentSettings, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetSalIntegrationEnrichmentProjectSettingsWithContext(context.Background(), getSalIntegrationEnrichmentProjectSettingsOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateMilvusServiceWithContext is an alternate form of the CreateMilvusService method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateMilvusServiceWithContext(ctx context.Context, createMilvusServiceOptions *CreateMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createMilvusServiceOptions, "createMilvusServiceOptions cannot be nil") +// GetSalIntegrationEnrichmentProjectSettingsWithContext is an alternate form of the GetSalIntegrationEnrichmentProjectSettings method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSalIntegrationEnrichmentProjectSettingsWithContext(ctx context.Context, getSalIntegrationEnrichmentProjectSettingsOptions *GetSalIntegrationEnrichmentProjectSettingsOptions) (result *SalEnrichmentSettings, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSalIntegrationEnrichmentProjectSettingsOptions, "getSalIntegrationEnrichmentProjectSettingsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createMilvusServiceOptions, "createMilvusServiceOptions") + err = core.ValidateStruct(getSalIntegrationEnrichmentProjectSettingsOptions, "getSalIntegrationEnrichmentProjectSettingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/milvus_services`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/enrichment/project_settings`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createMilvusServiceOptions.Headers { + for headerName, headerValue := range getSalIntegrationEnrichmentProjectSettingsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateMilvusService") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSalIntegrationEnrichmentProjectSettings") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createMilvusServiceOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createMilvusServiceOptions.AuthInstanceID)) + if getSalIntegrationEnrichmentProjectSettingsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationEnrichmentProjectSettingsOptions.AuthInstanceID)) } - body := make(map[string]interface{}) - if createMilvusServiceOptions.BucketName != nil { - body["bucket_name"] = createMilvusServiceOptions.BucketName - } - if createMilvusServiceOptions.Origin != nil { - body["origin"] = createMilvusServiceOptions.Origin - } - if createMilvusServiceOptions.RootPath != nil { - body["root_path"] = createMilvusServiceOptions.RootPath - } - if createMilvusServiceOptions.ServiceDisplayName != nil { - body["service_display_name"] = createMilvusServiceOptions.ServiceDisplayName - } - if createMilvusServiceOptions.BucketType != nil { - body["bucket_type"] = createMilvusServiceOptions.BucketType - } - if createMilvusServiceOptions.Description != nil { - body["description"] = createMilvusServiceOptions.Description - } - if createMilvusServiceOptions.Tags != nil { - body["tags"] = createMilvusServiceOptions.Tags - } - if createMilvusServiceOptions.TshirtSize != nil { - body["tshirt_size"] = createMilvusServiceOptions.TshirtSize - } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return - } + builder.AddQuery("project_id", fmt.Sprint(*getSalIntegrationEnrichmentProjectSettingsOptions.ProjectID)) request, err := builder.Build() if err != nil { @@ -9781,12 +10401,12 @@ func (watsonxData *WatsonxDataV2) CreateMilvusServiceWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_milvus_service", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_sal_integration_enrichment_project_settings", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusService) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalEnrichmentSettings) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -9797,51 +10417,62 @@ func (watsonxData *WatsonxDataV2) CreateMilvusServiceWithContext(ctx context.Con return } -// GetMilvusService : Get milvus service -// Get milvus service. -func (watsonxData *WatsonxDataV2) GetMilvusService(getMilvusServiceOptions *GetMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetMilvusServiceWithContext(context.Background(), getMilvusServiceOptions) +// ReplaceSalIntegrationEnrichmentProjectSettings : Create or update project level metadata enrichment settings +// Create or update metadata enrichment settings for a IBM Knowledge Catalog project(enriched schema). +func (watsonxData *WatsonxDataV3) ReplaceSalIntegrationEnrichmentProjectSettings(replaceSalIntegrationEnrichmentProjectSettingsOptions *ReplaceSalIntegrationEnrichmentProjectSettingsOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.ReplaceSalIntegrationEnrichmentProjectSettingsWithContext(context.Background(), replaceSalIntegrationEnrichmentProjectSettingsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetMilvusServiceWithContext is an alternate form of the GetMilvusService method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetMilvusServiceWithContext(ctx context.Context, getMilvusServiceOptions *GetMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getMilvusServiceOptions, "getMilvusServiceOptions cannot be nil") +// ReplaceSalIntegrationEnrichmentProjectSettingsWithContext is an alternate form of the ReplaceSalIntegrationEnrichmentProjectSettings method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ReplaceSalIntegrationEnrichmentProjectSettingsWithContext(ctx context.Context, replaceSalIntegrationEnrichmentProjectSettingsOptions *ReplaceSalIntegrationEnrichmentProjectSettingsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSalIntegrationEnrichmentProjectSettingsOptions, "replaceSalIntegrationEnrichmentProjectSettingsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getMilvusServiceOptions, "getMilvusServiceOptions") + err = core.ValidateStruct(replaceSalIntegrationEnrichmentProjectSettingsOptions, "replaceSalIntegrationEnrichmentProjectSettingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "service_id": *getMilvusServiceOptions.ServiceID, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/milvus_services/{service_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/enrichment/project_settings`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getMilvusServiceOptions.Headers { + for headerName, headerValue := range replaceSalIntegrationEnrichmentProjectSettingsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetMilvusService") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ReplaceSalIntegrationEnrichmentProjectSettings") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if getMilvusServiceOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getMilvusServiceOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if replaceSalIntegrationEnrichmentProjectSettingsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*replaceSalIntegrationEnrichmentProjectSettingsOptions.AuthInstanceID)) + } + + builder.AddQuery("project_id", fmt.Sprint(*replaceSalIntegrationEnrichmentProjectSettingsOptions.ProjectID)) + + body := make(map[string]interface{}) + if replaceSalIntegrationEnrichmentProjectSettingsOptions.Expansion != nil { + body["expansion"] = replaceSalIntegrationEnrichmentProjectSettingsOptions.Expansion + } + if replaceSalIntegrationEnrichmentProjectSettingsOptions.TermAssignment != nil { + body["term_assignment"] = replaceSalIntegrationEnrichmentProjectSettingsOptions.TermAssignment + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -9850,69 +10481,52 @@ func (watsonxData *WatsonxDataV2) GetMilvusServiceWithContext(ctx context.Contex return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_milvus_service", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "replace_sal_integration_enrichment_project_settings", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusService) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// DeleteMilvusService : Delete milvus service -// Delete milvus service. -func (watsonxData *WatsonxDataV2) DeleteMilvusService(deleteMilvusServiceOptions *DeleteMilvusServiceOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteMilvusServiceWithContext(context.Background(), deleteMilvusServiceOptions) +// GetSalIntegrationGlossaryTerms : Get list of uploaded glossary terms +// Get list of uploaded glossary terms. +func (watsonxData *WatsonxDataV3) GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptions *GetSalIntegrationGlossaryTermsOptions) (result *SalGlossaryTerms, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetSalIntegrationGlossaryTermsWithContext(context.Background(), getSalIntegrationGlossaryTermsOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteMilvusServiceWithContext is an alternate form of the DeleteMilvusService method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteMilvusServiceWithContext(ctx context.Context, deleteMilvusServiceOptions *DeleteMilvusServiceOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteMilvusServiceOptions, "deleteMilvusServiceOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(deleteMilvusServiceOptions, "deleteMilvusServiceOptions") +// GetSalIntegrationGlossaryTermsWithContext is an alternate form of the GetSalIntegrationGlossaryTerms method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSalIntegrationGlossaryTermsWithContext(ctx context.Context, getSalIntegrationGlossaryTermsOptions *GetSalIntegrationGlossaryTermsOptions) (result *SalGlossaryTerms, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(getSalIntegrationGlossaryTermsOptions, "getSalIntegrationGlossaryTermsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "service_id": *deleteMilvusServiceOptions.ServiceID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/milvus_services/{service_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/glossary/terms`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteMilvusServiceOptions.Headers { + for headerName, headerValue := range getSalIntegrationGlossaryTermsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteMilvusService") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSalIntegrationGlossaryTerms") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteMilvusServiceOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteMilvusServiceOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + if getSalIntegrationGlossaryTermsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationGlossaryTermsOptions.AuthInstanceID)) } request, err := builder.Build() @@ -9921,68 +10535,72 @@ func (watsonxData *WatsonxDataV2) DeleteMilvusServiceWithContext(ctx context.Con return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_milvus_service", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_sal_integration_glossary_terms", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalGlossaryTerms) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } return } -// UpdateMilvusService : Update milvus service -// Update details of milvus service. -func (watsonxData *WatsonxDataV2) UpdateMilvusService(updateMilvusServiceOptions *UpdateMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateMilvusServiceWithContext(context.Background(), updateMilvusServiceOptions) +// CreateSalIntegrationUploadGlossary : Upload semantic enrichment business terms glossary +// Upload semantic enrichment business terms glossary. +func (watsonxData *WatsonxDataV3) CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptions *CreateSalIntegrationUploadGlossaryOptions) (result *SalGlossaryUploadProcess, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateSalIntegrationUploadGlossaryWithContext(context.Background(), createSalIntegrationUploadGlossaryOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateMilvusServiceWithContext is an alternate form of the UpdateMilvusService method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateMilvusServiceWithContext(ctx context.Context, updateMilvusServiceOptions *UpdateMilvusServiceOptions) (result *MilvusService, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateMilvusServiceOptions, "updateMilvusServiceOptions cannot be nil") +// CreateSalIntegrationUploadGlossaryWithContext is an alternate form of the CreateSalIntegrationUploadGlossary method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateSalIntegrationUploadGlossaryWithContext(ctx context.Context, createSalIntegrationUploadGlossaryOptions *CreateSalIntegrationUploadGlossaryOptions) (result *SalGlossaryUploadProcess, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSalIntegrationUploadGlossaryOptions, "createSalIntegrationUploadGlossaryOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateMilvusServiceOptions, "updateMilvusServiceOptions") + err = core.ValidateStruct(createSalIntegrationUploadGlossaryOptions, "createSalIntegrationUploadGlossaryOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "service_id": *updateMilvusServiceOptions.ServiceID, - } - - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/milvus_services/{service_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/glossary/upload_processes`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateMilvusServiceOptions.Headers { + for headerName, headerValue := range createSalIntegrationUploadGlossaryOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateMilvusService") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateSalIntegrationUploadGlossary") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateMilvusServiceOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateMilvusServiceOptions.AuthInstanceID)) + if createSalIntegrationUploadGlossaryOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSalIntegrationUploadGlossaryOptions.AuthInstanceID)) } - _, err = builder.SetBodyContentJSON(updateMilvusServiceOptions.Body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + builder.AddFormData("replace_option", "", "", fmt.Sprint(*createSalIntegrationUploadGlossaryOptions.ReplaceOption)) + if createSalIntegrationUploadGlossaryOptions.GlossaryCsv != nil { + builder.AddFormData("glossary_csv", "filename", + core.StringNilMapper(createSalIntegrationUploadGlossaryOptions.GlossaryCsvContentType), createSalIntegrationUploadGlossaryOptions.GlossaryCsv) } request, err := builder.Build() @@ -9994,12 +10612,12 @@ func (watsonxData *WatsonxDataV2) UpdateMilvusServiceWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_milvus_service", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_sal_integration_upload_glossary", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusService) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalGlossaryUploadProcess) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10010,58 +10628,51 @@ func (watsonxData *WatsonxDataV2) UpdateMilvusServiceWithContext(ctx context.Con return } -// UpdateMilvusServiceBucket : Update milvus service bucket -// Update details of milvus service bucket. Note that the improper use of the API could result in potential data loss. -func (watsonxData *WatsonxDataV2) UpdateMilvusServiceBucket(updateMilvusServiceBucketOptions *UpdateMilvusServiceBucketOptions) (result *MilvusService, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.UpdateMilvusServiceBucketWithContext(context.Background(), updateMilvusServiceBucketOptions) +// GetSalIntegrationUploadGlossaryStatus : Get status of glossary uploading process(job) +// Get status of glossary uploading process(job). +func (watsonxData *WatsonxDataV3) GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptions *GetSalIntegrationUploadGlossaryStatusOptions) (result *SalGlossaryUploadStatus, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetSalIntegrationUploadGlossaryStatusWithContext(context.Background(), getSalIntegrationUploadGlossaryStatusOptions) err = core.RepurposeSDKProblem(err, "") return } -// UpdateMilvusServiceBucketWithContext is an alternate form of the UpdateMilvusServiceBucket method which supports a Context parameter -func (watsonxData *WatsonxDataV2) UpdateMilvusServiceBucketWithContext(ctx context.Context, updateMilvusServiceBucketOptions *UpdateMilvusServiceBucketOptions) (result *MilvusService, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(updateMilvusServiceBucketOptions, "updateMilvusServiceBucketOptions cannot be nil") +// GetSalIntegrationUploadGlossaryStatusWithContext is an alternate form of the GetSalIntegrationUploadGlossaryStatus method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetSalIntegrationUploadGlossaryStatusWithContext(ctx context.Context, getSalIntegrationUploadGlossaryStatusOptions *GetSalIntegrationUploadGlossaryStatusOptions) (result *SalGlossaryUploadStatus, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSalIntegrationUploadGlossaryStatusOptions, "getSalIntegrationUploadGlossaryStatusOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(updateMilvusServiceBucketOptions, "updateMilvusServiceBucketOptions") + err = core.ValidateStruct(getSalIntegrationUploadGlossaryStatusOptions, "getSalIntegrationUploadGlossaryStatusOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "service_id": *updateMilvusServiceBucketOptions.ServiceID, + "id": *getSalIntegrationUploadGlossaryStatusOptions.ID, } - builder := core.NewRequestBuilder(core.PATCH) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/milvus_services/{service_id}/bucket`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/glossary/upload_processes/{id}/status`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range updateMilvusServiceBucketOptions.Headers { + for headerName, headerValue := range getSalIntegrationUploadGlossaryStatusOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "UpdateMilvusServiceBucket") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetSalIntegrationUploadGlossaryStatus") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/merge-patch+json") - if updateMilvusServiceBucketOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateMilvusServiceBucketOptions.AuthInstanceID)) - } - - _, err = builder.SetBodyContentJSON(updateMilvusServiceBucketOptions.Body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if getSalIntegrationUploadGlossaryStatusOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSalIntegrationUploadGlossaryStatusOptions.AuthInstanceID)) } request, err := builder.Build() @@ -10073,12 +10684,12 @@ func (watsonxData *WatsonxDataV2) UpdateMilvusServiceBucketWithContext(ctx conte var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "update_milvus_service_bucket", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_sal_integration_upload_glossary_status", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusService) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalGlossaryUploadStatus) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10089,51 +10700,52 @@ func (watsonxData *WatsonxDataV2) UpdateMilvusServiceBucketWithContext(ctx conte return } -// ListMilvusServiceDatabases : Get milvus service databases -// Get milvus service databases. -func (watsonxData *WatsonxDataV2) ListMilvusServiceDatabases(listMilvusServiceDatabasesOptions *ListMilvusServiceDatabasesOptions) (result *MilvusServiceDatabases, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListMilvusServiceDatabasesWithContext(context.Background(), listMilvusServiceDatabasesOptions) +// ListSalIntegrationEnrichmentMappings : Post watsonx.data schema to fetch mapped catalog and project +// use the list of watsonx.data catalog and schema to fetch mapped IKC project id and catalog id. +func (watsonxData *WatsonxDataV3) ListSalIntegrationEnrichmentMappings(listSalIntegrationEnrichmentMappingsOptions *ListSalIntegrationEnrichmentMappingsOptions) (result *SalIntegrationMappings, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListSalIntegrationEnrichmentMappingsWithContext(context.Background(), listSalIntegrationEnrichmentMappingsOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListMilvusServiceDatabasesWithContext is an alternate form of the ListMilvusServiceDatabases method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListMilvusServiceDatabasesWithContext(ctx context.Context, listMilvusServiceDatabasesOptions *ListMilvusServiceDatabasesOptions) (result *MilvusServiceDatabases, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listMilvusServiceDatabasesOptions, "listMilvusServiceDatabasesOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listMilvusServiceDatabasesOptions, "listMilvusServiceDatabasesOptions") +// ListSalIntegrationEnrichmentMappingsWithContext is an alternate form of the ListSalIntegrationEnrichmentMappings method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListSalIntegrationEnrichmentMappingsWithContext(ctx context.Context, listSalIntegrationEnrichmentMappingsOptions *ListSalIntegrationEnrichmentMappingsOptions) (result *SalIntegrationMappings, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSalIntegrationEnrichmentMappingsOptions, "listSalIntegrationEnrichmentMappingsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "service_id": *listMilvusServiceDatabasesOptions.ServiceID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/milvus_services/{service_id}/databases`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/mappings`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listMilvusServiceDatabasesOptions.Headers { + for headerName, headerValue := range listSalIntegrationEnrichmentMappingsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListMilvusServiceDatabases") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListSalIntegrationEnrichmentMappings") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listMilvusServiceDatabasesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listMilvusServiceDatabasesOptions.AuthInstanceID)) + if listSalIntegrationEnrichmentMappingsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSalIntegrationEnrichmentMappingsOptions.AuthInstanceID)) + } + + if listSalIntegrationEnrichmentMappingsOptions.CatalogName != nil { + builder.AddQuery("catalog_name", fmt.Sprint(*listSalIntegrationEnrichmentMappingsOptions.CatalogName)) + } + if listSalIntegrationEnrichmentMappingsOptions.SchemaName != nil { + builder.AddQuery("schema_name", fmt.Sprint(*listSalIntegrationEnrichmentMappingsOptions.SchemaName)) + } + if listSalIntegrationEnrichmentMappingsOptions.Next != nil { + builder.AddQuery("next", fmt.Sprint(*listSalIntegrationEnrichmentMappingsOptions.Next)) } request, err := builder.Build() @@ -10145,12 +10757,12 @@ func (watsonxData *WatsonxDataV2) ListMilvusServiceDatabasesWithContext(ctx cont var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_milvus_service_databases", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_sal_integration_enrichment_mappings", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusServiceDatabases) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSalIntegrationMappings) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10161,52 +10773,58 @@ func (watsonxData *WatsonxDataV2) ListMilvusServiceDatabasesWithContext(ctx cont return } -// ListMilvusDatabaseCollections : Get milvus database collections -// Get milvus database collections. -func (watsonxData *WatsonxDataV2) ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptions *ListMilvusDatabaseCollectionsOptions) (result *MilvusDatabaseCollections, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListMilvusDatabaseCollectionsWithContext(context.Background(), listMilvusDatabaseCollectionsOptions) +// ListSemanticSearchQueries : List Semantic Search queries snapshot +// List Semantic Search queries snapshot. +func (watsonxData *WatsonxDataV3) ListSemanticSearchQueries(listSemanticSearchQueriesOptions *ListSemanticSearchQueriesOptions) (result *SemanticSearchList, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListSemanticSearchQueriesWithContext(context.Background(), listSemanticSearchQueriesOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListMilvusDatabaseCollectionsWithContext is an alternate form of the ListMilvusDatabaseCollections method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListMilvusDatabaseCollectionsWithContext(ctx context.Context, listMilvusDatabaseCollectionsOptions *ListMilvusDatabaseCollectionsOptions) (result *MilvusDatabaseCollections, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(listMilvusDatabaseCollectionsOptions, "listMilvusDatabaseCollectionsOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(listMilvusDatabaseCollectionsOptions, "listMilvusDatabaseCollectionsOptions") +// ListSemanticSearchQueriesWithContext is an alternate form of the ListSemanticSearchQueries method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListSemanticSearchQueriesWithContext(ctx context.Context, listSemanticSearchQueriesOptions *ListSemanticSearchQueriesOptions) (result *SemanticSearchList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSemanticSearchQueriesOptions, "listSemanticSearchQueriesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "service_id": *listMilvusDatabaseCollectionsOptions.ServiceID, - "database_id": *listMilvusDatabaseCollectionsOptions.DatabaseID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/milvus_services/{service_id}/databases/{database_id}/collections`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/semantic_search/queries`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listMilvusDatabaseCollectionsOptions.Headers { + for headerName, headerValue := range listSemanticSearchQueriesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListMilvusDatabaseCollections") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListSemanticSearchQueries") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listMilvusDatabaseCollectionsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listMilvusDatabaseCollectionsOptions.AuthInstanceID)) + if listSemanticSearchQueriesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listSemanticSearchQueriesOptions.AuthInstanceID)) + } + + if listSemanticSearchQueriesOptions.EngineID != nil { + builder.AddQuery("engine_id", fmt.Sprint(*listSemanticSearchQueriesOptions.EngineID)) + } + if listSemanticSearchQueriesOptions.SchemaSearchEnabled != nil { + builder.AddQuery("schema_search_enabled", fmt.Sprint(*listSemanticSearchQueriesOptions.SchemaSearchEnabled)) + } + if listSemanticSearchQueriesOptions.ColumnSearchEnabled != nil { + builder.AddQuery("column_search_enabled", fmt.Sprint(*listSemanticSearchQueriesOptions.ColumnSearchEnabled)) + } + if listSemanticSearchQueriesOptions.MaxResultNumber != nil { + builder.AddQuery("max_result_number", fmt.Sprint(*listSemanticSearchQueriesOptions.MaxResultNumber)) + } + if listSemanticSearchQueriesOptions.RunSearch != nil { + builder.AddQuery("run_search", fmt.Sprint(*listSemanticSearchQueriesOptions.RunSearch)) } request, err := builder.Build() @@ -10218,12 +10836,12 @@ func (watsonxData *WatsonxDataV2) ListMilvusDatabaseCollectionsWithContext(ctx c var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_milvus_database_collections", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_semantic_search_queries", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalMilvusDatabaseCollections) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSemanticSearchList) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10234,51 +10852,64 @@ func (watsonxData *WatsonxDataV2) ListMilvusDatabaseCollectionsWithContext(ctx c return } -// CreateMilvusServicePause : Pause milvus service -// Pause a running milvus service. -func (watsonxData *WatsonxDataV2) CreateMilvusServicePause(createMilvusServicePauseOptions *CreateMilvusServicePauseOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateMilvusServicePauseWithContext(context.Background(), createMilvusServicePauseOptions) +// CreateSemanticSearchQueries : Trigger a global search among IBM Knowledge Catalog metadata by given query +// Execute a query of global search among IBM Knowledge Catalog metadata. +func (watsonxData *WatsonxDataV3) CreateSemanticSearchQueries(createSemanticSearchQueriesOptions *CreateSemanticSearchQueriesOptions) (result *SemanticSearch, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateSemanticSearchQueriesWithContext(context.Background(), createSemanticSearchQueriesOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateMilvusServicePauseWithContext is an alternate form of the CreateMilvusServicePause method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateMilvusServicePauseWithContext(ctx context.Context, createMilvusServicePauseOptions *CreateMilvusServicePauseOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createMilvusServicePauseOptions, "createMilvusServicePauseOptions cannot be nil") +// CreateSemanticSearchQueriesWithContext is an alternate form of the CreateSemanticSearchQueries method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateSemanticSearchQueriesWithContext(ctx context.Context, createSemanticSearchQueriesOptions *CreateSemanticSearchQueriesOptions) (result *SemanticSearch, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSemanticSearchQueriesOptions, "createSemanticSearchQueriesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createMilvusServicePauseOptions, "createMilvusServicePauseOptions") + err = core.ValidateStruct(createSemanticSearchQueriesOptions, "createSemanticSearchQueriesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "service_id": *createMilvusServicePauseOptions.ServiceID, - } - builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/milvus_services/{service_id}/pause`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/semantic_search/queries`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createMilvusServicePauseOptions.Headers { + for headerName, headerValue := range createSemanticSearchQueriesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateMilvusServicePause") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateSemanticSearchQueries") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if createMilvusServicePauseOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createMilvusServicePauseOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if createSemanticSearchQueriesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createSemanticSearchQueriesOptions.AuthInstanceID)) + } + + body := make(map[string]interface{}) + if createSemanticSearchQueriesOptions.EngineID != nil { + body["engine_id"] = createSemanticSearchQueriesOptions.EngineID + } + if createSemanticSearchQueriesOptions.QueryInput != nil { + body["query_input"] = createSemanticSearchQueriesOptions.QueryInput + } + if createSemanticSearchQueriesOptions.SearchConfig != nil { + body["search_config"] = createSemanticSearchQueriesOptions.SearchConfig + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -10290,12 +10921,12 @@ func (watsonxData *WatsonxDataV2) CreateMilvusServicePauseWithContext(ctx contex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_milvus_service_pause", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_semantic_search_queries", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSemanticSearch) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10306,51 +10937,46 @@ func (watsonxData *WatsonxDataV2) CreateMilvusServicePauseWithContext(ctx contex return } -// CreateMilvusServiceResume : Resume milvus service -// Resume a paused milvus service. -func (watsonxData *WatsonxDataV2) CreateMilvusServiceResume(createMilvusServiceResumeOptions *CreateMilvusServiceResumeOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateMilvusServiceResumeWithContext(context.Background(), createMilvusServiceResumeOptions) +// DeleteSemanticSearchQueries : Clear semantic search query history +// Delete the history records of semantic search in batch, if no batch_size given, entire semantic search history list +// will be removed. +func (watsonxData *WatsonxDataV3) DeleteSemanticSearchQueries(deleteSemanticSearchQueriesOptions *DeleteSemanticSearchQueriesOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteSemanticSearchQueriesWithContext(context.Background(), deleteSemanticSearchQueriesOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateMilvusServiceResumeWithContext is an alternate form of the CreateMilvusServiceResume method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateMilvusServiceResumeWithContext(ctx context.Context, createMilvusServiceResumeOptions *CreateMilvusServiceResumeOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createMilvusServiceResumeOptions, "createMilvusServiceResumeOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(createMilvusServiceResumeOptions, "createMilvusServiceResumeOptions") +// DeleteSemanticSearchQueriesWithContext is an alternate form of the DeleteSemanticSearchQueries method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteSemanticSearchQueriesWithContext(ctx context.Context, deleteSemanticSearchQueriesOptions *DeleteSemanticSearchQueriesOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateStruct(deleteSemanticSearchQueriesOptions, "deleteSemanticSearchQueriesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "service_id": *createMilvusServiceResumeOptions.ServiceID, - } - - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/milvus_services/{service_id}/resume`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/semantic_search/queries`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createMilvusServiceResumeOptions.Headers { + for headerName, headerValue := range deleteSemanticSearchQueriesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateMilvusServiceResume") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteSemanticSearchQueries") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if createMilvusServiceResumeOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createMilvusServiceResumeOptions.AuthInstanceID)) + if deleteSemanticSearchQueriesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSemanticSearchQueriesOptions.AuthInstanceID)) + } + + if deleteSemanticSearchQueriesOptions.BatchSize != nil { + builder.AddQuery("batch_size", fmt.Sprint(*deleteSemanticSearchQueriesOptions.BatchSize)) } request, err := builder.Build() @@ -10359,118 +10985,138 @@ func (watsonxData *WatsonxDataV2) CreateMilvusServiceResumeWithContext(ctx conte return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_milvus_service_resume", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_semantic_search_queries", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// CreateMilvusServiceScale : Scale a milvus service -// Scale an existing milvus service. -func (watsonxData *WatsonxDataV2) CreateMilvusServiceScale(createMilvusServiceScaleOptions *CreateMilvusServiceScaleOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateMilvusServiceScaleWithContext(context.Background(), createMilvusServiceScaleOptions) +// DeleteSemanticSearchQueriesByID : Delete semantic search query history by record id +// Delete the history records of semantic search by record id. +func (watsonxData *WatsonxDataV3) DeleteSemanticSearchQueriesByID(deleteSemanticSearchQueriesByIdOptions *DeleteSemanticSearchQueriesByIdOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteSemanticSearchQueriesByIDWithContext(context.Background(), deleteSemanticSearchQueriesByIdOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateMilvusServiceScaleWithContext is an alternate form of the CreateMilvusServiceScale method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateMilvusServiceScaleWithContext(ctx context.Context, createMilvusServiceScaleOptions *CreateMilvusServiceScaleOptions) (result *SuccessResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createMilvusServiceScaleOptions, "createMilvusServiceScaleOptions cannot be nil") +// DeleteSemanticSearchQueriesByIDWithContext is an alternate form of the DeleteSemanticSearchQueriesByID method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteSemanticSearchQueriesByIDWithContext(ctx context.Context, deleteSemanticSearchQueriesByIdOptions *DeleteSemanticSearchQueriesByIdOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSemanticSearchQueriesByIdOptions, "deleteSemanticSearchQueriesByIdOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createMilvusServiceScaleOptions, "createMilvusServiceScaleOptions") + err = core.ValidateStruct(deleteSemanticSearchQueriesByIdOptions, "deleteSemanticSearchQueriesByIdOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "service_id": *createMilvusServiceScaleOptions.ServiceID, + "id": *deleteSemanticSearchQueriesByIdOptions.ID, } - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/milvus_services/{service_id}/scale`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_integration/semantic_search/queries/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createMilvusServiceScaleOptions.Headers { + for headerName, headerValue := range deleteSemanticSearchQueriesByIdOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateMilvusServiceScale") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteSemanticSearchQueriesByID") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if createMilvusServiceScaleOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createMilvusServiceScaleOptions.AuthInstanceID)) + if deleteSemanticSearchQueriesByIdOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteSemanticSearchQueriesByIdOptions.AuthInstanceID)) } - body := make(map[string]interface{}) - if createMilvusServiceScaleOptions.TshirtSize != nil { - body["tshirt_size"] = createMilvusServiceScaleOptions.TshirtSize + request, err := builder.Build() + if err != nil { + err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) + return } - _, err = builder.SetBodyContentJSON(body) + + response, err = watsonxData.Service.Request(request, nil) if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + core.EnrichHTTPProblem(err, "delete_semantic_search_queries_by_id", getServiceComponentInfo()) + err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) + return + } + + return +} + +// DeleteSalMetadata : Delete Semantic automation layer(SAL) integration metadata +// Delete SAL integration metadata. +func (watsonxData *WatsonxDataV3) DeleteSalMetadata(deleteSalMetadataOptions *DeleteSalMetadataOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteSalMetadataWithContext(context.Background(), deleteSalMetadataOptions) + err = core.RepurposeSDKProblem(err, "") + return +} + +// DeleteSalMetadataWithContext is an alternate form of the DeleteSalMetadata method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteSalMetadataWithContext(ctx context.Context, deleteSalMetadataOptions *DeleteSalMetadataOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateStruct(deleteSalMetadataOptions, "deleteSalMetadataOptions") + if err != nil { + err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) + return + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/sal_metadata`, nil) + if err != nil { + err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } + for headerName, headerValue := range deleteSalMetadataOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteSalMetadata") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + request, err := builder.Build() if err != nil { err = core.SDKErrorf(err, "", "build-error", common.GetComponentInfo()) return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_milvus_service_scale", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_sal_metadata", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListIngestionJobs : Get ingestion jobs +// ListIngestionJobs : List ingestion jobs // Get list of ingestion jobs. -func (watsonxData *WatsonxDataV2) ListIngestionJobs(listIngestionJobsOptions *ListIngestionJobsOptions) (result *IngestionJobCollection, response *core.DetailedResponse, err error) { +func (watsonxData *WatsonxDataV3) ListIngestionJobs(listIngestionJobsOptions *ListIngestionJobsOptions) (result *IngestionJobCollection, response *core.DetailedResponse, err error) { result, response, err = watsonxData.ListIngestionJobsWithContext(context.Background(), listIngestionJobsOptions) err = core.RepurposeSDKProblem(err, "") return } // ListIngestionJobsWithContext is an alternate form of the ListIngestionJobs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListIngestionJobsWithContext(ctx context.Context, listIngestionJobsOptions *ListIngestionJobsOptions) (result *IngestionJobCollection, response *core.DetailedResponse, err error) { +func (watsonxData *WatsonxDataV3) ListIngestionJobsWithContext(ctx context.Context, listIngestionJobsOptions *ListIngestionJobsOptions) (result *IngestionJobCollection, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(listIngestionJobsOptions, "listIngestionJobsOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) @@ -10485,7 +11131,7 @@ func (watsonxData *WatsonxDataV2) ListIngestionJobsWithContext(ctx context.Conte builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/ingestion_jobs`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/lhingestion/api/v1/ingestion/jobs`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return @@ -10495,7 +11141,7 @@ func (watsonxData *WatsonxDataV2) ListIngestionJobsWithContext(ctx context.Conte builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListIngestionJobs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListIngestionJobs") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } @@ -10507,8 +11153,8 @@ func (watsonxData *WatsonxDataV2) ListIngestionJobsWithContext(ctx context.Conte if listIngestionJobsOptions.Start != nil { builder.AddQuery("start", fmt.Sprint(*listIngestionJobsOptions.Start)) } - if listIngestionJobsOptions.JobsPerPage != nil { - builder.AddQuery("jobs_per_page", fmt.Sprint(*listIngestionJobsOptions.JobsPerPage)) + if listIngestionJobsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIngestionJobsOptions.Limit)) } request, err := builder.Build() @@ -10536,22 +11182,22 @@ func (watsonxData *WatsonxDataV2) ListIngestionJobsWithContext(ctx context.Conte return } -// CreateIngestionJobs : Create an ingestion job -// Create an ingestion job. -func (watsonxData *WatsonxDataV2) CreateIngestionJobs(createIngestionJobsOptions *CreateIngestionJobsOptions) (result *IngestionJob, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateIngestionJobsWithContext(context.Background(), createIngestionJobsOptions) +// CreateIngestionJob : Submit ingestion job +// Submit an ingestion job with the provided source and target details. +func (watsonxData *WatsonxDataV3) CreateIngestionJob(createIngestionJobOptions *CreateIngestionJobOptions) (result *IngestionJob, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateIngestionJobWithContext(context.Background(), createIngestionJobOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateIngestionJobsWithContext is an alternate form of the CreateIngestionJobs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateIngestionJobsWithContext(ctx context.Context, createIngestionJobsOptions *CreateIngestionJobsOptions) (result *IngestionJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createIngestionJobsOptions, "createIngestionJobsOptions cannot be nil") +// CreateIngestionJobWithContext is an alternate form of the CreateIngestionJob method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateIngestionJobWithContext(ctx context.Context, createIngestionJobOptions *CreateIngestionJobOptions) (result *IngestionJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createIngestionJobOptions, "createIngestionJobOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createIngestionJobsOptions, "createIngestionJobsOptions") + err = core.ValidateStruct(createIngestionJobOptions, "createIngestionJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -10560,62 +11206,53 @@ func (watsonxData *WatsonxDataV2) CreateIngestionJobsWithContext(ctx context.Con builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/ingestion_jobs`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/lhingestion/api/v1/ingestion/jobs`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createIngestionJobsOptions.Headers { + for headerName, headerValue := range createIngestionJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateIngestionJobs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateIngestionJob") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if createIngestionJobsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createIngestionJobsOptions.AuthInstanceID)) + if createIngestionJobOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createIngestionJobOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if createIngestionJobsOptions.JobID != nil { - body["job_id"] = createIngestionJobsOptions.JobID - } - if createIngestionJobsOptions.SourceDataFiles != nil { - body["source_data_files"] = createIngestionJobsOptions.SourceDataFiles + if createIngestionJobOptions.ID != nil { + body["id"] = createIngestionJobOptions.ID } - if createIngestionJobsOptions.TargetTable != nil { - body["target_table"] = createIngestionJobsOptions.TargetTable + if createIngestionJobOptions.Source != nil { + body["source"] = createIngestionJobOptions.Source } - if createIngestionJobsOptions.Username != nil { - body["username"] = createIngestionJobsOptions.Username + if createIngestionJobOptions.Target != nil { + body["target"] = createIngestionJobOptions.Target } - if createIngestionJobsOptions.CreateIfNotExist != nil { - body["create_if_not_exist"] = createIngestionJobsOptions.CreateIfNotExist + if createIngestionJobOptions.Engine != nil { + body["engine"] = createIngestionJobOptions.Engine } - if createIngestionJobsOptions.CsvProperty != nil { - body["csv_property"] = createIngestionJobsOptions.CsvProperty + if createIngestionJobOptions.EngineID != nil { + body["engine_id"] = createIngestionJobOptions.EngineID } - if createIngestionJobsOptions.EngineID != nil { - body["engine_id"] = createIngestionJobsOptions.EngineID + if createIngestionJobOptions.ExecuteConfig != nil { + body["execute_config"] = createIngestionJobOptions.ExecuteConfig } - if createIngestionJobsOptions.ExecuteConfig != nil { - body["execute_config"] = createIngestionJobsOptions.ExecuteConfig + if createIngestionJobOptions.SourceIcebergTable != nil { + body["source_iceberg_table"] = createIngestionJobOptions.SourceIcebergTable } - if createIngestionJobsOptions.PartitionBy != nil { - body["partition_by"] = createIngestionJobsOptions.PartitionBy + if createIngestionJobOptions.PartitionBy != nil { + body["partition_by"] = createIngestionJobOptions.PartitionBy } - if createIngestionJobsOptions.Schema != nil { - body["schema"] = createIngestionJobsOptions.Schema - } - if createIngestionJobsOptions.SourceFileType != nil { - body["source_file_type"] = createIngestionJobsOptions.SourceFileType - } - if createIngestionJobsOptions.ValidateCsvHeader != nil { - body["validate_csv_header"] = createIngestionJobsOptions.ValidateCsvHeader + if createIngestionJobOptions.Capacity != nil { + body["capacity"] = createIngestionJobOptions.Capacity } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -10632,7 +11269,7 @@ func (watsonxData *WatsonxDataV2) CreateIngestionJobsWithContext(ctx context.Con var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_ingestion_jobs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_ingestion_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -10648,71 +11285,51 @@ func (watsonxData *WatsonxDataV2) CreateIngestionJobsWithContext(ctx context.Con return } -// CreateIngestionJobsLocalFiles : Create an ingestion job for user local files -// Create an ingestion job for user local files. -func (watsonxData *WatsonxDataV2) CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptions *CreateIngestionJobsLocalFilesOptions) (result *IngestionJob, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreateIngestionJobsLocalFilesWithContext(context.Background(), createIngestionJobsLocalFilesOptions) +// GetIngestionJob : Get ingestion job by ID +// Get ingestion job by ID. +func (watsonxData *WatsonxDataV3) GetIngestionJob(getIngestionJobOptions *GetIngestionJobOptions) (result *IngestionJob, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetIngestionJobWithContext(context.Background(), getIngestionJobOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreateIngestionJobsLocalFilesWithContext is an alternate form of the CreateIngestionJobsLocalFiles method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreateIngestionJobsLocalFilesWithContext(ctx context.Context, createIngestionJobsLocalFilesOptions *CreateIngestionJobsLocalFilesOptions) (result *IngestionJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createIngestionJobsLocalFilesOptions, "createIngestionJobsLocalFilesOptions cannot be nil") +// GetIngestionJobWithContext is an alternate form of the GetIngestionJob method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetIngestionJobWithContext(ctx context.Context, getIngestionJobOptions *GetIngestionJobOptions) (result *IngestionJob, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getIngestionJobOptions, "getIngestionJobOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createIngestionJobsLocalFilesOptions, "createIngestionJobsLocalFilesOptions") + err = core.ValidateStruct(getIngestionJobOptions, "getIngestionJobOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.POST) + pathParamsMap := map[string]string{ + "id": *getIngestionJobOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/ingestion_jobs_local_files`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v3/lhingestion/api/v1/ingestion/jobs/{id}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createIngestionJobsLocalFilesOptions.Headers { + for headerName, headerValue := range getIngestionJobOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreateIngestionJobsLocalFiles") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetIngestionJob") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if createIngestionJobsLocalFilesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createIngestionJobsLocalFilesOptions.AuthInstanceID)) - } - - builder.AddFormData("source_data_file", "filename", - core.StringNilMapper(createIngestionJobsLocalFilesOptions.SourceDataFileContentType), createIngestionJobsLocalFilesOptions.SourceDataFile) - builder.AddFormData("target_table", "", "", fmt.Sprint(*createIngestionJobsLocalFilesOptions.TargetTable)) - builder.AddFormData("job_id", "", "", fmt.Sprint(*createIngestionJobsLocalFilesOptions.JobID)) - builder.AddFormData("username", "", "", fmt.Sprint(*createIngestionJobsLocalFilesOptions.Username)) - if createIngestionJobsLocalFilesOptions.SourceFileType != nil { - builder.AddFormData("source_file_type", "", "", fmt.Sprint(*createIngestionJobsLocalFilesOptions.SourceFileType)) - } - if createIngestionJobsLocalFilesOptions.CsvProperty != nil { - builder.AddFormData("csv_property", "", "", fmt.Sprint(*createIngestionJobsLocalFilesOptions.CsvProperty)) - } - if createIngestionJobsLocalFilesOptions.CreateIfNotExist != nil { - builder.AddFormData("create_if_not_exist", "", "", fmt.Sprint(*createIngestionJobsLocalFilesOptions.CreateIfNotExist)) - } - if createIngestionJobsLocalFilesOptions.ValidateCsvHeader != nil { - builder.AddFormData("validate_csv_header", "", "", fmt.Sprint(*createIngestionJobsLocalFilesOptions.ValidateCsvHeader)) - } - if createIngestionJobsLocalFilesOptions.ExecuteConfig != nil { - builder.AddFormData("execute_config", "", "", fmt.Sprint(*createIngestionJobsLocalFilesOptions.ExecuteConfig)) - } - if createIngestionJobsLocalFilesOptions.EngineID != nil { - builder.AddFormData("engine_id", "", "", fmt.Sprint(*createIngestionJobsLocalFilesOptions.EngineID)) + if getIngestionJobOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getIngestionJobOptions.AuthInstanceID)) } request, err := builder.Build() @@ -10724,7 +11341,7 @@ func (watsonxData *WatsonxDataV2) CreateIngestionJobsLocalFilesWithContext(ctx c var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "create_ingestion_jobs_local_files", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_ingestion_job", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } @@ -10740,51 +11357,55 @@ func (watsonxData *WatsonxDataV2) CreateIngestionJobsLocalFilesWithContext(ctx c return } -// GetIngestionJob : Get ingestion job -// Get a submitted ingestion job. -func (watsonxData *WatsonxDataV2) GetIngestionJob(getIngestionJobOptions *GetIngestionJobOptions) (result *IngestionJob, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetIngestionJobWithContext(context.Background(), getIngestionJobOptions) +// ListResourceAccessPolicies : List Resource Access Policies +// Retrieves a comprehensive list of access control policies that define permissions granted to users and user groups +// for various watsonx.data resources. This endpoint allows you to query access policies by resource type, resource +// identifiers, or resource names. The response includes detailed information about subjects (users/groups), resources, +// permissions, and policy states. +func (watsonxData *WatsonxDataV3) ListResourceAccessPolicies(listResourceAccessPoliciesOptions *ListResourceAccessPoliciesOptions) (result *AccessPolicies, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListResourceAccessPoliciesWithContext(context.Background(), listResourceAccessPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetIngestionJobWithContext is an alternate form of the GetIngestionJob method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetIngestionJobWithContext(ctx context.Context, getIngestionJobOptions *GetIngestionJobOptions) (result *IngestionJob, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getIngestionJobOptions, "getIngestionJobOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(getIngestionJobOptions, "getIngestionJobOptions") +// ListResourceAccessPoliciesWithContext is an alternate form of the ListResourceAccessPolicies method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListResourceAccessPoliciesWithContext(ctx context.Context, listResourceAccessPoliciesOptions *ListResourceAccessPoliciesOptions) (result *AccessPolicies, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listResourceAccessPoliciesOptions, "listResourceAccessPoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "job_id": *getIngestionJobOptions.JobID, - } - builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/ingestion_jobs/{job_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v1/access/access_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getIngestionJobOptions.Headers { + for headerName, headerValue := range listResourceAccessPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetIngestionJob") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListResourceAccessPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getIngestionJobOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getIngestionJobOptions.AuthInstanceID)) + if listResourceAccessPoliciesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listResourceAccessPoliciesOptions.AuthInstanceID)) + } + + if listResourceAccessPoliciesOptions.ResourceType != nil { + builder.AddQuery("resource_type", fmt.Sprint(*listResourceAccessPoliciesOptions.ResourceType)) + } + if listResourceAccessPoliciesOptions.ResourceID != nil { + builder.AddQuery("resource_id", strings.Join(listResourceAccessPoliciesOptions.ResourceID, ",")) + } + if listResourceAccessPoliciesOptions.ResourceName != nil { + builder.AddQuery("resource_name", strings.Join(listResourceAccessPoliciesOptions.ResourceName, ",")) } request, err := builder.Build() @@ -10796,12 +11417,12 @@ func (watsonxData *WatsonxDataV2) GetIngestionJobWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_ingestion_job", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_resource_access_policies", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIngestionJob) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccessPolicies) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -10812,50 +11433,59 @@ func (watsonxData *WatsonxDataV2) GetIngestionJobWithContext(ctx context.Context return } -// DeleteIngestionJobs : Delete an ingestion job -// Delete an ingestion job. -func (watsonxData *WatsonxDataV2) DeleteIngestionJobs(deleteIngestionJobsOptions *DeleteIngestionJobsOptions) (response *core.DetailedResponse, err error) { - response, err = watsonxData.DeleteIngestionJobsWithContext(context.Background(), deleteIngestionJobsOptions) +// BulkUpdateResourceAccessPolicies : Bulk Update Resource Access Policies +// This API enables bulk updates of resource access policies, which define user access and permissions for specific +// resources. +func (watsonxData *WatsonxDataV3) BulkUpdateResourceAccessPolicies(bulkUpdateResourceAccessPoliciesOptions *BulkUpdateResourceAccessPoliciesOptions) (result *AccessPolicyBulkUpdateResponse, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.BulkUpdateResourceAccessPoliciesWithContext(context.Background(), bulkUpdateResourceAccessPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// DeleteIngestionJobsWithContext is an alternate form of the DeleteIngestionJobs method which supports a Context parameter -func (watsonxData *WatsonxDataV2) DeleteIngestionJobsWithContext(ctx context.Context, deleteIngestionJobsOptions *DeleteIngestionJobsOptions) (response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(deleteIngestionJobsOptions, "deleteIngestionJobsOptions cannot be nil") +// BulkUpdateResourceAccessPoliciesWithContext is an alternate form of the BulkUpdateResourceAccessPolicies method which supports a Context parameter +func (watsonxData *WatsonxDataV3) BulkUpdateResourceAccessPoliciesWithContext(ctx context.Context, bulkUpdateResourceAccessPoliciesOptions *BulkUpdateResourceAccessPoliciesOptions) (result *AccessPolicyBulkUpdateResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(bulkUpdateResourceAccessPoliciesOptions, "bulkUpdateResourceAccessPoliciesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(deleteIngestionJobsOptions, "deleteIngestionJobsOptions") + err = core.ValidateStruct(bulkUpdateResourceAccessPoliciesOptions, "bulkUpdateResourceAccessPoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "job_id": *deleteIngestionJobsOptions.JobID, - } - - builder := core.NewRequestBuilder(core.DELETE) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/ingestion_jobs/{job_id}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v1/access/access_policies/bulk_update`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range deleteIngestionJobsOptions.Headers { + for headerName, headerValue := range bulkUpdateResourceAccessPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "DeleteIngestionJobs") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "BulkUpdateResourceAccessPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - if deleteIngestionJobsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteIngestionJobsOptions.AuthInstanceID)) + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if bulkUpdateResourceAccessPoliciesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*bulkUpdateResourceAccessPoliciesOptions.AuthInstanceID)) + } + + body := make(map[string]interface{}) + if bulkUpdateResourceAccessPoliciesOptions.AccessPolicies != nil { + body["access_policies"] = bulkUpdateResourceAccessPoliciesOptions.AccessPolicies + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -10864,32 +11494,42 @@ func (watsonxData *WatsonxDataV2) DeleteIngestionJobsWithContext(ctx context.Con return } - response, err = watsonxData.Service.Request(request, nil) + var rawResponse map[string]json.RawMessage + response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "delete_ingestion_jobs", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "bulk_update_resource_access_policies", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - - return -} - -// CreatePreviewIngestionFile : Generate a preview of source file(s) -// Generate a preview of source file(s). -func (watsonxData *WatsonxDataV2) CreatePreviewIngestionFile(createPreviewIngestionFileOptions *CreatePreviewIngestionFileOptions) (result *PreviewIngestionFile, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.CreatePreviewIngestionFileWithContext(context.Background(), createPreviewIngestionFileOptions) + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccessPolicyBulkUpdateResponse) + if err != nil { + err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) + return + } + response.Result = result + } + + return +} + +// RevokeResourceAccessPolicies : Revoke Resource Access Policies +// Remove users and user groups from the access policy for the resource id or name provided. You require +// `can_administer` permission to perform this action. +func (watsonxData *WatsonxDataV3) RevokeResourceAccessPolicies(revokeResourceAccessPoliciesOptions *RevokeResourceAccessPoliciesOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.RevokeResourceAccessPoliciesWithContext(context.Background(), revokeResourceAccessPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// CreatePreviewIngestionFileWithContext is an alternate form of the CreatePreviewIngestionFile method which supports a Context parameter -func (watsonxData *WatsonxDataV2) CreatePreviewIngestionFileWithContext(ctx context.Context, createPreviewIngestionFileOptions *CreatePreviewIngestionFileOptions) (result *PreviewIngestionFile, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(createPreviewIngestionFileOptions, "createPreviewIngestionFileOptions cannot be nil") +// RevokeResourceAccessPoliciesWithContext is an alternate form of the RevokeResourceAccessPolicies method which supports a Context parameter +func (watsonxData *WatsonxDataV3) RevokeResourceAccessPoliciesWithContext(ctx context.Context, revokeResourceAccessPoliciesOptions *RevokeResourceAccessPoliciesOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(revokeResourceAccessPoliciesOptions, "revokeResourceAccessPoliciesOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(createPreviewIngestionFileOptions, "createPreviewIngestionFileOptions") + err = core.ValidateStruct(revokeResourceAccessPoliciesOptions, "revokeResourceAccessPoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return @@ -10898,35 +11538,31 @@ func (watsonxData *WatsonxDataV2) CreatePreviewIngestionFileWithContext(ctx cont builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/preview_ingestion_file`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v1/access/access_policies/revoke`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range createPreviewIngestionFileOptions.Headers { + for headerName, headerValue := range revokeResourceAccessPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "CreatePreviewIngestionFile") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "RevokeResourceAccessPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") builder.AddHeader("Content-Type", "application/json") - if createPreviewIngestionFileOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*createPreviewIngestionFileOptions.AuthInstanceID)) + if revokeResourceAccessPoliciesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*revokeResourceAccessPoliciesOptions.AuthInstanceID)) } body := make(map[string]interface{}) - if createPreviewIngestionFileOptions.SourceDataFiles != nil { - body["source_data_files"] = createPreviewIngestionFileOptions.SourceDataFiles + if revokeResourceAccessPoliciesOptions.Resources != nil { + body["resources"] = revokeResourceAccessPoliciesOptions.Resources } - if createPreviewIngestionFileOptions.CsvProperty != nil { - body["csv_property"] = createPreviewIngestionFileOptions.CsvProperty - } - if createPreviewIngestionFileOptions.SourceFileType != nil { - body["source_file_type"] = createPreviewIngestionFileOptions.SourceFileType + if revokeResourceAccessPoliciesOptions.Subjects != nil { + body["subjects"] = revokeResourceAccessPoliciesOptions.Subjects } _, err = builder.SetBodyContentJSON(body) if err != nil { @@ -10940,61 +11576,69 @@ func (watsonxData *WatsonxDataV2) CreatePreviewIngestionFileWithContext(ctx cont return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "create_preview_ingestion_file", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "revoke_resource_access_policies", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPreviewIngestionFile) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetEndpoints : Get CPG and DAS endpoints -// Get Common policy gateway (CPG) and Data Access Service(DAS) endpoints. -func (watsonxData *WatsonxDataV2) GetEndpoints(getEndpointsOptions *GetEndpointsOptions) (result *EndpointCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetEndpointsWithContext(context.Background(), getEndpointsOptions) +// FilterResourceAccessPoliciesOnUsersAndUsergroups : Filter Resource Access Policies On Users And User Groups +// Retrieve the permissions that have been granted to users and user groups for the resource types with specified ids +// and names and given users or usergroups. +func (watsonxData *WatsonxDataV3) FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptions *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) (result *AccessPolicies, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.FilterResourceAccessPoliciesOnUsersAndUsergroupsWithContext(context.Background(), filterResourceAccessPoliciesOnUsersAndUsergroupsOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetEndpointsWithContext is an alternate form of the GetEndpoints method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetEndpointsWithContext(ctx context.Context, getEndpointsOptions *GetEndpointsOptions) (result *EndpointCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getEndpointsOptions, "getEndpointsOptions") +// FilterResourceAccessPoliciesOnUsersAndUsergroupsWithContext is an alternate form of the FilterResourceAccessPoliciesOnUsersAndUsergroups method which supports a Context parameter +func (watsonxData *WatsonxDataV3) FilterResourceAccessPoliciesOnUsersAndUsergroupsWithContext(ctx context.Context, filterResourceAccessPoliciesOnUsersAndUsergroupsOptions *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) (result *AccessPolicies, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(filterResourceAccessPoliciesOnUsersAndUsergroupsOptions, "filterResourceAccessPoliciesOnUsersAndUsergroupsOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(filterResourceAccessPoliciesOnUsersAndUsergroupsOptions, "filterResourceAccessPoliciesOnUsersAndUsergroupsOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/endpoints`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v1/access/advanced_policy_search`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getEndpointsOptions.Headers { + for headerName, headerValue := range filterResourceAccessPoliciesOnUsersAndUsergroupsOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetEndpoints") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "FilterResourceAccessPoliciesOnUsersAndUsergroups") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getEndpointsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getEndpointsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if filterResourceAccessPoliciesOnUsersAndUsergroupsOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*filterResourceAccessPoliciesOnUsersAndUsergroupsOptions.AuthInstanceID)) + } + + body := make(map[string]interface{}) + if filterResourceAccessPoliciesOnUsersAndUsergroupsOptions.AccessPoliciesSearch != nil { + body["access_policies_search"] = filterResourceAccessPoliciesOnUsersAndUsergroupsOptions.AccessPoliciesSearch + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -11006,12 +11650,12 @@ func (watsonxData *WatsonxDataV2) GetEndpointsWithContext(ctx context.Context, g var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_endpoints", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "filter_resource_access_policies_on_users_and_usergroups", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccessPolicies) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11022,66 +11666,68 @@ func (watsonxData *WatsonxDataV2) GetEndpointsWithContext(ctx context.Context, g return } -// RegisterTable : Register table -// Register table. -func (watsonxData *WatsonxDataV2) RegisterTable(registerTableOptions *RegisterTableOptions) (result *RegisterTableCreatedBody, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.RegisterTableWithContext(context.Background(), registerTableOptions) +// ListDataPolicies : List data policies +// Get a list of all the data policies defined on the data to define, extend, limit, and deny access created by the user +// with admin privileges. +func (watsonxData *WatsonxDataV3) ListDataPolicies(listDataPoliciesOptions *ListDataPoliciesOptions) (result *PolicyV2Collection, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ListDataPoliciesWithContext(context.Background(), listDataPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// RegisterTableWithContext is an alternate form of the RegisterTable method which supports a Context parameter -func (watsonxData *WatsonxDataV2) RegisterTableWithContext(ctx context.Context, registerTableOptions *RegisterTableOptions) (result *RegisterTableCreatedBody, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(registerTableOptions, "registerTableOptions cannot be nil") - if err != nil { - err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) - return - } - err = core.ValidateStruct(registerTableOptions, "registerTableOptions") +// ListDataPoliciesWithContext is an alternate form of the ListDataPolicies method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ListDataPoliciesWithContext(ctx context.Context, listDataPoliciesOptions *ListDataPoliciesOptions) (result *PolicyV2Collection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDataPoliciesOptions, "listDataPoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "catalog_id": *registerTableOptions.CatalogID, - "schema_id": *registerTableOptions.SchemaID, - } - - builder := core.NewRequestBuilder(core.POST) + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/register`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v1/access/data_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range registerTableOptions.Headers { + for headerName, headerValue := range listDataPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "RegisterTable") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ListDataPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - builder.AddHeader("Content-Type", "application/json") - if registerTableOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*registerTableOptions.AuthInstanceID)) + if listDataPoliciesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*listDataPoliciesOptions.AuthInstanceID)) } - body := make(map[string]interface{}) - if registerTableOptions.MetadataLocation != nil { - body["metadata_location"] = registerTableOptions.MetadataLocation + if listDataPoliciesOptions.CatalogName != nil { + builder.AddQuery("catalog_name", fmt.Sprint(*listDataPoliciesOptions.CatalogName)) } - if registerTableOptions.TableName != nil { - body["table_name"] = registerTableOptions.TableName + if listDataPoliciesOptions.ResourceID != nil { + builder.AddQuery("resource_id", fmt.Sprint(*listDataPoliciesOptions.ResourceID)) } - _, err = builder.SetBodyContentJSON(body) - if err != nil { - err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) - return + if listDataPoliciesOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listDataPoliciesOptions.Status)) + } + if listDataPoliciesOptions.IncludeMetadata != nil { + builder.AddQuery("include_metadata", fmt.Sprint(*listDataPoliciesOptions.IncludeMetadata)) + } + if listDataPoliciesOptions.IncludeRules != nil { + builder.AddQuery("include_rules", fmt.Sprint(*listDataPoliciesOptions.IncludeRules)) + } + if listDataPoliciesOptions.BucketName != nil { + builder.AddQuery("bucket_name", fmt.Sprint(*listDataPoliciesOptions.BucketName)) + } + if listDataPoliciesOptions.ServiceName != nil { + builder.AddQuery("service_name", fmt.Sprint(*listDataPoliciesOptions.ServiceName)) + } + if listDataPoliciesOptions.DataArtifact != nil { + builder.AddQuery("data_artifact", fmt.Sprint(*listDataPoliciesOptions.DataArtifact)) } request, err := builder.Build() @@ -11093,12 +11739,12 @@ func (watsonxData *WatsonxDataV2) RegisterTableWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "register_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "list_data_policies", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegisterTableCreatedBody) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPolicyV2Collection) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11109,53 +11755,80 @@ func (watsonxData *WatsonxDataV2) RegisterTableWithContext(ctx context.Context, return } -// LoadTable : Load table metadata -// Load table metadata. -func (watsonxData *WatsonxDataV2) LoadTable(loadTableOptions *LoadTableOptions) (result *LoadTableResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.LoadTableWithContext(context.Background(), loadTableOptions) +// CreateDataPolicy : Create a new data policy +// This api is used to create a new data policy, which is L3 access policy. This policy defines the users and their +// permissions on the data level. +func (watsonxData *WatsonxDataV3) CreateDataPolicy(createDataPolicyOptions *CreateDataPolicyOptions) (result *PolicyV2, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.CreateDataPolicyWithContext(context.Background(), createDataPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// LoadTableWithContext is an alternate form of the LoadTable method which supports a Context parameter -func (watsonxData *WatsonxDataV2) LoadTableWithContext(ctx context.Context, loadTableOptions *LoadTableOptions) (result *LoadTableResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(loadTableOptions, "loadTableOptions cannot be nil") +// CreateDataPolicyWithContext is an alternate form of the CreateDataPolicy method which supports a Context parameter +func (watsonxData *WatsonxDataV3) CreateDataPolicyWithContext(ctx context.Context, createDataPolicyOptions *CreateDataPolicyOptions) (result *PolicyV2, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDataPolicyOptions, "createDataPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(loadTableOptions, "loadTableOptions") + err = core.ValidateStruct(createDataPolicyOptions, "createDataPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - pathParamsMap := map[string]string{ - "catalog_id": *loadTableOptions.CatalogID, - "schema_id": *loadTableOptions.SchemaID, - "table_id": *loadTableOptions.TableID, - } - - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.POST) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/catalogs/{catalog_id}/schemas/{schema_id}/tables/{table_id}/metadata`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v1/access/data_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range loadTableOptions.Headers { + for headerName, headerValue := range createDataPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "LoadTable") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "CreateDataPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if loadTableOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*loadTableOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if createDataPolicyOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*createDataPolicyOptions.AuthInstanceID)) + } + + body := make(map[string]interface{}) + if createDataPolicyOptions.DataArtifact != nil { + body["data_artifact"] = createDataPolicyOptions.DataArtifact + } + if createDataPolicyOptions.Rules != nil { + body["rules"] = createDataPolicyOptions.Rules + } + if createDataPolicyOptions.CatalogName != nil { + body["catalog_name"] = createDataPolicyOptions.CatalogName + } + if createDataPolicyOptions.CatalogType != nil { + body["catalog_type"] = createDataPolicyOptions.CatalogType + } + if createDataPolicyOptions.Description != nil { + body["description"] = createDataPolicyOptions.Description + } + if createDataPolicyOptions.PolicyName != nil { + body["policy_name"] = createDataPolicyOptions.PolicyName + } + if createDataPolicyOptions.ResourceID != nil { + body["resource_id"] = createDataPolicyOptions.ResourceID + } + if createDataPolicyOptions.Status != nil { + body["status"] = createDataPolicyOptions.Status + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -11167,12 +11840,12 @@ func (watsonxData *WatsonxDataV2) LoadTableWithContext(ctx context.Context, load var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "load_table", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "create_data_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadTableResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPolicyV2) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11183,52 +11856,45 @@ func (watsonxData *WatsonxDataV2) LoadTableWithContext(ctx context.Context, load return } -// GetAllColumns : Get all columns -// Get all columns. -func (watsonxData *WatsonxDataV2) GetAllColumns(getAllColumnsOptions *GetAllColumnsOptions) (result *ColumnsResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetAllColumnsWithContext(context.Background(), getAllColumnsOptions) +// DeleteDataPolicies : Bulk delete data policies +// Delete multiple data policies together. You require catalog `can_administer` permission to perform this action. +func (watsonxData *WatsonxDataV3) DeleteDataPolicies(deleteDataPoliciesOptions *DeleteDataPoliciesOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteDataPoliciesWithContext(context.Background(), deleteDataPoliciesOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetAllColumnsWithContext is an alternate form of the GetAllColumns method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetAllColumnsWithContext(ctx context.Context, getAllColumnsOptions *GetAllColumnsOptions) (result *ColumnsResponse, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(getAllColumnsOptions, "getAllColumnsOptions") +// DeleteDataPoliciesWithContext is an alternate form of the DeleteDataPolicies method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteDataPoliciesWithContext(ctx context.Context, deleteDataPoliciesOptions *DeleteDataPoliciesOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateStruct(deleteDataPoliciesOptions, "deleteDataPoliciesOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/columns`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v1/access/data_policies`, nil) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getAllColumnsOptions.Headers { + for headerName, headerValue := range deleteDataPoliciesOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetAllColumns") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteDataPolicies") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if getAllColumnsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getAllColumnsOptions.AuthInstanceID)) + if deleteDataPoliciesOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteDataPoliciesOptions.AuthInstanceID)) } - if getAllColumnsOptions.TableName != nil { - builder.AddQuery("table_name", fmt.Sprint(*getAllColumnsOptions.TableName)) - } - if getAllColumnsOptions.CatalogName != nil { - builder.AddQuery("catalog_name", fmt.Sprint(*getAllColumnsOptions.CatalogName)) - } - if getAllColumnsOptions.SchemaName != nil { - builder.AddQuery("schema_name", fmt.Sprint(*getAllColumnsOptions.SchemaName)) + if deleteDataPoliciesOptions.Policies != nil { + builder.AddQuery("policies", fmt.Sprint(*deleteDataPoliciesOptions.Policies)) } request, err := builder.Build() @@ -11237,65 +11903,61 @@ func (watsonxData *WatsonxDataV2) GetAllColumnsWithContext(ctx context.Context, return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "get_all_columns", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_data_policies", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalColumnsResponse) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// ListAllSchemas : Get all schemas for a given catalog -// List Schemas for a catalog with the given catalog_name. -func (watsonxData *WatsonxDataV2) ListAllSchemas(listAllSchemasOptions *ListAllSchemasOptions) (result *SchemaResponseCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListAllSchemasWithContext(context.Background(), listAllSchemasOptions) +// GetDataPolicy : Get data policy +// Get a data policy details by passing data policy name as path param. +func (watsonxData *WatsonxDataV3) GetDataPolicy(getDataPolicyOptions *GetDataPolicyOptions) (result *PolicyV2, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.GetDataPolicyWithContext(context.Background(), getDataPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListAllSchemasWithContext is an alternate form of the ListAllSchemas method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListAllSchemasWithContext(ctx context.Context, listAllSchemasOptions *ListAllSchemasOptions) (result *SchemaResponseCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listAllSchemasOptions, "listAllSchemasOptions") +// GetDataPolicyWithContext is an alternate form of the GetDataPolicy method which supports a Context parameter +func (watsonxData *WatsonxDataV3) GetDataPolicyWithContext(ctx context.Context, getDataPolicyOptions *GetDataPolicyOptions) (result *PolicyV2, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDataPolicyOptions, "getDataPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(getDataPolicyOptions, "getDataPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } + pathParamsMap := map[string]string{ + "name": *getDataPolicyOptions.Name, + } + builder := core.NewRequestBuilder(core.GET) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/schemas`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v1/access/data_policies/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listAllSchemasOptions.Headers { + for headerName, headerValue := range getDataPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListAllSchemas") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "GetDataPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if listAllSchemasOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listAllSchemasOptions.AuthInstanceID)) - } - - if listAllSchemasOptions.CatalogName != nil { - builder.AddQuery("catalog_name", fmt.Sprint(*listAllSchemasOptions.CatalogName)) + if getDataPolicyOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*getDataPolicyOptions.AuthInstanceID)) } request, err := builder.Build() @@ -11307,12 +11969,12 @@ func (watsonxData *WatsonxDataV2) ListAllSchemasWithContext(ctx context.Context, var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "list_all_schemas", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "get_data_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSchemaResponseCollection) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPolicyV2) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11323,55 +11985,84 @@ func (watsonxData *WatsonxDataV2) ListAllSchemasWithContext(ctx context.Context, return } -// GetSchemaDetails : Get schema details -// Get schema details. -func (watsonxData *WatsonxDataV2) GetSchemaDetails(getSchemaDetailsOptions *GetSchemaDetailsOptions) (result *SchemaResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetSchemaDetailsWithContext(context.Background(), getSchemaDetailsOptions) +// ReplaceDataPolicy : Replace data policy +// Replaces existing data policy details with the specified details. You require catalog `can_administer` permission to +// perform this action. +func (watsonxData *WatsonxDataV3) ReplaceDataPolicy(replaceDataPolicyOptions *ReplaceDataPolicyOptions) (result *PolicyV2, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.ReplaceDataPolicyWithContext(context.Background(), replaceDataPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetSchemaDetailsWithContext is an alternate form of the GetSchemaDetails method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetSchemaDetailsWithContext(ctx context.Context, getSchemaDetailsOptions *GetSchemaDetailsOptions) (result *SchemaResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getSchemaDetailsOptions, "getSchemaDetailsOptions cannot be nil") +// ReplaceDataPolicyWithContext is an alternate form of the ReplaceDataPolicy method which supports a Context parameter +func (watsonxData *WatsonxDataV3) ReplaceDataPolicyWithContext(ctx context.Context, replaceDataPolicyOptions *ReplaceDataPolicyOptions) (result *PolicyV2, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceDataPolicyOptions, "replaceDataPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getSchemaDetailsOptions, "getSchemaDetailsOptions") + err = core.ValidateStruct(replaceDataPolicyOptions, "replaceDataPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "schema_name": *getSchemaDetailsOptions.SchemaName, + "name": *replaceDataPolicyOptions.Name, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PUT) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/schemas/{schema_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v1/access/data_policies/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getSchemaDetailsOptions.Headers { + for headerName, headerValue := range replaceDataPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetSchemaDetails") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "ReplaceDataPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getSchemaDetailsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getSchemaDetailsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json") + if replaceDataPolicyOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*replaceDataPolicyOptions.AuthInstanceID)) } - if getSchemaDetailsOptions.CatalogName != nil { - builder.AddQuery("catalog_name", fmt.Sprint(*getSchemaDetailsOptions.CatalogName)) + body := make(map[string]interface{}) + if replaceDataPolicyOptions.DataArtifact != nil { + body["data_artifact"] = replaceDataPolicyOptions.DataArtifact + } + if replaceDataPolicyOptions.Rules != nil { + body["rules"] = replaceDataPolicyOptions.Rules + } + if replaceDataPolicyOptions.CatalogName != nil { + body["catalog_name"] = replaceDataPolicyOptions.CatalogName + } + if replaceDataPolicyOptions.CatalogType != nil { + body["catalog_type"] = replaceDataPolicyOptions.CatalogType + } + if replaceDataPolicyOptions.Description != nil { + body["description"] = replaceDataPolicyOptions.Description + } + if replaceDataPolicyOptions.PolicyName != nil { + body["policy_name"] = replaceDataPolicyOptions.PolicyName + } + if replaceDataPolicyOptions.ResourceID != nil { + body["resource_id"] = replaceDataPolicyOptions.ResourceID + } + if replaceDataPolicyOptions.Status != nil { + body["status"] = replaceDataPolicyOptions.Status + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -11383,12 +12074,12 @@ func (watsonxData *WatsonxDataV2) GetSchemaDetailsWithContext(ctx context.Contex var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_schema_details", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "replace_data_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSchemaResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPolicyV2) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11399,49 +12090,51 @@ func (watsonxData *WatsonxDataV2) GetSchemaDetailsWithContext(ctx context.Contex return } -// ListAllTables : Get all tables -// Get all tables. -func (watsonxData *WatsonxDataV2) ListAllTables(listAllTablesOptions *ListAllTablesOptions) (result *TableResponseCollection, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.ListAllTablesWithContext(context.Background(), listAllTablesOptions) +// DeleteDataPolicy : Delete a data policy +// Delete a data policy by passing data policy name. You require catalog `can_administer` permission to perform this +// action. +func (watsonxData *WatsonxDataV3) DeleteDataPolicy(deleteDataPolicyOptions *DeleteDataPolicyOptions) (response *core.DetailedResponse, err error) { + response, err = watsonxData.DeleteDataPolicyWithContext(context.Background(), deleteDataPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// ListAllTablesWithContext is an alternate form of the ListAllTables method which supports a Context parameter -func (watsonxData *WatsonxDataV2) ListAllTablesWithContext(ctx context.Context, listAllTablesOptions *ListAllTablesOptions) (result *TableResponseCollection, response *core.DetailedResponse, err error) { - err = core.ValidateStruct(listAllTablesOptions, "listAllTablesOptions") +// DeleteDataPolicyWithContext is an alternate form of the DeleteDataPolicy method which supports a Context parameter +func (watsonxData *WatsonxDataV3) DeleteDataPolicyWithContext(ctx context.Context, deleteDataPolicyOptions *DeleteDataPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDataPolicyOptions, "deleteDataPolicyOptions cannot be nil") + if err != nil { + err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) + return + } + err = core.ValidateStruct(deleteDataPolicyOptions, "deleteDataPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } - builder := core.NewRequestBuilder(core.GET) + pathParamsMap := map[string]string{ + "name": *deleteDataPolicyOptions.Name, + } + + builder := core.NewRequestBuilder(core.DELETE) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/tables`, nil) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v1/access/data_policies/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range listAllTablesOptions.Headers { + for headerName, headerValue := range deleteDataPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "ListAllTables") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "DeleteDataPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } - builder.AddHeader("Accept", "application/json") - if listAllTablesOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*listAllTablesOptions.AuthInstanceID)) - } - - if listAllTablesOptions.CatalogName != nil { - builder.AddQuery("catalog_name", fmt.Sprint(*listAllTablesOptions.CatalogName)) - } - if listAllTablesOptions.SchemaName != nil { - builder.AddQuery("schema_name", fmt.Sprint(*listAllTablesOptions.SchemaName)) + if deleteDataPolicyOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*deleteDataPolicyOptions.AuthInstanceID)) } request, err := builder.Build() @@ -11450,77 +12143,69 @@ func (watsonxData *WatsonxDataV2) ListAllTablesWithContext(ctx context.Context, return } - var rawResponse map[string]json.RawMessage - response, err = watsonxData.Service.Request(request, &rawResponse) + response, err = watsonxData.Service.Request(request, nil) if err != nil { - core.EnrichHTTPProblem(err, "list_all_tables", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "delete_data_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } - if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTableResponseCollection) - if err != nil { - err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) - return - } - response.Result = result - } return } -// GetTableDetails : Get table details -// Get table details. -func (watsonxData *WatsonxDataV2) GetTableDetails(getTableDetailsOptions *GetTableDetailsOptions) (result *TableResponse, response *core.DetailedResponse, err error) { - result, response, err = watsonxData.GetTableDetailsWithContext(context.Background(), getTableDetailsOptions) +// UpdateDataPolicy : Update data policy +// Update data policy. Currently, you can update only users/groups in the data policy rules. You require +// `can_administer` permission to perform this action. +func (watsonxData *WatsonxDataV3) UpdateDataPolicy(updateDataPolicyOptions *UpdateDataPolicyOptions) (result *PolicyV2, response *core.DetailedResponse, err error) { + result, response, err = watsonxData.UpdateDataPolicyWithContext(context.Background(), updateDataPolicyOptions) err = core.RepurposeSDKProblem(err, "") return } -// GetTableDetailsWithContext is an alternate form of the GetTableDetails method which supports a Context parameter -func (watsonxData *WatsonxDataV2) GetTableDetailsWithContext(ctx context.Context, getTableDetailsOptions *GetTableDetailsOptions) (result *TableResponse, response *core.DetailedResponse, err error) { - err = core.ValidateNotNil(getTableDetailsOptions, "getTableDetailsOptions cannot be nil") +// UpdateDataPolicyWithContext is an alternate form of the UpdateDataPolicy method which supports a Context parameter +func (watsonxData *WatsonxDataV3) UpdateDataPolicyWithContext(ctx context.Context, updateDataPolicyOptions *UpdateDataPolicyOptions) (result *PolicyV2, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDataPolicyOptions, "updateDataPolicyOptions cannot be nil") if err != nil { err = core.SDKErrorf(err, "", "unexpected-nil-param", common.GetComponentInfo()) return } - err = core.ValidateStruct(getTableDetailsOptions, "getTableDetailsOptions") + err = core.ValidateStruct(updateDataPolicyOptions, "updateDataPolicyOptions") if err != nil { err = core.SDKErrorf(err, "", "struct-validation-error", common.GetComponentInfo()) return } pathParamsMap := map[string]string{ - "table_name": *getTableDetailsOptions.TableName, + "name": *updateDataPolicyOptions.Name, } - builder := core.NewRequestBuilder(core.GET) + builder := core.NewRequestBuilder(core.PATCH) builder = builder.WithContext(ctx) builder.EnableGzipCompression = watsonxData.GetEnableGzipCompression() - _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/tables/{table_name}`, pathParamsMap) + _, err = builder.ResolveRequestURL(watsonxData.Service.Options.URL, `/v1/access/data_policies/{name}`, pathParamsMap) if err != nil { err = core.SDKErrorf(err, "", "url-resolve-error", common.GetComponentInfo()) return } - for headerName, headerValue := range getTableDetailsOptions.Headers { + for headerName, headerValue := range updateDataPolicyOptions.Headers { builder.AddHeader(headerName, headerValue) } - sdkHeaders := common.GetSdkHeaders("watsonx_data", "V2", "GetTableDetails") + sdkHeaders := common.GetSdkHeaders("watsonx_data", "V3", "UpdateDataPolicy") for headerName, headerValue := range sdkHeaders { builder.AddHeader(headerName, headerValue) } builder.AddHeader("Accept", "application/json") - if getTableDetailsOptions.AuthInstanceID != nil { - builder.AddHeader("AuthInstanceId", fmt.Sprint(*getTableDetailsOptions.AuthInstanceID)) + builder.AddHeader("Content-Type", "application/json-patch+json") + if updateDataPolicyOptions.AuthInstanceID != nil { + builder.AddHeader("AuthInstanceId", fmt.Sprint(*updateDataPolicyOptions.AuthInstanceID)) } - if getTableDetailsOptions.CatalogName != nil { - builder.AddQuery("catalog_name", fmt.Sprint(*getTableDetailsOptions.CatalogName)) - } - if getTableDetailsOptions.SchemaName != nil { - builder.AddQuery("schema_name", fmt.Sprint(*getTableDetailsOptions.SchemaName)) + _, err = builder.SetBodyContentJSON(updateDataPolicyOptions.Body) + if err != nil { + err = core.SDKErrorf(err, "", "set-json-body-error", common.GetComponentInfo()) + return } request, err := builder.Build() @@ -11532,12 +12217,12 @@ func (watsonxData *WatsonxDataV2) GetTableDetailsWithContext(ctx context.Context var rawResponse map[string]json.RawMessage response, err = watsonxData.Service.Request(request, &rawResponse) if err != nil { - core.EnrichHTTPProblem(err, "get_table_details", getServiceComponentInfo()) + core.EnrichHTTPProblem(err, "update_data_policy", getServiceComponentInfo()) err = core.SDKErrorf(err, "", "http-request-err", common.GetComponentInfo()) return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTableResponse) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPolicyV2) if err != nil { err = core.SDKErrorf(err, "", "unmarshal-resp-error", common.GetComponentInfo()) return @@ -11548,615 +12233,853 @@ func (watsonxData *WatsonxDataV2) GetTableDetailsWithContext(ctx context.Context return } func getServiceComponentInfo() *core.ProblemComponent { - return core.NewProblemComponent(DefaultServiceName, "2.0.0") + return core.NewProblemComponent(DefaultServiceName, "3.0.0") } -// AddBucketCatalogOptions : The AddBucketCatalog options. -type AddBucketCatalogOptions struct { - // bucket id. - BucketID *string `json:"bucket_id" validate:"required,ne="` - - // catalog base path. - BasePath *string `json:"base_path,omitempty"` +// AccessPolicies : A list of access policies applied to users and user groups for the specified resources. +type AccessPolicies struct { + // Array of access policies. Each access policy contains metadata, permission,resource, state and subject. + AccessPolicies []AccessPolicy `json:"access_policies" validate:"required"` - // catalog name. - CatalogName *string `json:"catalog_name,omitempty"` + // account id of the logged in user. + AccountID *string `json:"account_id,omitempty"` - // catalog tags. - CatalogTags []string `json:"catalog_tags,omitempty"` + // Unique identifier assigned to a specific watsonx.data instance. + InstanceID *string `json:"instance_id,omitempty"` - // catalog type. - CatalogType *string `json:"catalog_type,omitempty"` + // maximum number of records in a page. + Limit *int64 `json:"limit,omitempty"` - // watsonx.data instance ID. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // number of records to skip from the start of the list. + Offset *int64 `json:"offset,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // Total number of access policies matching the query criteria across all pages. This value represents the complete + // count of policies in the system and is used for pagination calculations. + TotalCount *int64 `json:"total_count,omitempty"` } -// NewAddBucketCatalogOptions : Instantiate AddBucketCatalogOptions -func (*WatsonxDataV2) NewAddBucketCatalogOptions(bucketID string) *AddBucketCatalogOptions { - return &AddBucketCatalogOptions{ - BucketID: core.StringPtr(bucketID), +// UnmarshalAccessPolicies unmarshals an instance of AccessPolicies from the specified map of raw messages. +func UnmarshalAccessPolicies(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccessPolicies) + err = core.UnmarshalModel(m, "access_policies", &obj.AccessPolicies, UnmarshalAccessPolicy) + if err != nil { + err = core.SDKErrorf(err, "", "access_policies-error", common.GetComponentInfo()) + return } -} - -// SetBucketID : Allow user to set BucketID -func (_options *AddBucketCatalogOptions) SetBucketID(bucketID string) *AddBucketCatalogOptions { - _options.BucketID = core.StringPtr(bucketID) - return _options -} - -// SetBasePath : Allow user to set BasePath -func (_options *AddBucketCatalogOptions) SetBasePath(basePath string) *AddBucketCatalogOptions { - _options.BasePath = core.StringPtr(basePath) - return _options -} - -// SetCatalogName : Allow user to set CatalogName -func (_options *AddBucketCatalogOptions) SetCatalogName(catalogName string) *AddBucketCatalogOptions { - _options.CatalogName = core.StringPtr(catalogName) - return _options -} - -// SetCatalogTags : Allow user to set CatalogTags -func (_options *AddBucketCatalogOptions) SetCatalogTags(catalogTags []string) *AddBucketCatalogOptions { - _options.CatalogTags = catalogTags - return _options -} - -// SetCatalogType : Allow user to set CatalogType -func (_options *AddBucketCatalogOptions) SetCatalogType(catalogType string) *AddBucketCatalogOptions { - _options.CatalogType = core.StringPtr(catalogType) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *AddBucketCatalogOptions) SetAuthInstanceID(authInstanceID string) *AddBucketCatalogOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *AddBucketCatalogOptions) SetHeaders(param map[string]string) *AddBucketCatalogOptions { - options.Headers = param - return options -} - -// BucketCatalog : bucket catalog. -type BucketCatalog struct { - // catalog base path. - BasePath *string `json:"base_path,omitempty"` - - // catalog name. - CatalogName *string `json:"catalog_name,omitempty"` - - // catalog tags. - CatalogTags []string `json:"catalog_tags,omitempty"` - - // catalog type. - CatalogType *string `json:"catalog_type,omitempty"` -} - -// UnmarshalBucketCatalog unmarshals an instance of BucketCatalog from the specified map of raw messages. -func UnmarshalBucketCatalog(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BucketCatalog) - err = core.UnmarshalPrimitive(m, "base_path", &obj.BasePath) + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) if err != nil { - err = core.SDKErrorf(err, "", "base_path-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "account_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) if err != nil { - err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "catalog_tags", &obj.CatalogTags) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "catalog_tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "catalog_type", &obj.CatalogType) + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) if err != nil { - err = core.SDKErrorf(err, "", "catalog_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "offset-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BucketDetails : bucket details. -type BucketDetails struct { - // Access key ID, encrypted during bucket registration. - AccessKey *string `json:"access_key,omitempty"` - - // actual bucket name. - BucketName *string `json:"bucket_name" validate:"required"` - - // Cos endpoint. - Endpoint *string `json:"endpoint,omitempty"` - - // Key file, encrypted during bucket registration. - KeyFile *string `json:"key_file,omitempty"` - - // bucket provider. - Provider *string `json:"provider,omitempty"` - - // Region where the bucket is located. - Region *string `json:"region,omitempty"` +// AccessPoliciesSearch : Access Policies search request object which contains resources and subjects (users and user groups) to which the +// access policy . +type AccessPoliciesSearch struct { + // List of resources to which the access policies should be applied. + Resources []ResourceDetails `json:"resources,omitempty"` - // Secret access key, encrypted during bucket registration. - SecretKey *string `json:"secret_key,omitempty"` + // List of subjects (users and user groups) to which the access policy applies, along with the specified permissions. + SubjectsToSearch []Subject `json:"subjects_to_search,omitempty"` } -// NewBucketDetails : Instantiate BucketDetails (Generic Model Constructor) -func (*WatsonxDataV2) NewBucketDetails(bucketName string) (_model *BucketDetails, err error) { - _model = &BucketDetails{ - BucketName: core.StringPtr(bucketName), +// UnmarshalAccessPoliciesSearch unmarshals an instance of AccessPoliciesSearch from the specified map of raw messages. +func UnmarshalAccessPoliciesSearch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccessPoliciesSearch) + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalResourceDetails) + if err != nil { + err = core.SDKErrorf(err, "", "resources-error", common.GetComponentInfo()) + return } - err = core.ValidateStruct(_model, "required parameters") + err = core.UnmarshalModel(m, "subjects_to_search", &obj.SubjectsToSearch, UnmarshalSubject) if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subjects_to_search-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// UnmarshalBucketDetails unmarshals an instance of BucketDetails from the specified map of raw messages. -func UnmarshalBucketDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BucketDetails) - err = core.UnmarshalPrimitive(m, "access_key", &obj.AccessKey) +// AccessPolicy : access policy details of the provided resource type and resource id or name. This details include metadata, +// permissions, resource, state and subject. +type AccessPolicy struct { + // metadata of each access policy such as created at, created by, last modified at and last modified by. + Metadata *Metadata `json:"metadata,omitempty"` + + // the permissions the given user or group has, on the provided resource. + Permissions []Permission `json:"permissions" validate:"required"` + + // This resource details contain resource type and resource id or name. + Resource *ResourceDetails `json:"resource,omitempty"` + + // state of each policy. It can be either active or inactive. + State *string `json:"state" validate:"required"` + + // subject can be user or group who can access on the provided resource. + Subject *Subject `json:"subject,omitempty"` +} + +// Constants associated with the AccessPolicy.State property. +// state of each policy. It can be either active or inactive. +const ( + AccessPolicy_State_Active = "active" + AccessPolicy_State_Inactive = "inactive" +) + +// UnmarshalAccessPolicy unmarshals an instance of AccessPolicy from the specified map of raw messages. +func UnmarshalAccessPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccessPolicy) + err = core.UnmarshalModel(m, "metadata", &obj.Metadata, UnmarshalMetadata) if err != nil { - err = core.SDKErrorf(err, "", "access_key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "metadata-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "bucket_name", &obj.BucketName) + err = core.UnmarshalModel(m, "permissions", &obj.Permissions, UnmarshalPermission) if err != nil { - err = core.SDKErrorf(err, "", "bucket_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "permissions-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) + err = core.UnmarshalModel(m, "resource", &obj.Resource, UnmarshalResourceDetails) if err != nil { - err = core.SDKErrorf(err, "", "endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "key_file", &obj.KeyFile) + err = core.UnmarshalPrimitive(m, "state", &obj.State) if err != nil { - err = core.SDKErrorf(err, "", "key_file-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "provider", &obj.Provider) + err = core.UnmarshalModel(m, "subject", &obj.Subject, UnmarshalSubject) if err != nil { - err = core.SDKErrorf(err, "", "provider-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subject-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "region", &obj.Region) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AccessPolicyBulkUpdate : Add or update the access permissions of the specified users and user groups on the provided resource. +type AccessPolicyBulkUpdate struct { + // List of resources to which the access policies should be applied. + Resources []ResourceDetailsBulkUpdate `json:"resources,omitempty"` + + // List of subjects (users and user groups) to which the access policy applies, along with the specified permissions. + Subjects []SubjectBulkUpdate `json:"subjects,omitempty"` +} + +// UnmarshalAccessPolicyBulkUpdate unmarshals an instance of AccessPolicyBulkUpdate from the specified map of raw messages. +func UnmarshalAccessPolicyBulkUpdate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccessPolicyBulkUpdate) + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalResourceDetailsBulkUpdate) if err != nil { - err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resources-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "secret_key", &obj.SecretKey) + err = core.UnmarshalModel(m, "subjects", &obj.Subjects, UnmarshalSubjectBulkUpdate) if err != nil { - err = core.SDKErrorf(err, "", "secret_key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subjects-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the BucketDetails -func (bucketDetails *BucketDetails) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(bucketDetails.AccessKey) { - _patch["access_key"] = bucketDetails.AccessKey - } - if !core.IsNil(bucketDetails.BucketName) { - _patch["bucket_name"] = bucketDetails.BucketName - } - if !core.IsNil(bucketDetails.Endpoint) { - _patch["endpoint"] = bucketDetails.Endpoint +// AccessPolicyBulkUpdateData : access policy details of the provided resource type and resource id or name. This details include metadata, +// permissions, resource, state and subject. +type AccessPolicyBulkUpdateData struct { + // metadata of each access policy such as created at, created by, last modified at and last modified by. + Metadata *Metadata `json:"metadata,omitempty"` + + // the permissions the given user or group has, on the provided resource. + Permissions []Permission `json:"permissions" validate:"required"` + + // This resource details contain resource type and resource id or name. + Resource *ResourceDetailsBulkUpdate `json:"resource,omitempty"` + + // state of each policy. It can be either active or inactive. + State *string `json:"state" validate:"required"` + + // subject can be user or group who can access on the provided resource. + Subject *SubjectBulkUpdateData `json:"subject,omitempty"` +} + +// Constants associated with the AccessPolicyBulkUpdateData.State property. +// state of each policy. It can be either active or inactive. +const ( + AccessPolicyBulkUpdateData_State_Active = "active" + AccessPolicyBulkUpdateData_State_Inactive = "inactive" +) + +// UnmarshalAccessPolicyBulkUpdateData unmarshals an instance of AccessPolicyBulkUpdateData from the specified map of raw messages. +func UnmarshalAccessPolicyBulkUpdateData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccessPolicyBulkUpdateData) + err = core.UnmarshalModel(m, "metadata", &obj.Metadata, UnmarshalMetadata) + if err != nil { + err = core.SDKErrorf(err, "", "metadata-error", common.GetComponentInfo()) + return } - if !core.IsNil(bucketDetails.KeyFile) { - _patch["key_file"] = bucketDetails.KeyFile + err = core.UnmarshalModel(m, "permissions", &obj.Permissions, UnmarshalPermission) + if err != nil { + err = core.SDKErrorf(err, "", "permissions-error", common.GetComponentInfo()) + return } - if !core.IsNil(bucketDetails.Provider) { - _patch["provider"] = bucketDetails.Provider + err = core.UnmarshalModel(m, "resource", &obj.Resource, UnmarshalResourceDetailsBulkUpdate) + if err != nil { + err = core.SDKErrorf(err, "", "resource-error", common.GetComponentInfo()) + return } - if !core.IsNil(bucketDetails.Region) { - _patch["region"] = bucketDetails.Region + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) + return } - if !core.IsNil(bucketDetails.SecretKey) { - _patch["secret_key"] = bucketDetails.SecretKey + err = core.UnmarshalModel(m, "subject", &obj.Subject, UnmarshalSubjectBulkUpdateData) + if err != nil { + err = core.SDKErrorf(err, "", "subject-error", common.GetComponentInfo()) + return } - + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BucketObjectProperties : muliple bucket object properties. -type BucketObjectProperties struct { - // muliple bucket object properties. - ObjectProperties []BucketRegistrationObjectSizeCollection `json:"object_properties,omitempty"` +// AccessPolicyBulkUpdateResponse : A list of access policies applied to users and user groups for the specified resources after. +type AccessPolicyBulkUpdateResponse struct { + // Array of access policies. Each access policy contains metadata, permission,resource, state and subject. + AccessPolicies []AccessPolicyBulkUpdateData `json:"access_policies" validate:"required"` + + // account id of the logged in user. + AccountID *string `json:"account_id,omitempty"` + + // Unique identifier assigned to a specific watsonx.data instance. + InstanceID *string `json:"instance_id,omitempty"` } -// UnmarshalBucketObjectProperties unmarshals an instance of BucketObjectProperties from the specified map of raw messages. -func UnmarshalBucketObjectProperties(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BucketObjectProperties) - err = core.UnmarshalModel(m, "object_properties", &obj.ObjectProperties, UnmarshalBucketRegistrationObjectSizeCollection) +// UnmarshalAccessPolicyBulkUpdateResponse unmarshals an instance of AccessPolicyBulkUpdateResponse from the specified map of raw messages. +func UnmarshalAccessPolicyBulkUpdateResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccessPolicyBulkUpdateResponse) + err = core.UnmarshalModel(m, "access_policies", &obj.AccessPolicies, UnmarshalAccessPolicyBulkUpdateData) if err != nil { - err = core.SDKErrorf(err, "", "object_properties-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "access_policies-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) + if err != nil { + err = core.SDKErrorf(err, "", "account_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) + if err != nil { + err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BucketRegistration : Bucket. -type BucketRegistration struct { - // Actions. - Actions []string `json:"actions,omitempty"` +// AddDatabaseCatalogOptions : The AddDatabaseCatalog options. +type AddDatabaseCatalogOptions struct { + // database id. + DatabaseID *string `json:"database_id" validate:"required,ne="` - // bucket catalog. - AssociatedCatalog *BucketCatalog `json:"associated_catalog" validate:"required"` + // catalog name. + CatalogName *string `json:"catalog_name,omitempty"` - // bucket details. - BucketDetails *BucketDetails `json:"bucket_details,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // bucket display name. - BucketDisplayName *string `json:"bucket_display_name,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string +} - // bucket ID auto generated during bucket registration. - BucketID *string `json:"bucket_id,omitempty"` +// NewAddDatabaseCatalogOptions : Instantiate AddDatabaseCatalogOptions +func (*WatsonxDataV3) NewAddDatabaseCatalogOptions(databaseID string) *AddDatabaseCatalogOptions { + return &AddDatabaseCatalogOptions{ + DatabaseID: core.StringPtr(databaseID), + } +} - // bucket type. - BucketType *string `json:"bucket_type" validate:"required"` +// SetDatabaseID : Allow user to set DatabaseID +func (_options *AddDatabaseCatalogOptions) SetDatabaseID(databaseID string) *AddDatabaseCatalogOptions { + _options.DatabaseID = core.StringPtr(databaseID) + return _options +} - // Username who created the bucket. - CreatedBy *string `json:"created_by" validate:"required"` +// SetCatalogName : Allow user to set CatalogName +func (_options *AddDatabaseCatalogOptions) SetCatalogName(catalogName string) *AddDatabaseCatalogOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options +} - // Creation date. - CreatedOn *string `json:"created_on" validate:"required"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *AddDatabaseCatalogOptions) SetAuthInstanceID(authInstanceID string) *AddDatabaseCatalogOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // bucket description. - Description *string `json:"description" validate:"required"` +// SetHeaders : Allow user to set Headers +func (options *AddDatabaseCatalogOptions) SetHeaders(param map[string]string) *AddDatabaseCatalogOptions { + options.Headers = param + return options +} - // managed by. - ManagedBy *string `json:"managed_by" validate:"required"` +// AddStorageCatalogOptions : The AddStorageCatalog options. +type AddStorageCatalogOptions struct { + // storage id. + StorageID *string `json:"storage_id" validate:"required,ne="` - // Region where the bucket is located. - Region *string `json:"region,omitempty"` + // catalog tags. + CatalogTags []string `json:"catalog_tags" validate:"required"` - // mark bucket active or inactive. - State *string `json:"state" validate:"required"` + // catalog base path. + BasePath *string `json:"base_path,omitempty"` - // storage details. - StorageDetails *StorageDetails `json:"storage_details,omitempty"` + // catalog name. + CatalogName *string `json:"catalog_name,omitempty"` - // tags. - Tags []string `json:"tags,omitempty"` + // catalog type. + CatalogType *string `json:"catalog_type,omitempty"` + + // Skip MDS call when Unity catalog is added. + SkipMdsCall *bool `json:"skip_mds_call,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string } -// Constants associated with the BucketRegistration.BucketType property. -// bucket type. -const ( - BucketRegistration_BucketType_AdlsGen1 = "adls_gen1" - BucketRegistration_BucketType_AdlsGen2 = "adls_gen2" - BucketRegistration_BucketType_AmazonS3 = "amazon_s3" - BucketRegistration_BucketType_AwsS3 = "aws_s3" - BucketRegistration_BucketType_GoogleCs = "google_cs" - BucketRegistration_BucketType_IbmCeph = "ibm_ceph" - BucketRegistration_BucketType_IbmCos = "ibm_cos" - BucketRegistration_BucketType_Minio = "minio" -) +// NewAddStorageCatalogOptions : Instantiate AddStorageCatalogOptions +func (*WatsonxDataV3) NewAddStorageCatalogOptions(storageID string, catalogTags []string) *AddStorageCatalogOptions { + return &AddStorageCatalogOptions{ + StorageID: core.StringPtr(storageID), + CatalogTags: catalogTags, + } +} -// Constants associated with the BucketRegistration.ManagedBy property. -// managed by. -const ( - BucketRegistration_ManagedBy_Customer = "customer" - BucketRegistration_ManagedBy_Ibm = "ibm" -) +// SetStorageID : Allow user to set StorageID +func (_options *AddStorageCatalogOptions) SetStorageID(storageID string) *AddStorageCatalogOptions { + _options.StorageID = core.StringPtr(storageID) + return _options +} -// Constants associated with the BucketRegistration.State property. -// mark bucket active or inactive. -const ( - BucketRegistration_State_Active = "active" - BucketRegistration_State_Inactive = "inactive" -) +// SetCatalogTags : Allow user to set CatalogTags +func (_options *AddStorageCatalogOptions) SetCatalogTags(catalogTags []string) *AddStorageCatalogOptions { + _options.CatalogTags = catalogTags + return _options +} -// UnmarshalBucketRegistration unmarshals an instance of BucketRegistration from the specified map of raw messages. -func UnmarshalBucketRegistration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BucketRegistration) - err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) +// SetBasePath : Allow user to set BasePath +func (_options *AddStorageCatalogOptions) SetBasePath(basePath string) *AddStorageCatalogOptions { + _options.BasePath = core.StringPtr(basePath) + return _options +} + +// SetCatalogName : Allow user to set CatalogName +func (_options *AddStorageCatalogOptions) SetCatalogName(catalogName string) *AddStorageCatalogOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options +} + +// SetCatalogType : Allow user to set CatalogType +func (_options *AddStorageCatalogOptions) SetCatalogType(catalogType string) *AddStorageCatalogOptions { + _options.CatalogType = core.StringPtr(catalogType) + return _options +} + +// SetSkipMdsCall : Allow user to set SkipMdsCall +func (_options *AddStorageCatalogOptions) SetSkipMdsCall(skipMdsCall bool) *AddStorageCatalogOptions { + _options.SkipMdsCall = core.BoolPtr(skipMdsCall) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *AddStorageCatalogOptions) SetAuthInstanceID(authInstanceID string) *AddStorageCatalogOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *AddStorageCatalogOptions) SetHeaders(param map[string]string) *AddStorageCatalogOptions { + options.Headers = param + return options +} + +// AutoScalingConfig : Autoscaling configuration for engine. +type AutoScalingConfig struct { + // Target CPU utilization percentage. + Target *int64 `json:"target,omitempty"` + + // Minimum number of worker nodes. + MinWorkerQuantity *int64 `json:"min_worker_quantity,omitempty"` + + // Maximum number of worker nodes. + MaxWorkerQuantity *int64 `json:"max_worker_quantity,omitempty"` + + // Grace period in minutes before terminating queries. + QueryTerminationGracePeriodMin *int64 `json:"query_termination_grace_period_min,omitempty"` + + // Stabilization window in minutes for scale-in. + ScaleInStabilizationWindowMin *int64 `json:"scale_in_stabilization_window_min,omitempty"` + + // Number of nodes to add/remove per scaling action. + ScalingStepSize *int64 `json:"scaling_step_size,omitempty"` +} + +// UnmarshalAutoScalingConfig unmarshals an instance of AutoScalingConfig from the specified map of raw messages. +func UnmarshalAutoScalingConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AutoScalingConfig) + err = core.UnmarshalPrimitive(m, "target", &obj.Target) if err != nil { - err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "associated_catalog", &obj.AssociatedCatalog, UnmarshalBucketCatalog) + err = core.UnmarshalPrimitive(m, "min_worker_quantity", &obj.MinWorkerQuantity) if err != nil { - err = core.SDKErrorf(err, "", "associated_catalog-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "min_worker_quantity-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "bucket_details", &obj.BucketDetails, UnmarshalBucketDetails) + err = core.UnmarshalPrimitive(m, "max_worker_quantity", &obj.MaxWorkerQuantity) if err != nil { - err = core.SDKErrorf(err, "", "bucket_details-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "max_worker_quantity-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "bucket_display_name", &obj.BucketDisplayName) + err = core.UnmarshalPrimitive(m, "query_termination_grace_period_min", &obj.QueryTerminationGracePeriodMin) if err != nil { - err = core.SDKErrorf(err, "", "bucket_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "query_termination_grace_period_min-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "bucket_id", &obj.BucketID) + err = core.UnmarshalPrimitive(m, "scale_in_stabilization_window_min", &obj.ScaleInStabilizationWindowMin) if err != nil { - err = core.SDKErrorf(err, "", "bucket_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "scale_in_stabilization_window_min-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "bucket_type", &obj.BucketType) + err = core.UnmarshalPrimitive(m, "scaling_step_size", &obj.ScalingStepSize) if err != nil { - err = core.SDKErrorf(err, "", "bucket_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "scaling_step_size-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the AutoScalingConfig +func (autoScalingConfig *AutoScalingConfig) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(autoScalingConfig.Target) { + _patch["target"] = autoScalingConfig.Target + } + if !core.IsNil(autoScalingConfig.MinWorkerQuantity) { + _patch["min_worker_quantity"] = autoScalingConfig.MinWorkerQuantity + } + if !core.IsNil(autoScalingConfig.MaxWorkerQuantity) { + _patch["max_worker_quantity"] = autoScalingConfig.MaxWorkerQuantity + } + if !core.IsNil(autoScalingConfig.QueryTerminationGracePeriodMin) { + _patch["query_termination_grace_period_min"] = autoScalingConfig.QueryTerminationGracePeriodMin + } + if !core.IsNil(autoScalingConfig.ScaleInStabilizationWindowMin) { + _patch["scale_in_stabilization_window_min"] = autoScalingConfig.ScaleInStabilizationWindowMin + } + if !core.IsNil(autoScalingConfig.ScalingStepSize) { + _patch["scaling_step_size"] = autoScalingConfig.ScalingStepSize + } + + return +} + +// AutoscalingConfig : Autoscaling configuration for the engine. +type AutoscalingConfig struct { + // Autoscaling type. + Type *string `json:"type" validate:"required"` + + // Target utilization percentage. + Target *int64 `json:"target,omitempty"` + + // Minimum number of worker nodes. + MinWorkerQuantity *int64 `json:"min_worker_quantity,omitempty"` + + // Maximum number of worker nodes. + MaxWorkerQuantity *int64 `json:"max_worker_quantity,omitempty"` + + // Grace period in minutes before terminating queries. + QueryTerminationGracePeriodMin *int64 `json:"query_termination_grace_period_min,omitempty"` + + // Stabilization window in minutes for scale-in. + ScaleInStabilizationWindowMin *int64 `json:"scale_in_stabilization_window_min,omitempty"` + + // Number of nodes to add/remove per scaling action. + ScalingStepSize *int64 `json:"scaling_step_size,omitempty"` +} + +// Constants associated with the AutoscalingConfig.Type property. +// Autoscaling type. +const ( + AutoscalingConfig_Type_Cpu = "cpu" + AutoscalingConfig_Type_Memory = "memory" +) + +// NewAutoscalingConfig : Instantiate AutoscalingConfig (Generic Model Constructor) +func (*WatsonxDataV3) NewAutoscalingConfig(typeVar string) (_model *AutoscalingConfig, err error) { + _model = &AutoscalingConfig{ + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + return +} + +// UnmarshalAutoscalingConfig unmarshals an instance of AutoscalingConfig from the specified map of raw messages. +func UnmarshalAutoscalingConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AutoscalingConfig) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalPrimitive(m, "target", &obj.Target) if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) + err = core.UnmarshalPrimitive(m, "min_worker_quantity", &obj.MinWorkerQuantity) if err != nil { - err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "min_worker_quantity-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "region", &obj.Region) + err = core.UnmarshalPrimitive(m, "max_worker_quantity", &obj.MaxWorkerQuantity) if err != nil { - err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "max_worker_quantity-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "state", &obj.State) + err = core.UnmarshalPrimitive(m, "query_termination_grace_period_min", &obj.QueryTerminationGracePeriodMin) if err != nil { - err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "query_termination_grace_period_min-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "storage_details", &obj.StorageDetails, UnmarshalStorageDetails) + err = core.UnmarshalPrimitive(m, "scale_in_stabilization_window_min", &obj.ScaleInStabilizationWindowMin) if err != nil { - err = core.SDKErrorf(err, "", "storage_details-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "scale_in_stabilization_window_min-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalPrimitive(m, "scaling_step_size", &obj.ScalingStepSize) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "scaling_step_size-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// BucketRegistrationCollection : List bucket registrations. -type BucketRegistrationCollection struct { - // Buckets. - BucketRegistrations []BucketRegistration `json:"bucket_registrations,omitempty"` -} - -// UnmarshalBucketRegistrationCollection unmarshals an instance of BucketRegistrationCollection from the specified map of raw messages. -func UnmarshalBucketRegistrationCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BucketRegistrationCollection) - err = core.UnmarshalModel(m, "bucket_registrations", &obj.BucketRegistrations, UnmarshalBucketRegistration) - if err != nil { - err = core.SDKErrorf(err, "", "bucket_registrations-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} +// BucketDetails : Storage connection details. +type BucketDetails struct { + // Storage access key. + AccessKey *string `json:"access_key,omitempty"` -// BucketRegistrationObjectCollection : List bucket objects. -type BucketRegistrationObjectCollection struct { - // bucket object. - Objects []string `json:"objects,omitempty"` -} + // Storage account name. + AccountName *string `json:"account_name,omitempty"` -// UnmarshalBucketRegistrationObjectCollection unmarshals an instance of BucketRegistrationObjectCollection from the specified map of raw messages. -func UnmarshalBucketRegistrationObjectCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BucketRegistrationObjectCollection) - err = core.UnmarshalPrimitive(m, "objects", &obj.Objects) - if err != nil { - err = core.SDKErrorf(err, "", "objects-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // Storage application ID. + ApplicationID *string `json:"application_id,omitempty"` -// BucketRegistrationObjectSizeCollection : Bucket object size. -type BucketRegistrationObjectSizeCollection struct { - // content type. - ContentType *string `json:"content_type,omitempty"` + // Storage container name. + ContainerName *string `json:"container_name,omitempty"` - // file type. - FileType *string `json:"file_type,omitempty"` + // Storage directory ID. + DirectoryID *string `json:"directory_id,omitempty"` - // bucket last modified. - LastModified *string `json:"last_modified,omitempty"` + // Storage endpoint. + Endpoint *string `json:"endpoint,omitempty"` - // Additional metadata associated with the object. - Metadata map[string]string `json:"metadata,omitempty"` + // Storage region. + Region *string `json:"region,omitempty"` - // bucket last modified. - Path *string `json:"path,omitempty"` + // Storage secret key. + SecretKey *string `json:"secret_key,omitempty"` - // size of the bucket objects. - Size *string `json:"size,omitempty"` + // Storage authentication type. + AuthMode *string `json:"auth_mode,omitempty"` + + // STS Role ARN. + RoleArn *string `json:"role_arn,omitempty"` + + // Bucket managed by. + ManagedBy *string `json:"managed_by,omitempty"` + + // Storage name. + Name *string `json:"name" validate:"required"` + + // Storage type. + Type *string `json:"type" validate:"required"` } -// UnmarshalBucketRegistrationObjectSizeCollection unmarshals an instance of BucketRegistrationObjectSizeCollection from the specified map of raw messages. -func UnmarshalBucketRegistrationObjectSizeCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BucketRegistrationObjectSizeCollection) - err = core.UnmarshalPrimitive(m, "content_type", &obj.ContentType) +// Constants associated with the BucketDetails.AuthMode property. +// Storage authentication type. +const ( + BucketDetails_AuthMode_AwsAssumeRole = "aws_assume_role" + BucketDetails_AuthMode_AwsAssumeRoleWithWebidentity = "aws_assume_role_with_webidentity" + BucketDetails_AuthMode_Hmac = "hmac" +) + +// Constants associated with the BucketDetails.Type property. +// Storage type. +const ( + BucketDetails_Type_AdlsGen1 = "adls_gen1" + BucketDetails_Type_AdlsGen2 = "adls_gen2" + BucketDetails_Type_AmazonS3 = "amazon_s3" + BucketDetails_Type_AwsS3 = "aws_s3" + BucketDetails_Type_GoogleCs = "google_cs" + BucketDetails_Type_Hdfs = "hdfs" + BucketDetails_Type_IbmCeph = "ibm_ceph" + BucketDetails_Type_IbmCos = "ibm_cos" + BucketDetails_Type_IbmStorageScale = "ibm_storage_scale" + BucketDetails_Type_Minio = "minio" + BucketDetails_Type_Ozone = "ozone" + BucketDetails_Type_S3 = "s3" +) + +// NewBucketDetails : Instantiate BucketDetails (Generic Model Constructor) +func (*WatsonxDataV3) NewBucketDetails(name string, typeVar string) (_model *BucketDetails, err error) { + _model = &BucketDetails{ + Name: core.StringPtr(name), + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "content_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalBucketDetails unmarshals an instance of BucketDetails from the specified map of raw messages. +func UnmarshalBucketDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(BucketDetails) + err = core.UnmarshalPrimitive(m, "access_key", &obj.AccessKey) + if err != nil { + err = core.SDKErrorf(err, "", "access_key-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "file_type", &obj.FileType) + err = core.UnmarshalPrimitive(m, "account_name", &obj.AccountName) if err != nil { - err = core.SDKErrorf(err, "", "file_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "account_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "last_modified", &obj.LastModified) + err = core.UnmarshalPrimitive(m, "application_id", &obj.ApplicationID) if err != nil { - err = core.SDKErrorf(err, "", "last_modified-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "application_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) + err = core.UnmarshalPrimitive(m, "container_name", &obj.ContainerName) if err != nil { - err = core.SDKErrorf(err, "", "metadata-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "container_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "path", &obj.Path) + err = core.UnmarshalPrimitive(m, "directory_id", &obj.DirectoryID) if err != nil { - err = core.SDKErrorf(err, "", "path-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "directory_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "size", &obj.Size) + err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) if err != nil { - err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "endpoint-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// BucketRegistrationPatch : Update bucket parameters. -type BucketRegistrationPatch struct { - // bucket details. - BucketDetails *BucketDetails `json:"bucket_details,omitempty"` - - // bucket display name. - BucketDisplayName *string `json:"bucket_display_name,omitempty"` - - // modified description. - Description *string `json:"description,omitempty"` - - // Tags. - Tags []string `json:"tags,omitempty"` -} - -// UnmarshalBucketRegistrationPatch unmarshals an instance of BucketRegistrationPatch from the specified map of raw messages. -func UnmarshalBucketRegistrationPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(BucketRegistrationPatch) - err = core.UnmarshalModel(m, "bucket_details", &obj.BucketDetails, UnmarshalBucketDetails) + err = core.UnmarshalPrimitive(m, "region", &obj.Region) if err != nil { - err = core.SDKErrorf(err, "", "bucket_details-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "secret_key", &obj.SecretKey) + if err != nil { + err = core.SDKErrorf(err, "", "secret_key-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "bucket_display_name", &obj.BucketDisplayName) + err = core.UnmarshalPrimitive(m, "auth_mode", &obj.AuthMode) if err != nil { - err = core.SDKErrorf(err, "", "bucket_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auth_mode-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalPrimitive(m, "role_arn", &obj.RoleArn) if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "role_arn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the BucketRegistrationPatch -func (bucketRegistrationPatch *BucketRegistrationPatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(bucketRegistrationPatch.BucketDetails) { - _patch["bucket_details"] = bucketRegistrationPatch.BucketDetails.asPatch() - } - if !core.IsNil(bucketRegistrationPatch.BucketDisplayName) { - _patch["bucket_display_name"] = bucketRegistrationPatch.BucketDisplayName - } - if !core.IsNil(bucketRegistrationPatch.Description) { - _patch["description"] = bucketRegistrationPatch.Description - } - if !core.IsNil(bucketRegistrationPatch.Tags) { - _patch["tags"] = bucketRegistrationPatch.Tags - } +// BulkUpdateResourceAccessPoliciesOptions : The BulkUpdateResourceAccessPolicies options. +type BulkUpdateResourceAccessPoliciesOptions struct { + // Array of access policies. Each access policy contains metadata, permission,resource, state and subject. + AccessPolicies []AccessPolicyBulkUpdate `json:"access_policies,omitempty"` + + // Unique identifier assigned to a specific watsonx.data instance. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} +// NewBulkUpdateResourceAccessPoliciesOptions : Instantiate BulkUpdateResourceAccessPoliciesOptions +func (*WatsonxDataV3) NewBulkUpdateResourceAccessPoliciesOptions() *BulkUpdateResourceAccessPoliciesOptions { + return &BulkUpdateResourceAccessPoliciesOptions{} +} + +// SetAccessPolicies : Allow user to set AccessPolicies +func (_options *BulkUpdateResourceAccessPoliciesOptions) SetAccessPolicies(accessPolicies []AccessPolicyBulkUpdate) *BulkUpdateResourceAccessPoliciesOptions { + _options.AccessPolicies = accessPolicies + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *BulkUpdateResourceAccessPoliciesOptions) SetAuthInstanceID(authInstanceID string) *BulkUpdateResourceAccessPoliciesOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *BulkUpdateResourceAccessPoliciesOptions) SetHeaders(param map[string]string) *BulkUpdateResourceAccessPoliciesOptions { + options.Headers = param + return options +} + +// CapacityDetails : Capacity Details. +type CapacityDetails struct { + // Capacity ID for given spark engine. + ID *strfmt.UUID `json:"id,omitempty"` +} + +// UnmarshalCapacityDetails unmarshals an instance of CapacityDetails from the specified map of raw messages. +func UnmarshalCapacityDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CapacityDetails) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } // Catalog : Define the catalog details. type Catalog struct { - // list of allowed actions. - Actions []string `json:"actions,omitempty"` + // List of allowed actions. + Actions []string `json:"actions" validate:"required"` - // Associated buckets items. - AssociatedBuckets []string `json:"associated_buckets,omitempty"` + // List of associated databases. + AssociatedDatabases []string `json:"associated_databases" validate:"required"` - // Associated databases items. - AssociatedDatabases []string `json:"associated_databases,omitempty"` + // List of associated engines. + AssociatedEngines []string `json:"associated_engines" validate:"required"` - // Associated engines items. - AssociatedEngines []string `json:"associated_engines,omitempty"` + // List of associated storage. + AssociatedStorage []string `json:"associated_storage" validate:"required"` - // Name for the catalog. - CatalogName *string `json:"catalog_name,omitempty"` + // catalog base path. + BasePath *string `json:"base_path,omitempty"` - // Table type. - CatalogType *string `json:"catalog_type,omitempty"` + // Catalog synchronization metadata. + CatalogSyncMetadata *CatalogSyncMetadata `json:"catalog_sync_metadata,omitempty"` + + // Epoch timestamp when the catalog was created. + CreatedAt *string `json:"created_at,omitempty"` // Created by. CreatedBy *string `json:"created_by,omitempty"` - // Created on. - CreatedOn *string `json:"created_on,omitempty"` + // Days left for catalog dissociation in case of vulnerability. + DaysLeft *string `json:"days_left,omitempty"` - // Description. + // The description if added, for the catalog. Description *string `json:"description,omitempty"` - // IBM thrift uri hostname. - Hostname *string `json:"hostname,omitempty"` - - // Last sync time. - LastSyncAt *string `json:"last_sync_at,omitempty"` + // catalog location uri. + LocationURI *string `json:"location_uri,omitempty"` // Managed by. - ManagedBy *string `json:"managed_by,omitempty"` + ManagedBy *string `json:"managed_by" validate:"required"` - // Catalog name. + // MDS Thrift server connection details. + MdsConnectionInformation *MdsConnectionInfo `json:"mds_connection_information,omitempty"` + + // Underlying catalog or storage backend used for metadata operations.For example,if the database type is + // `hive_hadoop2` or `iceberg`, the metastore is often set to `glue`.For HDFS, the metastore may be set to `hdfs`. Metastore *string `json:"metastore,omitempty"` - // IBM thrift uri port. - Port *string `json:"port,omitempty"` + // Name of the catalog. + Name *string `json:"name,omitempty"` // Catalog status. Status *string `json:"status,omitempty"` - // Sync description. - SyncDescription *string `json:"sync_description,omitempty"` - - // Tables not sync because data is corrupted. - SyncException []string `json:"sync_exception,omitempty"` - - // Sync status. - SyncStatus *string `json:"sync_status,omitempty"` + // List of tags added to this catalog. + Tags []string `json:"tags" validate:"required"` - // Tags. - Tags []string `json:"tags,omitempty"` + // Catalog names. + CatalogNames []string `json:"catalog_names" validate:"required"` - // Customer thrift uri. - ThriftURI *string `json:"thrift_uri,omitempty"` + // Catalog type like iceberg,hive etc. + Type *string `json:"type,omitempty"` } +// Constants associated with the Catalog.Actions property. +// allowed action. +const ( + Catalog_Actions_Alter = "alter" + Catalog_Actions_Create = "create" + Catalog_Actions_Delete = "delete" + Catalog_Actions_Drop = "drop" + Catalog_Actions_Grant = "grant" + Catalog_Actions_Insert = "insert" + Catalog_Actions_Register = "register" + Catalog_Actions_Remove = "remove" + Catalog_Actions_Revoke = "revoke" + Catalog_Actions_Select = "select" + Catalog_Actions_Show = "show" + Catalog_Actions_Update = "update" + Catalog_Actions_Use = "use" + Catalog_Actions_View = "view" +) + // Constants associated with the Catalog.ManagedBy property. // Managed by. const ( @@ -12172,11 +13095,6 @@ func UnmarshalCatalog(m map[string]json.RawMessage, result interface{}) (err err err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "associated_buckets", &obj.AssociatedBuckets) - if err != nil { - err = core.SDKErrorf(err, "", "associated_buckets-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "associated_databases", &obj.AssociatedDatabases) if err != nil { err = core.SDKErrorf(err, "", "associated_databases-error", common.GetComponentInfo()) @@ -12187,14 +13105,24 @@ func UnmarshalCatalog(m map[string]json.RawMessage, result interface{}) (err err err = core.SDKErrorf(err, "", "associated_engines-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + err = core.UnmarshalPrimitive(m, "associated_storage", &obj.AssociatedStorage) if err != nil { - err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "associated_storage-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "catalog_type", &obj.CatalogType) + err = core.UnmarshalPrimitive(m, "base_path", &obj.BasePath) if err != nil { - err = core.SDKErrorf(err, "", "catalog_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "base_path-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "catalog_sync_metadata", &obj.CatalogSyncMetadata, UnmarshalCatalogSyncMetadata) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_sync_metadata-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) @@ -12202,9 +13130,9 @@ func UnmarshalCatalog(m map[string]json.RawMessage, result interface{}) (err err err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + err = core.UnmarshalPrimitive(m, "days_left", &obj.DaysLeft) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "days_left-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) @@ -12212,19 +13140,19 @@ func UnmarshalCatalog(m map[string]json.RawMessage, result interface{}) (err err err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + err = core.UnmarshalPrimitive(m, "location_uri", &obj.LocationURI) if err != nil { - err = core.SDKErrorf(err, "", "hostname-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "location_uri-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "last_sync_at", &obj.LastSyncAt) + err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) if err != nil { - err = core.SDKErrorf(err, "", "last_sync_at-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) + err = core.UnmarshalModel(m, "mds_connection_information", &obj.MdsConnectionInformation, UnmarshalMdsConnectionInfo) if err != nil { - err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "mds_connection_information-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "metastore", &obj.Metastore) @@ -12232,9 +13160,9 @@ func UnmarshalCatalog(m map[string]json.RawMessage, result interface{}) (err err err = core.SDKErrorf(err, "", "metastore-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "status", &obj.Status) @@ -12242,39 +13170,29 @@ func UnmarshalCatalog(m map[string]json.RawMessage, result interface{}) (err err err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "sync_description", &obj.SyncDescription) - if err != nil { - err = core.SDKErrorf(err, "", "sync_description-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "sync_exception", &obj.SyncException) - if err != nil { - err = core.SDKErrorf(err, "", "sync_exception-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "sync_status", &obj.SyncStatus) + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { - err = core.SDKErrorf(err, "", "sync_status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalPrimitive(m, "catalog_names", &obj.CatalogNames) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "catalog_names-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "thrift_uri", &obj.ThriftURI) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "thrift_uri-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// CatalogCollection : GetCatalogs OK. +// CatalogCollection : Collection of catalogs. type CatalogCollection struct { - // Catalogs. - Catalogs []Catalog `json:"catalogs,omitempty"` + // List of catalogs. + Catalogs []Catalog `json:"catalogs" validate:"required"` } // UnmarshalCatalogCollection unmarshals an instance of CatalogCollection from the specified map of raw messages. @@ -12289,183 +13207,217 @@ func UnmarshalCatalogCollection(m map[string]json.RawMessage, result interface{} return } -// Column : Column. -type Column struct { - // Column name. - ColumnName *string `json:"column_name,omitempty"` - - // Comment. - Comment *string `json:"comment,omitempty"` - - // Extra. - Extra *string `json:"extra,omitempty"` - - // length. - Length *string `json:"length,omitempty"` - - // scale. - Scale *string `json:"scale,omitempty"` +// CatalogEngineResponse : Collection of catalogs. +type CatalogEngineResponse struct { + // List of associated engines. + AssociatedEngines []string `json:"associated_engines" validate:"required"` - // precision. - Precision *string `json:"precision,omitempty"` + // Name of the catalog. + CatalogName *string `json:"catalog_name,omitempty"` - // Data type. - Type *string `json:"type,omitempty"` + // Catalog type like iceberg,hive etc. + CatalogType *string `json:"catalog_type,omitempty"` } -// UnmarshalColumn unmarshals an instance of Column from the specified map of raw messages. -func UnmarshalColumn(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Column) - err = core.UnmarshalPrimitive(m, "column_name", &obj.ColumnName) +// UnmarshalCatalogEngineResponse unmarshals an instance of CatalogEngineResponse from the specified map of raw messages. +func UnmarshalCatalogEngineResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogEngineResponse) + err = core.UnmarshalPrimitive(m, "associated_engines", &obj.AssociatedEngines) if err != nil { - err = core.SDKErrorf(err, "", "column_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "associated_engines-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "comment", &obj.Comment) + err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) if err != nil { - err = core.SDKErrorf(err, "", "comment-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "extra", &obj.Extra) + err = core.UnmarshalPrimitive(m, "catalog_type", &obj.CatalogType) if err != nil { - err = core.SDKErrorf(err, "", "extra-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "catalog_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "length", &obj.Length) - if err != nil { - err = core.SDKErrorf(err, "", "length-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "scale", &obj.Scale) - if err != nil { - err = core.SDKErrorf(err, "", "scale-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "precision", &obj.Precision) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogProperties : Catalog configuration properties for coordinator and worker nodes. +type CatalogProperties struct { + // Catalog properties for coordinator node. + Coordinator map[string]string `json:"coordinator,omitempty"` + + // Catalog properties for worker nodes. + Worker map[string]string `json:"worker,omitempty"` +} + +// UnmarshalCatalogProperties unmarshals an instance of CatalogProperties from the specified map of raw messages. +func UnmarshalCatalogProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogProperties) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "precision-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// ColumnCollection : list of columns in a table. -type ColumnCollection struct { - // List of the columns present in the table. - Columns []Column `json:"columns,omitempty"` +// asPatch returns a generic map representation of the CatalogProperties +func (catalogProperties *CatalogProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(catalogProperties.Coordinator) { + _patch["coordinator"] = catalogProperties.Coordinator + } + if !core.IsNil(catalogProperties.Worker) { + _patch["worker"] = catalogProperties.Worker + } + + return } -// UnmarshalColumnCollection unmarshals an instance of ColumnCollection from the specified map of raw messages. -func UnmarshalColumnCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ColumnCollection) - err = core.UnmarshalModel(m, "columns", &obj.Columns, UnmarshalColumn) +// CatalogSyncMetadata : Catalog synchronization metadata. +type CatalogSyncMetadata struct { + // The time the catalog was last synced at, in epoch timestamp format. If no sync has happened, this property will be + // empty. + LastSyncAt *string `json:"last_sync_at,omitempty"` + + // Catalog synchronization status message. + SyncDescription *string `json:"sync_description,omitempty"` + + // Catalog synchronization error messages. + SyncException []string `json:"sync_exception" validate:"required"` + + // Catalog synchronization status. + SyncStatus *string `json:"sync_status,omitempty"` +} + +// UnmarshalCatalogSyncMetadata unmarshals an instance of CatalogSyncMetadata from the specified map of raw messages. +func UnmarshalCatalogSyncMetadata(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogSyncMetadata) + err = core.UnmarshalPrimitive(m, "last_sync_at", &obj.LastSyncAt) if err != nil { - err = core.SDKErrorf(err, "", "columns-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "last_sync_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "sync_description", &obj.SyncDescription) + if err != nil { + err = core.SDKErrorf(err, "", "sync_description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "sync_exception", &obj.SyncException) + if err != nil { + err = core.SDKErrorf(err, "", "sync_exception-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "sync_status", &obj.SyncStatus) + if err != nil { + err = core.SDKErrorf(err, "", "sync_status-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// ColumnPatch : list of columns to be added to a table. -type ColumnPatch struct { - // Column name. - ColumnName *string `json:"column_name,omitempty"` +// Catalogs : Details of catalogs associated with `ikc`. +type Catalogs struct { + // Comma separated list of catalogs for which `ikc` needs to be enabled. + CatalogNames []string `json:"catalog_names" validate:"required"` } -// UnmarshalColumnPatch unmarshals an instance of ColumnPatch from the specified map of raw messages. -func UnmarshalColumnPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ColumnPatch) - err = core.UnmarshalPrimitive(m, "column_name", &obj.ColumnName) +// NewCatalogs : Instantiate Catalogs (Generic Model Constructor) +func (*WatsonxDataV3) NewCatalogs(catalogNames []string) (_model *Catalogs, err error) { + _model = &Catalogs{ + CatalogNames: catalogNames, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalCatalogs unmarshals an instance of Catalogs from the specified map of raw messages. +func UnmarshalCatalogs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Catalogs) + err = core.UnmarshalPrimitive(m, "catalog_names", &obj.CatalogNames) if err != nil { - err = core.SDKErrorf(err, "", "column_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "catalog_names-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the ColumnPatch -func (columnPatch *ColumnPatch) AsPatch() (_patch map[string]interface{}, err error) { +// asPatch returns a generic map representation of the Catalogs +func (catalogs *Catalogs) asPatch() (_patch map[string]interface{}) { _patch = map[string]interface{}{} - if !core.IsNil(columnPatch.ColumnName) { - _patch["column_name"] = columnPatch.ColumnName + if !core.IsNil(catalogs.CatalogNames) { + _patch["catalog_names"] = catalogs.CatalogNames } return } -// ColumnsResponse : Column details. -type ColumnsResponse struct { - // A list of all tables with columns. - Columns []TableColumDetail `json:"columns,omitempty"` +// Column : Column details. +type Column struct { + // Optional comment or description of the column. + Comment *string `json:"comment,omitempty"` - // Response message string. - Message *string `json:"message,omitempty"` + // Extra column attributes, e.g., AUTO_INCREMENT, DEFAULT, etc. + Extra *string `json:"extra,omitempty"` - // Message code string. - MessageCode *string `json:"message_code,omitempty"` + // Length for types like VARCHAR or CHAR. Should be a numeric string. + Length *string `json:"length,omitempty"` + + // Valid SQL column name. + Name *string `json:"name,omitempty"` + + // Precision (total number of digits) for numeric types like DECIMAL. + Precision *string `json:"precision,omitempty"` + + // Scale (number of digits after the decimal point) for numeric types like DECIMAL. + Scale *string `json:"scale,omitempty"` + + // SQL data type, e.g., varchar, int, decimal(10,2), etc. + Type *string `json:"type,omitempty"` } -// UnmarshalColumnsResponse unmarshals an instance of ColumnsResponse from the specified map of raw messages. -func UnmarshalColumnsResponse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ColumnsResponse) - err = core.UnmarshalModel(m, "columns", &obj.Columns, UnmarshalTableColumDetail) +// UnmarshalColumn unmarshals an instance of Column from the specified map of raw messages. +func UnmarshalColumn(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Column) + err = core.UnmarshalPrimitive(m, "comment", &obj.Comment) if err != nil { - err = core.SDKErrorf(err, "", "columns-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "comment-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) + err = core.UnmarshalPrimitive(m, "extra", &obj.Extra) if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "extra-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "message_code", &obj.MessageCode) + err = core.UnmarshalPrimitive(m, "length", &obj.Length) if err != nil { - err = core.SDKErrorf(err, "", "message_code-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "length-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ConnectionPropertiesDetails : Get Milvus Service Detail for target type = cpd. -type ConnectionPropertiesDetails struct { - // The name of the connection, typically engine_id or service_id. - ConnectionName *string `json:"connection_name,omitempty"` - - // Watsonx Instance Details. - Details *Details `json:"details,omitempty"` - - // Service connection properties. - Properties *ConnectionPropertiesDetailsProperties `json:"properties,omitempty"` - - // Type of the service. - Type *string `json:"type,omitempty"` -} - -// UnmarshalConnectionPropertiesDetails unmarshals an instance of ConnectionPropertiesDetails from the specified map of raw messages. -func UnmarshalConnectionPropertiesDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ConnectionPropertiesDetails) - err = core.UnmarshalPrimitive(m, "connection_name", &obj.ConnectionName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "connection_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "details", &obj.Details, UnmarshalDetails) + err = core.UnmarshalPrimitive(m, "precision", &obj.Precision) if err != nil { - err = core.SDKErrorf(err, "", "details-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "precision-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "properties", &obj.Properties, UnmarshalConnectionPropertiesDetailsProperties) + err = core.UnmarshalPrimitive(m, "scale", &obj.Scale) if err != nil { - err = core.SDKErrorf(err, "", "properties-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "scale-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "type", &obj.Type) @@ -12477,307 +13429,310 @@ func UnmarshalConnectionPropertiesDetails(m map[string]json.RawMessage, result i return } -// ConnectionPropertiesDetailsProperties : Service connection properties. -type ConnectionPropertiesDetailsProperties struct { - // List of connection details. - Connection []ConnectionPropertiesDetailsPropertiesConnectionItems `json:"connection,omitempty"` +// ColumnCollection : collection of columns in a table. +type ColumnCollection struct { + // List of the columns present in the table. + Columns []Column `json:"columns" validate:"required"` } -// UnmarshalConnectionPropertiesDetailsProperties unmarshals an instance of ConnectionPropertiesDetailsProperties from the specified map of raw messages. -func UnmarshalConnectionPropertiesDetailsProperties(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ConnectionPropertiesDetailsProperties) - err = core.UnmarshalModel(m, "connection", &obj.Connection, UnmarshalConnectionPropertiesDetailsPropertiesConnectionItems) +// UnmarshalColumnCollection unmarshals an instance of ColumnCollection from the specified map of raw messages. +func UnmarshalColumnCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ColumnCollection) + err = core.UnmarshalModel(m, "columns", &obj.Columns, UnmarshalColumn) if err != nil { - err = core.SDKErrorf(err, "", "connection-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "columns-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// ConnectionPropertiesDetailsPropertiesConnectionItems : ConnectionPropertiesDetailsPropertiesConnectionItems struct -type ConnectionPropertiesDetailsPropertiesConnectionItems struct { - // Property name. +// ColumnPatch : New column name. +type ColumnPatch struct { + // Url encoded column name. Name *string `json:"name,omitempty"` - - // Property value (can be string, integer, or boolean). - Value *string `json:"value,omitempty"` } -// UnmarshalConnectionPropertiesDetailsPropertiesConnectionItems unmarshals an instance of ConnectionPropertiesDetailsPropertiesConnectionItems from the specified map of raw messages. -func UnmarshalConnectionPropertiesDetailsPropertiesConnectionItems(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ConnectionPropertiesDetailsPropertiesConnectionItems) +// UnmarshalColumnPatch unmarshals an instance of ColumnPatch from the specified map of raw messages. +func UnmarshalColumnPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ColumnPatch) err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the ColumnPatch +func (columnPatch *ColumnPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(columnPatch.Name) { + _patch["name"] = columnPatch.Name + } + + return +} + +// ConfigurationProperties : Configuration properties for coordinator and worker nodes. +type ConfigurationProperties struct { + // Configuration properties for coordinator node. + Coordinator map[string]string `json:"coordinator,omitempty"` + + // Configuration properties for worker nodes. + Worker map[string]string `json:"worker,omitempty"` +} + +// UnmarshalConfigurationProperties unmarshals an instance of ConfigurationProperties from the specified map of raw messages. +func UnmarshalConfigurationProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ConfigurationProperties) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + if err != nil { + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// CreateActivateBucketCreatedBody : Activate bucket. -type CreateActivateBucketCreatedBody struct { - // Response of success. - Response *SuccessResponse `json:"response,omitempty"` +// asPatch returns a generic map representation of the ConfigurationProperties +func (configurationProperties *ConfigurationProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(configurationProperties.Coordinator) { + _patch["coordinator"] = configurationProperties.Coordinator + } + if !core.IsNil(configurationProperties.Worker) { + _patch["worker"] = configurationProperties.Worker + } + + return } -// UnmarshalCreateActivateBucketCreatedBody unmarshals an instance of CreateActivateBucketCreatedBody from the specified map of raw messages. -func UnmarshalCreateActivateBucketCreatedBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CreateActivateBucketCreatedBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) +// CoordinatorNodeDescriptionBody : Presto engine configurations. +type CoordinatorNodeDescriptionBody struct { + // Presto engine coordinator node type. + NodeType *string `json:"node_type" validate:"required"` + + // Quantity of presto engine nodes. + Quantity *int64 `json:"quantity" validate:"required"` +} + +// NewCoordinatorNodeDescriptionBody : Instantiate CoordinatorNodeDescriptionBody (Generic Model Constructor) +func (*WatsonxDataV3) NewCoordinatorNodeDescriptionBody(nodeType string, quantity int64) (_model *CoordinatorNodeDescriptionBody, err error) { + _model = &CoordinatorNodeDescriptionBody{ + NodeType: core.StringPtr(nodeType), + Quantity: core.Int64Ptr(quantity), + } + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalCoordinatorNodeDescriptionBody unmarshals an instance of CoordinatorNodeDescriptionBody from the specified map of raw messages. +func UnmarshalCoordinatorNodeDescriptionBody(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CoordinatorNodeDescriptionBody) + err = core.UnmarshalPrimitive(m, "node_type", &obj.NodeType) + if err != nil { + err = core.SDKErrorf(err, "", "node_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "quantity", &obj.Quantity) + if err != nil { + err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// CreateActivateBucketOptions : The CreateActivateBucket options. -type CreateActivateBucketOptions struct { - // bucket id. - BucketID *string `json:"bucket_id" validate:"required,ne="` +// CreateColumnsOptions : The CreateColumns options. +type CreateColumnsOptions struct { + // engine id. + EngineID *string `json:"engine_id" validate:"required"` + + // catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` + + // URL encoded schema name. + SchemaName *string `json:"schema_name" validate:"required,ne="` + + // URL encoded table name. + TableName *string `json:"table_name" validate:"required,ne="` + + // List of the tables present in the schema. + Columns []Column `json:"columns,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewCreateActivateBucketOptions : Instantiate CreateActivateBucketOptions -func (*WatsonxDataV2) NewCreateActivateBucketOptions(bucketID string) *CreateActivateBucketOptions { - return &CreateActivateBucketOptions{ - BucketID: core.StringPtr(bucketID), +// NewCreateColumnsOptions : Instantiate CreateColumnsOptions +func (*WatsonxDataV3) NewCreateColumnsOptions(engineID string, catalogName string, schemaName string, tableName string) *CreateColumnsOptions { + return &CreateColumnsOptions{ + EngineID: core.StringPtr(engineID), + CatalogName: core.StringPtr(catalogName), + SchemaName: core.StringPtr(schemaName), + TableName: core.StringPtr(tableName), } } -// SetBucketID : Allow user to set BucketID -func (_options *CreateActivateBucketOptions) SetBucketID(bucketID string) *CreateActivateBucketOptions { - _options.BucketID = core.StringPtr(bucketID) +// SetEngineID : Allow user to set EngineID +func (_options *CreateColumnsOptions) SetEngineID(engineID string) *CreateColumnsOptions { + _options.EngineID = core.StringPtr(engineID) + return _options +} + +// SetCatalogName : Allow user to set CatalogName +func (_options *CreateColumnsOptions) SetCatalogName(catalogName string) *CreateColumnsOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options +} + +// SetSchemaName : Allow user to set SchemaName +func (_options *CreateColumnsOptions) SetSchemaName(schemaName string) *CreateColumnsOptions { + _options.SchemaName = core.StringPtr(schemaName) + return _options +} + +// SetTableName : Allow user to set TableName +func (_options *CreateColumnsOptions) SetTableName(tableName string) *CreateColumnsOptions { + _options.TableName = core.StringPtr(tableName) + return _options +} + +// SetColumns : Allow user to set Columns +func (_options *CreateColumnsOptions) SetColumns(columns []Column) *CreateColumnsOptions { + _options.Columns = columns return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *CreateActivateBucketOptions) SetAuthInstanceID(authInstanceID string) *CreateActivateBucketOptions { +func (_options *CreateColumnsOptions) SetAuthInstanceID(authInstanceID string) *CreateColumnsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *CreateActivateBucketOptions) SetHeaders(param map[string]string) *CreateActivateBucketOptions { +func (options *CreateColumnsOptions) SetHeaders(param map[string]string) *CreateColumnsOptions { options.Headers = param return options } -// CreateBucketRegistrationOptions : The CreateBucketRegistration options. -type CreateBucketRegistrationOptions struct { - // bucket type. - BucketType *string `json:"bucket_type" validate:"required"` - - // bucket description. - Description *string `json:"description" validate:"required"` +// CreateDataPolicyOptions : The CreateDataPolicy options. +type CreateDataPolicyOptions struct { + // The data artifact provides the full path of the resource to which the data policy applies. + DataArtifact *string `json:"data_artifact" validate:"required"` - // managed by. - ManagedBy *string `json:"managed_by" validate:"required"` + // rules is the array RuleV2. RuleV2 contains the effect, actions and grantees. + Rules []RuleV2 `json:"rules" validate:"required"` - // bucket catalog. - AssociatedCatalog *BucketCatalog `json:"associated_catalog,omitempty"` + // name of the catalog in which the data policy resource is residing. + CatalogName *string `json:"catalog_name,omitempty"` - // bucket details. - BucketDetails *BucketDetails `json:"bucket_details,omitempty"` + // type of the catalog in which the data policy resource is residing. + CatalogType *string `json:"catalog_type,omitempty"` - // bucket display name. - BucketDisplayName *string `json:"bucket_display_name,omitempty"` + // a more detailed description of the policy. + Description *string `json:"description,omitempty"` - // region where the bucket is located. - Region *string `json:"region,omitempty"` + // The unique name of the data policy.It should be in a given pattern. + PolicyName *string `json:"policy_name,omitempty"` - // storage details. - StorageDetails *StorageDetails `json:"storage_details,omitempty"` + // identifier of the resource on which the data policy is created on. + ResourceID *string `json:"resource_id,omitempty"` - // tags. - Tags []string `json:"tags,omitempty"` + // status of data policy. Values can be active or inactive. + Status *string `json:"status,omitempty"` - // CRN. + // Unique identifier assigned to a specific watsonx.data instance. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// Constants associated with the CreateBucketRegistrationOptions.BucketType property. -// bucket type. -const ( - CreateBucketRegistrationOptions_BucketType_AdlsGen1 = "adls_gen1" - CreateBucketRegistrationOptions_BucketType_AdlsGen2 = "adls_gen2" - CreateBucketRegistrationOptions_BucketType_AwsS3 = "aws_s3" - CreateBucketRegistrationOptions_BucketType_GoogleCs = "google_cs" - CreateBucketRegistrationOptions_BucketType_IbmCeph = "ibm_ceph" - CreateBucketRegistrationOptions_BucketType_IbmCos = "ibm_cos" - CreateBucketRegistrationOptions_BucketType_Minio = "minio" -) - -// Constants associated with the CreateBucketRegistrationOptions.ManagedBy property. -// managed by. +// Constants associated with the CreateDataPolicyOptions.Status property. +// status of data policy. Values can be active or inactive. const ( - CreateBucketRegistrationOptions_ManagedBy_Customer = "customer" - CreateBucketRegistrationOptions_ManagedBy_Ibm = "ibm" + CreateDataPolicyOptions_Status_Active = "active" + CreateDataPolicyOptions_Status_Inactive = "inactive" ) -// NewCreateBucketRegistrationOptions : Instantiate CreateBucketRegistrationOptions -func (*WatsonxDataV2) NewCreateBucketRegistrationOptions(bucketType string, description string, managedBy string) *CreateBucketRegistrationOptions { - return &CreateBucketRegistrationOptions{ - BucketType: core.StringPtr(bucketType), - Description: core.StringPtr(description), - ManagedBy: core.StringPtr(managedBy), +// NewCreateDataPolicyOptions : Instantiate CreateDataPolicyOptions +func (*WatsonxDataV3) NewCreateDataPolicyOptions(dataArtifact string, rules []RuleV2) *CreateDataPolicyOptions { + return &CreateDataPolicyOptions{ + DataArtifact: core.StringPtr(dataArtifact), + Rules: rules, } } -// SetBucketType : Allow user to set BucketType -func (_options *CreateBucketRegistrationOptions) SetBucketType(bucketType string) *CreateBucketRegistrationOptions { - _options.BucketType = core.StringPtr(bucketType) +// SetDataArtifact : Allow user to set DataArtifact +func (_options *CreateDataPolicyOptions) SetDataArtifact(dataArtifact string) *CreateDataPolicyOptions { + _options.DataArtifact = core.StringPtr(dataArtifact) return _options } -// SetDescription : Allow user to set Description -func (_options *CreateBucketRegistrationOptions) SetDescription(description string) *CreateBucketRegistrationOptions { - _options.Description = core.StringPtr(description) +// SetRules : Allow user to set Rules +func (_options *CreateDataPolicyOptions) SetRules(rules []RuleV2) *CreateDataPolicyOptions { + _options.Rules = rules return _options } -// SetManagedBy : Allow user to set ManagedBy -func (_options *CreateBucketRegistrationOptions) SetManagedBy(managedBy string) *CreateBucketRegistrationOptions { - _options.ManagedBy = core.StringPtr(managedBy) - return _options -} - -// SetAssociatedCatalog : Allow user to set AssociatedCatalog -func (_options *CreateBucketRegistrationOptions) SetAssociatedCatalog(associatedCatalog *BucketCatalog) *CreateBucketRegistrationOptions { - _options.AssociatedCatalog = associatedCatalog - return _options -} - -// SetBucketDetails : Allow user to set BucketDetails -func (_options *CreateBucketRegistrationOptions) SetBucketDetails(bucketDetails *BucketDetails) *CreateBucketRegistrationOptions { - _options.BucketDetails = bucketDetails - return _options -} - -// SetBucketDisplayName : Allow user to set BucketDisplayName -func (_options *CreateBucketRegistrationOptions) SetBucketDisplayName(bucketDisplayName string) *CreateBucketRegistrationOptions { - _options.BucketDisplayName = core.StringPtr(bucketDisplayName) - return _options -} - -// SetRegion : Allow user to set Region -func (_options *CreateBucketRegistrationOptions) SetRegion(region string) *CreateBucketRegistrationOptions { - _options.Region = core.StringPtr(region) - return _options -} - -// SetStorageDetails : Allow user to set StorageDetails -func (_options *CreateBucketRegistrationOptions) SetStorageDetails(storageDetails *StorageDetails) *CreateBucketRegistrationOptions { - _options.StorageDetails = storageDetails - return _options -} - -// SetTags : Allow user to set Tags -func (_options *CreateBucketRegistrationOptions) SetTags(tags []string) *CreateBucketRegistrationOptions { - _options.Tags = tags - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *CreateBucketRegistrationOptions) SetAuthInstanceID(authInstanceID string) *CreateBucketRegistrationOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) +// SetCatalogName : Allow user to set CatalogName +func (_options *CreateDataPolicyOptions) SetCatalogName(catalogName string) *CreateDataPolicyOptions { + _options.CatalogName = core.StringPtr(catalogName) return _options } -// SetHeaders : Allow user to set Headers -func (options *CreateBucketRegistrationOptions) SetHeaders(param map[string]string) *CreateBucketRegistrationOptions { - options.Headers = param - return options -} - -// CreateColumnsOptions : The CreateColumns options. -type CreateColumnsOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required"` - - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` - - // URL encoded schema name. - SchemaID *string `json:"schema_id" validate:"required,ne="` - - // URL encoded schema name. - TableID *string `json:"table_id" validate:"required,ne="` - - // List of the tables present in the schema. - Columns []Column `json:"columns,omitempty"` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewCreateColumnsOptions : Instantiate CreateColumnsOptions -func (*WatsonxDataV2) NewCreateColumnsOptions(engineID string, catalogID string, schemaID string, tableID string) *CreateColumnsOptions { - return &CreateColumnsOptions{ - EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - TableID: core.StringPtr(tableID), - } -} - -// SetEngineID : Allow user to set EngineID -func (_options *CreateColumnsOptions) SetEngineID(engineID string) *CreateColumnsOptions { - _options.EngineID = core.StringPtr(engineID) +// SetCatalogType : Allow user to set CatalogType +func (_options *CreateDataPolicyOptions) SetCatalogType(catalogType string) *CreateDataPolicyOptions { + _options.CatalogType = core.StringPtr(catalogType) return _options } -// SetCatalogID : Allow user to set CatalogID -func (_options *CreateColumnsOptions) SetCatalogID(catalogID string) *CreateColumnsOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetDescription : Allow user to set Description +func (_options *CreateDataPolicyOptions) SetDescription(description string) *CreateDataPolicyOptions { + _options.Description = core.StringPtr(description) return _options } -// SetSchemaID : Allow user to set SchemaID -func (_options *CreateColumnsOptions) SetSchemaID(schemaID string) *CreateColumnsOptions { - _options.SchemaID = core.StringPtr(schemaID) +// SetPolicyName : Allow user to set PolicyName +func (_options *CreateDataPolicyOptions) SetPolicyName(policyName string) *CreateDataPolicyOptions { + _options.PolicyName = core.StringPtr(policyName) return _options } -// SetTableID : Allow user to set TableID -func (_options *CreateColumnsOptions) SetTableID(tableID string) *CreateColumnsOptions { - _options.TableID = core.StringPtr(tableID) +// SetResourceID : Allow user to set ResourceID +func (_options *CreateDataPolicyOptions) SetResourceID(resourceID string) *CreateDataPolicyOptions { + _options.ResourceID = core.StringPtr(resourceID) return _options } -// SetColumns : Allow user to set Columns -func (_options *CreateColumnsOptions) SetColumns(columns []Column) *CreateColumnsOptions { - _options.Columns = columns +// SetStatus : Allow user to set Status +func (_options *CreateDataPolicyOptions) SetStatus(status string) *CreateDataPolicyOptions { + _options.Status = core.StringPtr(status) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *CreateColumnsOptions) SetAuthInstanceID(authInstanceID string) *CreateColumnsOptions { +func (_options *CreateDataPolicyOptions) SetAuthInstanceID(authInstanceID string) *CreateDataPolicyOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *CreateColumnsOptions) SetHeaders(param map[string]string) *CreateColumnsOptions { +func (options *CreateDataPolicyOptions) SetHeaders(param map[string]string) *CreateDataPolicyOptions { options.Headers = param return options } @@ -12785,30 +13740,42 @@ func (options *CreateColumnsOptions) SetHeaders(param map[string]string) *Create // CreateDatabaseRegistrationOptions : The CreateDatabaseRegistration options. type CreateDatabaseRegistrationOptions struct { // Database display name. - DatabaseDisplayName *string `json:"database_display_name" validate:"required"` + DisplayName *string `json:"display_name" validate:"required"` // Connector type. - DatabaseType *string `json:"database_type" validate:"required"` + Type *string `json:"type" validate:"required"` // database catalog. - AssociatedCatalog *DatabaseCatalog `json:"associated_catalog,omitempty"` - - // Created on. - CreatedOn *string `json:"created_on,omitempty"` + AssociatedCatalog *DatabaseCatalogPrototype `json:"associated_catalog,omitempty"` // database details. - DatabaseDetails *DatabaseDetails `json:"database_details,omitempty"` + Connection *DatabaseDetailsPrototype `json:"connection,omitempty"` - // This will hold all the properties for a custom database. - DatabaseProperties []DatabaseRegistrationPrototypeDatabasePropertiesItems `json:"database_properties,omitempty"` + // Created on. + CreatedAt *string `json:"created_at,omitempty"` // Database description. Description *string `json:"description,omitempty"` + // This will hold all the properties for a custom database. + Properties []DatabaseRegistrationPrototypeDatabasePropertiesItems `json:"properties,omitempty"` + + // Source connection assset Id from platform. + SourceAssetID *string `json:"source_asset_id,omitempty"` + + // Source catalog Id from platform. + SourceCatalogID *string `json:"source_catalog_id,omitempty"` + + // Source project Id from platform. + SourceProjectID *string `json:"source_project_id,omitempty"` + // tags. Tags []string `json:"tags,omitempty"` - // CRN. + // Target catalog id in the platform to save the database connection. + TargetCatalogID *string `json:"target_catalog_id,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -12816,46 +13783,40 @@ type CreateDatabaseRegistrationOptions struct { } // NewCreateDatabaseRegistrationOptions : Instantiate CreateDatabaseRegistrationOptions -func (*WatsonxDataV2) NewCreateDatabaseRegistrationOptions(databaseDisplayName string, databaseType string) *CreateDatabaseRegistrationOptions { +func (*WatsonxDataV3) NewCreateDatabaseRegistrationOptions(displayName string, typeVar string) *CreateDatabaseRegistrationOptions { return &CreateDatabaseRegistrationOptions{ - DatabaseDisplayName: core.StringPtr(databaseDisplayName), - DatabaseType: core.StringPtr(databaseType), + DisplayName: core.StringPtr(displayName), + Type: core.StringPtr(typeVar), } } -// SetDatabaseDisplayName : Allow user to set DatabaseDisplayName -func (_options *CreateDatabaseRegistrationOptions) SetDatabaseDisplayName(databaseDisplayName string) *CreateDatabaseRegistrationOptions { - _options.DatabaseDisplayName = core.StringPtr(databaseDisplayName) +// SetDisplayName : Allow user to set DisplayName +func (_options *CreateDatabaseRegistrationOptions) SetDisplayName(displayName string) *CreateDatabaseRegistrationOptions { + _options.DisplayName = core.StringPtr(displayName) return _options } -// SetDatabaseType : Allow user to set DatabaseType -func (_options *CreateDatabaseRegistrationOptions) SetDatabaseType(databaseType string) *CreateDatabaseRegistrationOptions { - _options.DatabaseType = core.StringPtr(databaseType) +// SetType : Allow user to set Type +func (_options *CreateDatabaseRegistrationOptions) SetType(typeVar string) *CreateDatabaseRegistrationOptions { + _options.Type = core.StringPtr(typeVar) return _options } // SetAssociatedCatalog : Allow user to set AssociatedCatalog -func (_options *CreateDatabaseRegistrationOptions) SetAssociatedCatalog(associatedCatalog *DatabaseCatalog) *CreateDatabaseRegistrationOptions { +func (_options *CreateDatabaseRegistrationOptions) SetAssociatedCatalog(associatedCatalog *DatabaseCatalogPrototype) *CreateDatabaseRegistrationOptions { _options.AssociatedCatalog = associatedCatalog return _options } -// SetCreatedOn : Allow user to set CreatedOn -func (_options *CreateDatabaseRegistrationOptions) SetCreatedOn(createdOn string) *CreateDatabaseRegistrationOptions { - _options.CreatedOn = core.StringPtr(createdOn) - return _options -} - -// SetDatabaseDetails : Allow user to set DatabaseDetails -func (_options *CreateDatabaseRegistrationOptions) SetDatabaseDetails(databaseDetails *DatabaseDetails) *CreateDatabaseRegistrationOptions { - _options.DatabaseDetails = databaseDetails +// SetConnection : Allow user to set Connection +func (_options *CreateDatabaseRegistrationOptions) SetConnection(connection *DatabaseDetailsPrototype) *CreateDatabaseRegistrationOptions { + _options.Connection = connection return _options } -// SetDatabaseProperties : Allow user to set DatabaseProperties -func (_options *CreateDatabaseRegistrationOptions) SetDatabaseProperties(databaseProperties []DatabaseRegistrationPrototypeDatabasePropertiesItems) *CreateDatabaseRegistrationOptions { - _options.DatabaseProperties = databaseProperties +// SetCreatedAt : Allow user to set CreatedAt +func (_options *CreateDatabaseRegistrationOptions) SetCreatedAt(createdAt string) *CreateDatabaseRegistrationOptions { + _options.CreatedAt = core.StringPtr(createdAt) return _options } @@ -12865,12 +13826,42 @@ func (_options *CreateDatabaseRegistrationOptions) SetDescription(description st return _options } +// SetProperties : Allow user to set Properties +func (_options *CreateDatabaseRegistrationOptions) SetProperties(properties []DatabaseRegistrationPrototypeDatabasePropertiesItems) *CreateDatabaseRegistrationOptions { + _options.Properties = properties + return _options +} + +// SetSourceAssetID : Allow user to set SourceAssetID +func (_options *CreateDatabaseRegistrationOptions) SetSourceAssetID(sourceAssetID string) *CreateDatabaseRegistrationOptions { + _options.SourceAssetID = core.StringPtr(sourceAssetID) + return _options +} + +// SetSourceCatalogID : Allow user to set SourceCatalogID +func (_options *CreateDatabaseRegistrationOptions) SetSourceCatalogID(sourceCatalogID string) *CreateDatabaseRegistrationOptions { + _options.SourceCatalogID = core.StringPtr(sourceCatalogID) + return _options +} + +// SetSourceProjectID : Allow user to set SourceProjectID +func (_options *CreateDatabaseRegistrationOptions) SetSourceProjectID(sourceProjectID string) *CreateDatabaseRegistrationOptions { + _options.SourceProjectID = core.StringPtr(sourceProjectID) + return _options +} + // SetTags : Allow user to set Tags func (_options *CreateDatabaseRegistrationOptions) SetTags(tags []string) *CreateDatabaseRegistrationOptions { _options.Tags = tags return _options } +// SetTargetCatalogID : Allow user to set TargetCatalogID +func (_options *CreateDatabaseRegistrationOptions) SetTargetCatalogID(targetCatalogID string) *CreateDatabaseRegistrationOptions { + _options.TargetCatalogID = core.StringPtr(targetCatalogID) + return _options +} + // SetAuthInstanceID : Allow user to set AuthInstanceID func (_options *CreateDatabaseRegistrationOptions) SetAuthInstanceID(authInstanceID string) *CreateDatabaseRegistrationOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) @@ -12885,22 +13876,22 @@ func (options *CreateDatabaseRegistrationOptions) SetHeaders(param map[string]st // CreateDb2EngineOptions : The CreateDb2Engine options. type CreateDb2EngineOptions struct { - // Origin - created or registered. + // External engine details. + Configuration *Db2EngineDetailsBody `json:"configuration" validate:"required"` + + // Engine display name. + DisplayName *string `json:"display_name" validate:"required"` + + // Origin of the engine. Origin *string `json:"origin" validate:"required"` // Engine description. Description *string `json:"description,omitempty"` - // External engine details. - EngineDetails *Db2EngineDetailsBody `json:"engine_details,omitempty"` - - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` - // Tags. Tags []string `json:"tags,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -12908,41 +13899,41 @@ type CreateDb2EngineOptions struct { } // Constants associated with the CreateDb2EngineOptions.Origin property. -// Origin - created or registered. +// Origin of the engine. const ( - CreateDb2EngineOptions_Origin_Discover = "discover" CreateDb2EngineOptions_Origin_External = "external" - CreateDb2EngineOptions_Origin_Native = "native" ) // NewCreateDb2EngineOptions : Instantiate CreateDb2EngineOptions -func (*WatsonxDataV2) NewCreateDb2EngineOptions(origin string) *CreateDb2EngineOptions { +func (*WatsonxDataV3) NewCreateDb2EngineOptions(configuration *Db2EngineDetailsBody, displayName string, origin string) *CreateDb2EngineOptions { return &CreateDb2EngineOptions{ + Configuration: configuration, + DisplayName: core.StringPtr(displayName), Origin: core.StringPtr(origin), } } -// SetOrigin : Allow user to set Origin -func (_options *CreateDb2EngineOptions) SetOrigin(origin string) *CreateDb2EngineOptions { - _options.Origin = core.StringPtr(origin) +// SetConfiguration : Allow user to set Configuration +func (_options *CreateDb2EngineOptions) SetConfiguration(configuration *Db2EngineDetailsBody) *CreateDb2EngineOptions { + _options.Configuration = configuration return _options } -// SetDescription : Allow user to set Description -func (_options *CreateDb2EngineOptions) SetDescription(description string) *CreateDb2EngineOptions { - _options.Description = core.StringPtr(description) +// SetDisplayName : Allow user to set DisplayName +func (_options *CreateDb2EngineOptions) SetDisplayName(displayName string) *CreateDb2EngineOptions { + _options.DisplayName = core.StringPtr(displayName) return _options } -// SetEngineDetails : Allow user to set EngineDetails -func (_options *CreateDb2EngineOptions) SetEngineDetails(engineDetails *Db2EngineDetailsBody) *CreateDb2EngineOptions { - _options.EngineDetails = engineDetails +// SetOrigin : Allow user to set Origin +func (_options *CreateDb2EngineOptions) SetOrigin(origin string) *CreateDb2EngineOptions { + _options.Origin = core.StringPtr(origin) return _options } -// SetEngineDisplayName : Allow user to set EngineDisplayName -func (_options *CreateDb2EngineOptions) SetEngineDisplayName(engineDisplayName string) *CreateDb2EngineOptions { - _options.EngineDisplayName = core.StringPtr(engineDisplayName) +// SetDescription : Allow user to set Description +func (_options *CreateDb2EngineOptions) SetDescription(description string) *CreateDb2EngineOptions { + _options.Description = core.StringPtr(description) return _options } @@ -12964,357 +13955,145 @@ func (options *CreateDb2EngineOptions) SetHeaders(param map[string]string) *Crea return options } -// CreateDriverRegistrationOptions : The CreateDriverRegistration options. -type CreateDriverRegistrationOptions struct { - // Driver file to upload. - Driver io.ReadCloser `json:"driver" validate:"required"` +// CreateHdfsStorageOptions : The CreateHdfsStorage options. +type CreateHdfsStorageOptions struct { + // Storage display name. + DisplayName *string `json:"display_name" validate:"required"` - // Driver name. - DriverName *string `json:"driver_name" validate:"required"` + // Storage type. + Type *string `json:"type" validate:"required"` + + // HMS Thrift URI. + HmsThriftURI *string `json:"hms_thrift_uri" validate:"required"` + + // HMS Thrift Port. + HmsThriftPort *int64 `json:"hms_thrift_port" validate:"required"` - // Driver connection type. - ConnectionType *string `json:"connection_type" validate:"required"` + // contents of core-site.xml file. + CoreSite *string `json:"core_site" validate:"required"` - // The content type of driver. - DriverContentType *string `json:"driver_content_type,omitempty"` + // contents of hdfs-site.xml file. + HdfsSite *string `json:"hdfs_site" validate:"required"` - // Driver status. - Version *string `json:"version,omitempty"` + // Kerberos Flag. + Kerberos *string `json:"kerberos" validate:"required"` + + // Catalog name. + CatalogName *string `json:"catalog_name" validate:"required"` + + // Catalog type. + CatalogType *string `json:"catalog_type" validate:"required"` + + // Kerberos configuration file. + Krb5Config *string `json:"krb5_config,omitempty"` + + // Hive keytab file. + HiveKeytab io.ReadCloser `json:"hive_keytab,omitempty"` + + // The content type of hiveKeytab. + HiveKeytabContentType *string `json:"hive_keytab_content_type,omitempty"` + + // HDFS keytab file. + HdfsKeytab io.ReadCloser `json:"hdfs_keytab,omitempty"` + + // The content type of hdfsKeytab. + HdfsKeytabContentType *string `json:"hdfs_keytab_content_type,omitempty"` + + // Hive server principal. + HiveServerPrincipal *string `json:"hive_server_principal,omitempty"` + + // Hive client principal. + HiveClientPrincipal *string `json:"hive_client_principal,omitempty"` + + // HDFS principal. + HdfsPrincipal *string `json:"hdfs_principal,omitempty"` + + // Database description. + Description *string `json:"description,omitempty"` + + // Created on. + CreatedAt *string `json:"created_at,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewCreateDriverRegistrationOptions : Instantiate CreateDriverRegistrationOptions -func (*WatsonxDataV2) NewCreateDriverRegistrationOptions(driver io.ReadCloser, driverName string, connectionType string) *CreateDriverRegistrationOptions { - return &CreateDriverRegistrationOptions{ - Driver: driver, - DriverName: core.StringPtr(driverName), - ConnectionType: core.StringPtr(connectionType), +// NewCreateHdfsStorageOptions : Instantiate CreateHdfsStorageOptions +func (*WatsonxDataV3) NewCreateHdfsStorageOptions(displayName string, typeVar string, hmsThriftURI string, hmsThriftPort int64, coreSite string, hdfsSite string, kerberos string, catalogName string, catalogType string) *CreateHdfsStorageOptions { + return &CreateHdfsStorageOptions{ + DisplayName: core.StringPtr(displayName), + Type: core.StringPtr(typeVar), + HmsThriftURI: core.StringPtr(hmsThriftURI), + HmsThriftPort: core.Int64Ptr(hmsThriftPort), + CoreSite: core.StringPtr(coreSite), + HdfsSite: core.StringPtr(hdfsSite), + Kerberos: core.StringPtr(kerberos), + CatalogName: core.StringPtr(catalogName), + CatalogType: core.StringPtr(catalogType), } } -// SetDriver : Allow user to set Driver -func (_options *CreateDriverRegistrationOptions) SetDriver(driver io.ReadCloser) *CreateDriverRegistrationOptions { - _options.Driver = driver +// SetDisplayName : Allow user to set DisplayName +func (_options *CreateHdfsStorageOptions) SetDisplayName(displayName string) *CreateHdfsStorageOptions { + _options.DisplayName = core.StringPtr(displayName) return _options } -// SetDriverName : Allow user to set DriverName -func (_options *CreateDriverRegistrationOptions) SetDriverName(driverName string) *CreateDriverRegistrationOptions { - _options.DriverName = core.StringPtr(driverName) +// SetType : Allow user to set Type +func (_options *CreateHdfsStorageOptions) SetType(typeVar string) *CreateHdfsStorageOptions { + _options.Type = core.StringPtr(typeVar) return _options } -// SetConnectionType : Allow user to set ConnectionType -func (_options *CreateDriverRegistrationOptions) SetConnectionType(connectionType string) *CreateDriverRegistrationOptions { - _options.ConnectionType = core.StringPtr(connectionType) +// SetHmsThriftURI : Allow user to set HmsThriftURI +func (_options *CreateHdfsStorageOptions) SetHmsThriftURI(hmsThriftURI string) *CreateHdfsStorageOptions { + _options.HmsThriftURI = core.StringPtr(hmsThriftURI) return _options } -// SetDriverContentType : Allow user to set DriverContentType -func (_options *CreateDriverRegistrationOptions) SetDriverContentType(driverContentType string) *CreateDriverRegistrationOptions { - _options.DriverContentType = core.StringPtr(driverContentType) +// SetHmsThriftPort : Allow user to set HmsThriftPort +func (_options *CreateHdfsStorageOptions) SetHmsThriftPort(hmsThriftPort int64) *CreateHdfsStorageOptions { + _options.HmsThriftPort = core.Int64Ptr(hmsThriftPort) return _options } -// SetVersion : Allow user to set Version -func (_options *CreateDriverRegistrationOptions) SetVersion(version string) *CreateDriverRegistrationOptions { - _options.Version = core.StringPtr(version) +// SetCoreSite : Allow user to set CoreSite +func (_options *CreateHdfsStorageOptions) SetCoreSite(coreSite string) *CreateHdfsStorageOptions { + _options.CoreSite = core.StringPtr(coreSite) return _options } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *CreateDriverRegistrationOptions) SetAuthInstanceID(authInstanceID string) *CreateDriverRegistrationOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) +// SetHdfsSite : Allow user to set HdfsSite +func (_options *CreateHdfsStorageOptions) SetHdfsSite(hdfsSite string) *CreateHdfsStorageOptions { + _options.HdfsSite = core.StringPtr(hdfsSite) return _options } -// SetHeaders : Allow user to set Headers -func (options *CreateDriverRegistrationOptions) SetHeaders(param map[string]string) *CreateDriverRegistrationOptions { - options.Headers = param - return options +// SetKerberos : Allow user to set Kerberos +func (_options *CreateHdfsStorageOptions) SetKerberos(kerberos string) *CreateHdfsStorageOptions { + _options.Kerberos = core.StringPtr(kerberos) + return _options } -// CreateEnginePauseCreatedBody : Pause. -type CreateEnginePauseCreatedBody struct { - // Response of success. - Response *SuccessResponse `json:"response,omitempty"` +// SetCatalogName : Allow user to set CatalogName +func (_options *CreateHdfsStorageOptions) SetCatalogName(catalogName string) *CreateHdfsStorageOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options } -// UnmarshalCreateEnginePauseCreatedBody unmarshals an instance of CreateEnginePauseCreatedBody from the specified map of raw messages. -func UnmarshalCreateEnginePauseCreatedBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CreateEnginePauseCreatedBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetCatalogType : Allow user to set CatalogType +func (_options *CreateHdfsStorageOptions) SetCatalogType(catalogType string) *CreateHdfsStorageOptions { + _options.CatalogType = core.StringPtr(catalogType) + return _options } -// CreateEngineRestartCreatedBody : restart engine. -type CreateEngineRestartCreatedBody struct { - // Response of success. - Response *SuccessResponse `json:"response,omitempty"` -} - -// UnmarshalCreateEngineRestartCreatedBody unmarshals an instance of CreateEngineRestartCreatedBody from the specified map of raw messages. -func UnmarshalCreateEngineRestartCreatedBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CreateEngineRestartCreatedBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CreateEngineResumeCreatedBody : resume. -type CreateEngineResumeCreatedBody struct { - // Response of success. - Response *SuccessResponse `json:"response,omitempty"` -} - -// UnmarshalCreateEngineResumeCreatedBody unmarshals an instance of CreateEngineResumeCreatedBody from the specified map of raw messages. -func UnmarshalCreateEngineResumeCreatedBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CreateEngineResumeCreatedBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CreateEngineScaleCreatedBody : scale engine. -type CreateEngineScaleCreatedBody struct { - // Response of success. - Response *SuccessResponse `json:"response,omitempty"` -} - -// UnmarshalCreateEngineScaleCreatedBody unmarshals an instance of CreateEngineScaleCreatedBody from the specified map of raw messages. -func UnmarshalCreateEngineScaleCreatedBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CreateEngineScaleCreatedBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// CreateExecuteQueryOptions : The CreateExecuteQuery options. -type CreateExecuteQueryOptions struct { - // Engine name. - EngineID *string `json:"engine_id" validate:"required,ne="` - - // query to be executed. - SqlString *string `json:"sql_string" validate:"required"` - - // Name of the catalog. - CatalogName *string `json:"catalog_name,omitempty"` - - // Schema name. - SchemaName *string `json:"schema_name,omitempty"` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewCreateExecuteQueryOptions : Instantiate CreateExecuteQueryOptions -func (*WatsonxDataV2) NewCreateExecuteQueryOptions(engineID string, sqlString string) *CreateExecuteQueryOptions { - return &CreateExecuteQueryOptions{ - EngineID: core.StringPtr(engineID), - SqlString: core.StringPtr(sqlString), - } -} - -// SetEngineID : Allow user to set EngineID -func (_options *CreateExecuteQueryOptions) SetEngineID(engineID string) *CreateExecuteQueryOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetSqlString : Allow user to set SqlString -func (_options *CreateExecuteQueryOptions) SetSqlString(sqlString string) *CreateExecuteQueryOptions { - _options.SqlString = core.StringPtr(sqlString) - return _options -} - -// SetCatalogName : Allow user to set CatalogName -func (_options *CreateExecuteQueryOptions) SetCatalogName(catalogName string) *CreateExecuteQueryOptions { - _options.CatalogName = core.StringPtr(catalogName) - return _options -} - -// SetSchemaName : Allow user to set SchemaName -func (_options *CreateExecuteQueryOptions) SetSchemaName(schemaName string) *CreateExecuteQueryOptions { - _options.SchemaName = core.StringPtr(schemaName) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *CreateExecuteQueryOptions) SetAuthInstanceID(authInstanceID string) *CreateExecuteQueryOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateExecuteQueryOptions) SetHeaders(param map[string]string) *CreateExecuteQueryOptions { - options.Headers = param - return options -} - -// CreateHdfsStorageOptions : The CreateHdfsStorage options. -type CreateHdfsStorageOptions struct { - // Bucket display name. - BucketDisplayName *string `json:"bucket_display_name" validate:"required"` - - // Bucket type. - BucketType *string `json:"bucket_type" validate:"required"` - - // HMS Thrift URI. - HmsThriftURI *string `json:"hms_thrift_uri" validate:"required"` - - // HMS Thrift Port. - HmsThriftPort *int64 `json:"hms_thrift_port" validate:"required"` - - // contents of core-site.xml file. - CoreSite *string `json:"core_site" validate:"required"` - - // contents of hdfs-site.xml file. - HdfsSite *string `json:"hdfs_site" validate:"required"` - - // Kerberos Flag. - Kerberos *string `json:"kerberos" validate:"required"` - - // Catalog name. - CatalogName *string `json:"catalog_name" validate:"required"` - - // Catalog type. - CatalogType *string `json:"catalog_type" validate:"required"` - - // Kerberos config file. - Krb5Config *string `json:"krb5_config,omitempty"` - - // Hive keytab file. - HiveKeytab io.ReadCloser `json:"hive_keytab,omitempty"` - - // The content type of hiveKeytab. - HiveKeytabContentType *string `json:"hive_keytab_content_type,omitempty"` - - // HDFS keytab file. - HdfsKeytab io.ReadCloser `json:"hdfs_keytab,omitempty"` - - // The content type of hdfsKeytab. - HdfsKeytabContentType *string `json:"hdfs_keytab_content_type,omitempty"` - - // Hive server principal. - HiveServerPrincipal *string `json:"hive_server_principal,omitempty"` - - // Hive client principal. - HiveClientPrincipal *string `json:"hive_client_principal,omitempty"` - - // HDFS principal. - HdfsPrincipal *string `json:"hdfs_principal,omitempty"` - - // Database description. - Description *string `json:"description,omitempty"` - - // Created on. - CreatedOn *string `json:"created_on,omitempty"` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewCreateHdfsStorageOptions : Instantiate CreateHdfsStorageOptions -func (*WatsonxDataV2) NewCreateHdfsStorageOptions(bucketDisplayName string, bucketType string, hmsThriftURI string, hmsThriftPort int64, coreSite string, hdfsSite string, kerberos string, catalogName string, catalogType string) *CreateHdfsStorageOptions { - return &CreateHdfsStorageOptions{ - BucketDisplayName: core.StringPtr(bucketDisplayName), - BucketType: core.StringPtr(bucketType), - HmsThriftURI: core.StringPtr(hmsThriftURI), - HmsThriftPort: core.Int64Ptr(hmsThriftPort), - CoreSite: core.StringPtr(coreSite), - HdfsSite: core.StringPtr(hdfsSite), - Kerberos: core.StringPtr(kerberos), - CatalogName: core.StringPtr(catalogName), - CatalogType: core.StringPtr(catalogType), - } -} - -// SetBucketDisplayName : Allow user to set BucketDisplayName -func (_options *CreateHdfsStorageOptions) SetBucketDisplayName(bucketDisplayName string) *CreateHdfsStorageOptions { - _options.BucketDisplayName = core.StringPtr(bucketDisplayName) - return _options -} - -// SetBucketType : Allow user to set BucketType -func (_options *CreateHdfsStorageOptions) SetBucketType(bucketType string) *CreateHdfsStorageOptions { - _options.BucketType = core.StringPtr(bucketType) - return _options -} - -// SetHmsThriftURI : Allow user to set HmsThriftURI -func (_options *CreateHdfsStorageOptions) SetHmsThriftURI(hmsThriftURI string) *CreateHdfsStorageOptions { - _options.HmsThriftURI = core.StringPtr(hmsThriftURI) - return _options -} - -// SetHmsThriftPort : Allow user to set HmsThriftPort -func (_options *CreateHdfsStorageOptions) SetHmsThriftPort(hmsThriftPort int64) *CreateHdfsStorageOptions { - _options.HmsThriftPort = core.Int64Ptr(hmsThriftPort) - return _options -} - -// SetCoreSite : Allow user to set CoreSite -func (_options *CreateHdfsStorageOptions) SetCoreSite(coreSite string) *CreateHdfsStorageOptions { - _options.CoreSite = core.StringPtr(coreSite) - return _options -} - -// SetHdfsSite : Allow user to set HdfsSite -func (_options *CreateHdfsStorageOptions) SetHdfsSite(hdfsSite string) *CreateHdfsStorageOptions { - _options.HdfsSite = core.StringPtr(hdfsSite) - return _options -} - -// SetKerberos : Allow user to set Kerberos -func (_options *CreateHdfsStorageOptions) SetKerberos(kerberos string) *CreateHdfsStorageOptions { - _options.Kerberos = core.StringPtr(kerberos) - return _options -} - -// SetCatalogName : Allow user to set CatalogName -func (_options *CreateHdfsStorageOptions) SetCatalogName(catalogName string) *CreateHdfsStorageOptions { - _options.CatalogName = core.StringPtr(catalogName) - return _options -} - -// SetCatalogType : Allow user to set CatalogType -func (_options *CreateHdfsStorageOptions) SetCatalogType(catalogType string) *CreateHdfsStorageOptions { - _options.CatalogType = core.StringPtr(catalogType) - return _options -} - -// SetKrb5Config : Allow user to set Krb5Config -func (_options *CreateHdfsStorageOptions) SetKrb5Config(krb5Config string) *CreateHdfsStorageOptions { - _options.Krb5Config = core.StringPtr(krb5Config) - return _options +// SetKrb5Config : Allow user to set Krb5Config +func (_options *CreateHdfsStorageOptions) SetKrb5Config(krb5Config string) *CreateHdfsStorageOptions { + _options.Krb5Config = core.StringPtr(krb5Config) + return _options } // SetHiveKeytab : Allow user to set HiveKeytab @@ -13365,9 +14144,9 @@ func (_options *CreateHdfsStorageOptions) SetDescription(description string) *Cr return _options } -// SetCreatedOn : Allow user to set CreatedOn -func (_options *CreateHdfsStorageOptions) SetCreatedOn(createdOn string) *CreateHdfsStorageOptions { - _options.CreatedOn = core.StringPtr(createdOn) +// SetCreatedAt : Allow user to set CreatedAt +func (_options *CreateHdfsStorageOptions) SetCreatedAt(createdAt string) *CreateHdfsStorageOptions { + _options.CreatedAt = core.StringPtr(createdAt) return _options } @@ -13383,329 +14162,172 @@ func (options *CreateHdfsStorageOptions) SetHeaders(param map[string]string) *Cr return options } -// CreateIngestionJobsLocalFilesOptions : The CreateIngestionJobsLocalFiles options. -type CreateIngestionJobsLocalFilesOptions struct { - // CRN. +// CreateIngestionJobOptions : The CreateIngestionJob options. +type CreateIngestionJobOptions struct { + // Lakehouse Instance ID. AuthInstanceID *string `json:"AuthInstanceId" validate:"required"` - // The user local file submitted for ingestion. - SourceDataFile io.ReadCloser `json:"source_data_file" validate:"required"` - - // Target table name in format catalog.schema.table. - TargetTable *string `json:"target_table" validate:"required"` - - // Job ID of the job. - JobID *string `json:"job_id" validate:"required"` + // Job ID of the ingestion job. + ID *string `json:"id" validate:"required"` - // User submitting ingestion job. - Username *string `json:"username" validate:"required"` + // Details of ingestion source files. + Source *SourceDetails `json:"source" validate:"required"` - // The content type of sourceDataFile. - SourceDataFileContentType *string `json:"source_data_file_content_type,omitempty"` + // Details of ingestion target table. + Target *TargetDetails `json:"target" validate:"required"` - // File format of source file. - SourceFileType *string `json:"source_file_type,omitempty"` + // Spark Engine Detail. + Engine *IngestionEngine `json:"engine,omitempty"` - // Ingestion CSV properties (base64 encoding of a stringifed json). - CsvProperty *string `json:"csv_property,omitempty"` + // ID of the spark engine to be used for ingestion. + EngineID *string `json:"engine_id,omitempty"` - // Create new target table (if true); Insert into pre-existing target table (if false). - CreateIfNotExist *bool `json:"create_if_not_exist,omitempty"` + // Ingestion engine configuration. + ExecuteConfig *ExecuteConfig `json:"execute_config,omitempty"` - // Validate CSV header if the target table exist. - ValidateCsvHeader *bool `json:"validate_csv_header,omitempty"` + // Iceberg source table information. + SourceIcebergTable *IcebergSourceTable `json:"source_iceberg_table,omitempty"` - // Ingestion engine configuration (base64 encoding of a stringifed json). - ExecuteConfig *string `json:"execute_config,omitempty"` + // Comma delimited list of columns to partition by. + PartitionBy *string `json:"partition_by,omitempty"` - // ID of the spark engine to be used for ingestion. - EngineID *string `json:"engine_id,omitempty"` + // Capacity Details. + Capacity *CapacityDetails `json:"capacity,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// Constants associated with the CreateIngestionJobsLocalFilesOptions.SourceFileType property. -// File format of source file. -const ( - CreateIngestionJobsLocalFilesOptions_SourceFileType_Csv = "csv" - CreateIngestionJobsLocalFilesOptions_SourceFileType_JSON = "json" - CreateIngestionJobsLocalFilesOptions_SourceFileType_Parquet = "parquet" -) - -// NewCreateIngestionJobsLocalFilesOptions : Instantiate CreateIngestionJobsLocalFilesOptions -func (*WatsonxDataV2) NewCreateIngestionJobsLocalFilesOptions(authInstanceID string, sourceDataFile io.ReadCloser, targetTable string, jobID string, username string) *CreateIngestionJobsLocalFilesOptions { - return &CreateIngestionJobsLocalFilesOptions{ +// NewCreateIngestionJobOptions : Instantiate CreateIngestionJobOptions +func (*WatsonxDataV3) NewCreateIngestionJobOptions(authInstanceID string, id string, source *SourceDetails, target *TargetDetails) *CreateIngestionJobOptions { + return &CreateIngestionJobOptions{ AuthInstanceID: core.StringPtr(authInstanceID), - SourceDataFile: sourceDataFile, - TargetTable: core.StringPtr(targetTable), - JobID: core.StringPtr(jobID), - Username: core.StringPtr(username), + ID: core.StringPtr(id), + Source: source, + Target: target, } } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *CreateIngestionJobsLocalFilesOptions) SetAuthInstanceID(authInstanceID string) *CreateIngestionJobsLocalFilesOptions { +func (_options *CreateIngestionJobOptions) SetAuthInstanceID(authInstanceID string) *CreateIngestionJobOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } -// SetSourceDataFile : Allow user to set SourceDataFile -func (_options *CreateIngestionJobsLocalFilesOptions) SetSourceDataFile(sourceDataFile io.ReadCloser) *CreateIngestionJobsLocalFilesOptions { - _options.SourceDataFile = sourceDataFile - return _options -} - -// SetTargetTable : Allow user to set TargetTable -func (_options *CreateIngestionJobsLocalFilesOptions) SetTargetTable(targetTable string) *CreateIngestionJobsLocalFilesOptions { - _options.TargetTable = core.StringPtr(targetTable) - return _options -} - -// SetJobID : Allow user to set JobID -func (_options *CreateIngestionJobsLocalFilesOptions) SetJobID(jobID string) *CreateIngestionJobsLocalFilesOptions { - _options.JobID = core.StringPtr(jobID) +// SetID : Allow user to set ID +func (_options *CreateIngestionJobOptions) SetID(id string) *CreateIngestionJobOptions { + _options.ID = core.StringPtr(id) return _options } -// SetUsername : Allow user to set Username -func (_options *CreateIngestionJobsLocalFilesOptions) SetUsername(username string) *CreateIngestionJobsLocalFilesOptions { - _options.Username = core.StringPtr(username) +// SetSource : Allow user to set Source +func (_options *CreateIngestionJobOptions) SetSource(source *SourceDetails) *CreateIngestionJobOptions { + _options.Source = source return _options } -// SetSourceDataFileContentType : Allow user to set SourceDataFileContentType -func (_options *CreateIngestionJobsLocalFilesOptions) SetSourceDataFileContentType(sourceDataFileContentType string) *CreateIngestionJobsLocalFilesOptions { - _options.SourceDataFileContentType = core.StringPtr(sourceDataFileContentType) +// SetTarget : Allow user to set Target +func (_options *CreateIngestionJobOptions) SetTarget(target *TargetDetails) *CreateIngestionJobOptions { + _options.Target = target return _options } -// SetSourceFileType : Allow user to set SourceFileType -func (_options *CreateIngestionJobsLocalFilesOptions) SetSourceFileType(sourceFileType string) *CreateIngestionJobsLocalFilesOptions { - _options.SourceFileType = core.StringPtr(sourceFileType) +// SetEngine : Allow user to set Engine +func (_options *CreateIngestionJobOptions) SetEngine(engine *IngestionEngine) *CreateIngestionJobOptions { + _options.Engine = engine return _options } -// SetCsvProperty : Allow user to set CsvProperty -func (_options *CreateIngestionJobsLocalFilesOptions) SetCsvProperty(csvProperty string) *CreateIngestionJobsLocalFilesOptions { - _options.CsvProperty = core.StringPtr(csvProperty) +// SetEngineID : Allow user to set EngineID +func (_options *CreateIngestionJobOptions) SetEngineID(engineID string) *CreateIngestionJobOptions { + _options.EngineID = core.StringPtr(engineID) return _options } -// SetCreateIfNotExist : Allow user to set CreateIfNotExist -func (_options *CreateIngestionJobsLocalFilesOptions) SetCreateIfNotExist(createIfNotExist bool) *CreateIngestionJobsLocalFilesOptions { - _options.CreateIfNotExist = core.BoolPtr(createIfNotExist) +// SetExecuteConfig : Allow user to set ExecuteConfig +func (_options *CreateIngestionJobOptions) SetExecuteConfig(executeConfig *ExecuteConfig) *CreateIngestionJobOptions { + _options.ExecuteConfig = executeConfig return _options } -// SetValidateCsvHeader : Allow user to set ValidateCsvHeader -func (_options *CreateIngestionJobsLocalFilesOptions) SetValidateCsvHeader(validateCsvHeader bool) *CreateIngestionJobsLocalFilesOptions { - _options.ValidateCsvHeader = core.BoolPtr(validateCsvHeader) +// SetSourceIcebergTable : Allow user to set SourceIcebergTable +func (_options *CreateIngestionJobOptions) SetSourceIcebergTable(sourceIcebergTable *IcebergSourceTable) *CreateIngestionJobOptions { + _options.SourceIcebergTable = sourceIcebergTable return _options } -// SetExecuteConfig : Allow user to set ExecuteConfig -func (_options *CreateIngestionJobsLocalFilesOptions) SetExecuteConfig(executeConfig string) *CreateIngestionJobsLocalFilesOptions { - _options.ExecuteConfig = core.StringPtr(executeConfig) +// SetPartitionBy : Allow user to set PartitionBy +func (_options *CreateIngestionJobOptions) SetPartitionBy(partitionBy string) *CreateIngestionJobOptions { + _options.PartitionBy = core.StringPtr(partitionBy) return _options } -// SetEngineID : Allow user to set EngineID -func (_options *CreateIngestionJobsLocalFilesOptions) SetEngineID(engineID string) *CreateIngestionJobsLocalFilesOptions { - _options.EngineID = core.StringPtr(engineID) +// SetCapacity : Allow user to set Capacity +func (_options *CreateIngestionJobOptions) SetCapacity(capacity *CapacityDetails) *CreateIngestionJobOptions { + _options.Capacity = capacity return _options } // SetHeaders : Allow user to set Headers -func (options *CreateIngestionJobsLocalFilesOptions) SetHeaders(param map[string]string) *CreateIngestionJobsLocalFilesOptions { +func (options *CreateIngestionJobOptions) SetHeaders(param map[string]string) *CreateIngestionJobOptions { options.Headers = param return options } -// CreateIngestionJobsOptions : The CreateIngestionJobs options. -type CreateIngestionJobsOptions struct { - // CRN. - AuthInstanceID *string `json:"AuthInstanceId" validate:"required"` +// CreateIntegrationOptions : The CreateIntegration options. +type CreateIntegrationOptions struct { + // Access Token for the integration of type `databand`. + AccessToken *string `json:"access_token,omitempty"` - // Job ID of the job. - JobID *string `json:"job_id" validate:"required"` + // ApiKey for the integration of type `manta` and `ikc`. + Apikey *string `json:"apikey,omitempty"` - // Comma separated source file or directory path. - SourceDataFiles *string `json:"source_data_files" validate:"required"` + // Details of catalogs associated with `ikc`. + Catalogs *Catalogs `json:"catalogs,omitempty"` - // Target table name in format catalog.schema.table. - TargetTable *string `json:"target_table" validate:"required"` + // Certificate if ssl is enabled for integration type `ikc` (ikc hosted in Cloud Pack for Data) and `ranger`. + Certificate *string `json:"certificate,omitempty"` - // User submitting ingestion job. - Username *string `json:"username" validate:"required"` + // Certificate extension of the certificate provided if ssl is enabled for integration type `ikc` (ikc hosted in Cloud + // Pack for Data) and `ranger`. + CertificateExtension *string `json:"certificate_extension,omitempty"` - // Create new target table (if True); Insert into pre-existing target table (if False). - CreateIfNotExist *bool `json:"create_if_not_exist,omitempty"` + // Connection mode for manta. + ConnectionMode *string `json:"connection_mode,omitempty"` - // Ingestion CSV properties. - CsvProperty *IngestionJobPrototypeCsvProperty `json:"csv_property,omitempty"` + // To enable/disable cross account integration for `ikc` in IBM Cloud / MCSP. + CrossAccountIntegration *bool `json:"cross_account_integration,omitempty"` - // ID of the spark engine to be used for ingestion. - EngineID *string `json:"engine_id,omitempty"` + // To check if WatsonX.data policies are enabled along with `ranger`. + EnableDataPolicyWithinWxd *bool `json:"enable_data_policy_within_wxd,omitempty"` - // Ingestion engine configuration. - ExecuteConfig *IngestionJobPrototypeExecuteConfig `json:"execute_config,omitempty"` + // The Account ID where the `ikc` is existing with which cross account integration needs to be enabled, to be used + // compulsorily with `cross_account_integration`. + IkcUserAccountID *string `json:"ikc_user_account_id,omitempty"` - // Partition by expression of the target table. - PartitionBy *string `json:"partition_by,omitempty"` - - // Schema definition of the source table. - Schema *string `json:"schema,omitempty"` - - // Source file types (parquet or csv or json). - SourceFileType *string `json:"source_file_type,omitempty"` - - // Validate CSV header if the target table exist. - ValidateCsvHeader *bool `json:"validate_csv_header,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// Constants associated with the CreateIngestionJobsOptions.SourceFileType property. -// Source file types (parquet or csv or json). -const ( - CreateIngestionJobsOptions_SourceFileType_Csv = "csv" - CreateIngestionJobsOptions_SourceFileType_JSON = "json" - CreateIngestionJobsOptions_SourceFileType_Parquet = "parquet" -) - -// NewCreateIngestionJobsOptions : Instantiate CreateIngestionJobsOptions -func (*WatsonxDataV2) NewCreateIngestionJobsOptions(authInstanceID string, jobID string, sourceDataFiles string, targetTable string, username string) *CreateIngestionJobsOptions { - return &CreateIngestionJobsOptions{ - AuthInstanceID: core.StringPtr(authInstanceID), - JobID: core.StringPtr(jobID), - SourceDataFiles: core.StringPtr(sourceDataFiles), - TargetTable: core.StringPtr(targetTable), - Username: core.StringPtr(username), - } -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *CreateIngestionJobsOptions) SetAuthInstanceID(authInstanceID string) *CreateIngestionJobsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetJobID : Allow user to set JobID -func (_options *CreateIngestionJobsOptions) SetJobID(jobID string) *CreateIngestionJobsOptions { - _options.JobID = core.StringPtr(jobID) - return _options -} - -// SetSourceDataFiles : Allow user to set SourceDataFiles -func (_options *CreateIngestionJobsOptions) SetSourceDataFiles(sourceDataFiles string) *CreateIngestionJobsOptions { - _options.SourceDataFiles = core.StringPtr(sourceDataFiles) - return _options -} - -// SetTargetTable : Allow user to set TargetTable -func (_options *CreateIngestionJobsOptions) SetTargetTable(targetTable string) *CreateIngestionJobsOptions { - _options.TargetTable = core.StringPtr(targetTable) - return _options -} - -// SetUsername : Allow user to set Username -func (_options *CreateIngestionJobsOptions) SetUsername(username string) *CreateIngestionJobsOptions { - _options.Username = core.StringPtr(username) - return _options -} - -// SetCreateIfNotExist : Allow user to set CreateIfNotExist -func (_options *CreateIngestionJobsOptions) SetCreateIfNotExist(createIfNotExist bool) *CreateIngestionJobsOptions { - _options.CreateIfNotExist = core.BoolPtr(createIfNotExist) - return _options -} - -// SetCsvProperty : Allow user to set CsvProperty -func (_options *CreateIngestionJobsOptions) SetCsvProperty(csvProperty *IngestionJobPrototypeCsvProperty) *CreateIngestionJobsOptions { - _options.CsvProperty = csvProperty - return _options -} - -// SetEngineID : Allow user to set EngineID -func (_options *CreateIngestionJobsOptions) SetEngineID(engineID string) *CreateIngestionJobsOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetExecuteConfig : Allow user to set ExecuteConfig -func (_options *CreateIngestionJobsOptions) SetExecuteConfig(executeConfig *IngestionJobPrototypeExecuteConfig) *CreateIngestionJobsOptions { - _options.ExecuteConfig = executeConfig - return _options -} - -// SetPartitionBy : Allow user to set PartitionBy -func (_options *CreateIngestionJobsOptions) SetPartitionBy(partitionBy string) *CreateIngestionJobsOptions { - _options.PartitionBy = core.StringPtr(partitionBy) - return _options -} - -// SetSchema : Allow user to set Schema -func (_options *CreateIngestionJobsOptions) SetSchema(schema string) *CreateIngestionJobsOptions { - _options.Schema = core.StringPtr(schema) - return _options -} - -// SetSourceFileType : Allow user to set SourceFileType -func (_options *CreateIngestionJobsOptions) SetSourceFileType(sourceFileType string) *CreateIngestionJobsOptions { - _options.SourceFileType = core.StringPtr(sourceFileType) - return _options -} - -// SetValidateCsvHeader : Allow user to set ValidateCsvHeader -func (_options *CreateIngestionJobsOptions) SetValidateCsvHeader(validateCsvHeader bool) *CreateIngestionJobsOptions { - _options.ValidateCsvHeader = core.BoolPtr(validateCsvHeader) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateIngestionJobsOptions) SetHeaders(param map[string]string) *CreateIngestionJobsOptions { - options.Headers = param - return options -} - -// CreateIntegrationOptions : The CreateIntegration options. -type CreateIntegrationOptions struct { - // token for databand. - AccessToken *string `json:"access_token,omitempty"` - - // Integration APIKEY. - Apikey *string `json:"apikey,omitempty"` - - // cross account integration enabler/disabler. - CrossAccountIntegration *bool `json:"cross_account_integration,omitempty"` - - // data policy enabler with wxd for ranger. - EnableDataPolicyWithinWxd *bool `json:"enable_data_policy_within_wxd,omitempty"` - - // token for ikc. - IkcUserAccountID *string `json:"ikc_user_account_id,omitempty"` - - // Integration password. + // Password for the integration of type `ranger`. Password *string `json:"password,omitempty"` - // resouce for ranger. + // Displays the policy cache type configuration for integration type `ranger`. + PolicyCacheTimeConfiguration *string `json:"policy_cache_time_configuration,omitempty"` + + // Currently selected resource for `ranger`. Resource *string `json:"resource,omitempty"` - // Integration type. - ServiceType *string `json:"service_type,omitempty"` + // SSL enabled/disabled for `ikc` (ikc hosted in Cloud Pack for Data) and `ranger`. + Ssl *bool `json:"ssl,omitempty"` - // Comma separated list of bucket catalogs which have ikc enabled. - StorageCatalogs []string `json:"storage_catalogs,omitempty"` + // Type of the integration to be integrated. It can only have the following values: `ranger`, `ikc`, `databand` and + // `manta`. + Type *string `json:"type,omitempty"` - // Integration Connection URL. + // URL of the integration to be integrated. Applicable for all the 4 types: `ranger`, `ikc`, `databand` and `manta`. URL *string `json:"url,omitempty"` - // Integration username. + // Username of the `ikc`/`manta`/`ranger` integration to be integrated. Username *string `json:"username,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -13713,7 +14335,7 @@ type CreateIntegrationOptions struct { } // NewCreateIntegrationOptions : Instantiate CreateIntegrationOptions -func (*WatsonxDataV2) NewCreateIntegrationOptions() *CreateIntegrationOptions { +func (*WatsonxDataV3) NewCreateIntegrationOptions() *CreateIntegrationOptions { return &CreateIntegrationOptions{} } @@ -13729,6 +14351,30 @@ func (_options *CreateIntegrationOptions) SetApikey(apikey string) *CreateIntegr return _options } +// SetCatalogs : Allow user to set Catalogs +func (_options *CreateIntegrationOptions) SetCatalogs(catalogs *Catalogs) *CreateIntegrationOptions { + _options.Catalogs = catalogs + return _options +} + +// SetCertificate : Allow user to set Certificate +func (_options *CreateIntegrationOptions) SetCertificate(certificate string) *CreateIntegrationOptions { + _options.Certificate = core.StringPtr(certificate) + return _options +} + +// SetCertificateExtension : Allow user to set CertificateExtension +func (_options *CreateIntegrationOptions) SetCertificateExtension(certificateExtension string) *CreateIntegrationOptions { + _options.CertificateExtension = core.StringPtr(certificateExtension) + return _options +} + +// SetConnectionMode : Allow user to set ConnectionMode +func (_options *CreateIntegrationOptions) SetConnectionMode(connectionMode string) *CreateIntegrationOptions { + _options.ConnectionMode = core.StringPtr(connectionMode) + return _options +} + // SetCrossAccountIntegration : Allow user to set CrossAccountIntegration func (_options *CreateIntegrationOptions) SetCrossAccountIntegration(crossAccountIntegration bool) *CreateIntegrationOptions { _options.CrossAccountIntegration = core.BoolPtr(crossAccountIntegration) @@ -13753,21 +14399,27 @@ func (_options *CreateIntegrationOptions) SetPassword(password string) *CreateIn return _options } +// SetPolicyCacheTimeConfiguration : Allow user to set PolicyCacheTimeConfiguration +func (_options *CreateIntegrationOptions) SetPolicyCacheTimeConfiguration(policyCacheTimeConfiguration string) *CreateIntegrationOptions { + _options.PolicyCacheTimeConfiguration = core.StringPtr(policyCacheTimeConfiguration) + return _options +} + // SetResource : Allow user to set Resource func (_options *CreateIntegrationOptions) SetResource(resource string) *CreateIntegrationOptions { _options.Resource = core.StringPtr(resource) return _options } -// SetServiceType : Allow user to set ServiceType -func (_options *CreateIntegrationOptions) SetServiceType(serviceType string) *CreateIntegrationOptions { - _options.ServiceType = core.StringPtr(serviceType) +// SetSsl : Allow user to set Ssl +func (_options *CreateIntegrationOptions) SetSsl(ssl bool) *CreateIntegrationOptions { + _options.Ssl = core.BoolPtr(ssl) return _options } -// SetStorageCatalogs : Allow user to set StorageCatalogs -func (_options *CreateIntegrationOptions) SetStorageCatalogs(storageCatalogs []string) *CreateIntegrationOptions { - _options.StorageCatalogs = storageCatalogs +// SetType : Allow user to set Type +func (_options *CreateIntegrationOptions) SetType(typeVar string) *CreateIntegrationOptions { + _options.Type = core.StringPtr(typeVar) return _options } @@ -13797,50 +14449,158 @@ func (options *CreateIntegrationOptions) SetHeaders(param map[string]string) *Cr // CreateMilvusServiceOptions : The CreateMilvusService options. type CreateMilvusServiceOptions struct { - // bucket name. - BucketName *string `json:"bucket_name" validate:"required"` + // Display name for milvus services. + DisplayName *string `json:"display_name" validate:"required"` - // Origin - place holder. + // Origin of the milvus service. Origin *string `json:"origin" validate:"required"` - // root path. + // Root path in storage where milvus vectors will be stored. RootPath *string `json:"root_path" validate:"required"` - // Service display name. - ServiceDisplayName *string `json:"service_display_name" validate:"required"` + // Predefined tshirt size for the milvus service. + TshirtSize *string `json:"tshirt_size" validate:"required"` + + // data coordinator cpus, only configurable in cpd. + DcCpu *float64 `json:"dc_cpu,omitempty"` + + // data coordinator memory, only configurable in cpd. + DcMemory *float64 `json:"dc_memory,omitempty"` - // bucket type. - BucketType *string `json:"bucket_type,omitempty"` + // data coordinator replicas, only configurable in cpd. + DcReplicas *int64 `json:"dc_replicas,omitempty"` - // Service description. + // Descriptioon of Milvus service added by the user. Description *string `json:"description,omitempty"` + // data worker cpus, only configurable in cpd. + DwCpu *float64 `json:"dw_cpu,omitempty"` + + // data worker memory, only configurable in cpd. + DwMemory *float64 `json:"dw_memory,omitempty"` + + // data worker replicas, only configurable in cpd. + DwReplicas *int64 `json:"dw_replicas,omitempty"` + + // etcd cpus, only configurable in cpd. + EtcdCpu *float64 `json:"etcd_cpu,omitempty"` + + // etcd memory, only configurable in cpd. + EtcdMemory *float64 `json:"etcd_memory,omitempty"` + + // Engine id. + ID *string `json:"id,omitempty"` + + // index type. + IndexType *string `json:"index_type,omitempty"` + + // index worker cpu. + IwCpu *float64 `json:"iw_cpu,omitempty"` + + // index worker memory. + IwMemory *float64 `json:"iw_memory,omitempty"` + + // index worker replicas. + IwReplicas *int64 `json:"iw_replicas,omitempty"` + + // kafka cpus, only configurable in cpd. + KafkaCpu *float64 `json:"kafka_cpu,omitempty"` + + // kafka memory, only configurable in cpd. + KafkaMemory *float64 `json:"kafka_memory,omitempty"` + + // proxy cpus, only configurable in cpd. + ProxyCpu *float64 `json:"proxy_cpu,omitempty"` + + // proxy memory, only configurable in cpd. + ProxyMemory *float64 `json:"proxy_memory,omitempty"` + + // proxy replicas, only configurable in cpd. + ProxyReplicas *int64 `json:"proxy_replicas,omitempty"` + + // query coordinator cpus, only configurable in cpd. + QcCpu *float64 `json:"qc_cpu,omitempty"` + + // query coordinator memory, only configurable in cpd. + QcMemory *float64 `json:"qc_memory,omitempty"` + + // query coordinator replicas, only configurable in cpd. + QcReplicas *int64 `json:"qc_replicas,omitempty"` + + // query worker cpu. + QwCpu *float64 `json:"qw_cpu,omitempty"` + + // query worker memory. + QwMemory *float64 `json:"qw_memory,omitempty"` + + // query worker replicas. + QwReplicas *int64 `json:"qw_replicas,omitempty"` + + // root coordinator cpus, only configurable in cpd. + RcCpu *float64 `json:"rc_cpu,omitempty"` + + // root coodinator memory, only configurable in cpd. + RcMemory *float64 `json:"rc_memory,omitempty"` + + // root coordinator replicas, only configurable in cpd. + RcReplicas *int64 `json:"rc_replicas,omitempty"` + + // storage name. + StorageName *string `json:"storage_name,omitempty"` + // Tags. Tags []string `json:"tags,omitempty"` - // tshirt size. - TshirtSize *string `json:"tshirt_size,omitempty"` + // vector. + Vector *int64 `json:"vector,omitempty"` - // CRN. + // vector dimension. + VectorDimension *int64 `json:"vector_dimension,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } +// Constants associated with the CreateMilvusServiceOptions.Origin property. +// Origin of the milvus service. +const ( + CreateMilvusServiceOptions_Origin_Native = "native" +) + +// Constants associated with the CreateMilvusServiceOptions.TshirtSize property. +// Predefined tshirt size for the milvus service. +const ( + CreateMilvusServiceOptions_TshirtSize_Custom = "custom" + CreateMilvusServiceOptions_TshirtSize_Large = "large" + CreateMilvusServiceOptions_TshirtSize_Medium = "medium" + CreateMilvusServiceOptions_TshirtSize_Small = "small" + CreateMilvusServiceOptions_TshirtSize_Starter = "starter" +) + +// Constants associated with the CreateMilvusServiceOptions.IndexType property. +// index type. +const ( + CreateMilvusServiceOptions_IndexType_Hnsw = "hnsw" + CreateMilvusServiceOptions_IndexType_IvfPq = "ivf_pq" + CreateMilvusServiceOptions_IndexType_IvfSq8 = "ivf_sq8" +) + // NewCreateMilvusServiceOptions : Instantiate CreateMilvusServiceOptions -func (*WatsonxDataV2) NewCreateMilvusServiceOptions(bucketName string, origin string, rootPath string, serviceDisplayName string) *CreateMilvusServiceOptions { +func (*WatsonxDataV3) NewCreateMilvusServiceOptions(displayName string, origin string, rootPath string, tshirtSize string) *CreateMilvusServiceOptions { return &CreateMilvusServiceOptions{ - BucketName: core.StringPtr(bucketName), + DisplayName: core.StringPtr(displayName), Origin: core.StringPtr(origin), RootPath: core.StringPtr(rootPath), - ServiceDisplayName: core.StringPtr(serviceDisplayName), + TshirtSize: core.StringPtr(tshirtSize), } } -// SetBucketName : Allow user to set BucketName -func (_options *CreateMilvusServiceOptions) SetBucketName(bucketName string) *CreateMilvusServiceOptions { - _options.BucketName = core.StringPtr(bucketName) +// SetDisplayName : Allow user to set DisplayName +func (_options *CreateMilvusServiceOptions) SetDisplayName(displayName string) *CreateMilvusServiceOptions { + _options.DisplayName = core.StringPtr(displayName) return _options } @@ -13856,15 +14616,27 @@ func (_options *CreateMilvusServiceOptions) SetRootPath(rootPath string) *Create return _options } -// SetServiceDisplayName : Allow user to set ServiceDisplayName -func (_options *CreateMilvusServiceOptions) SetServiceDisplayName(serviceDisplayName string) *CreateMilvusServiceOptions { - _options.ServiceDisplayName = core.StringPtr(serviceDisplayName) +// SetTshirtSize : Allow user to set TshirtSize +func (_options *CreateMilvusServiceOptions) SetTshirtSize(tshirtSize string) *CreateMilvusServiceOptions { + _options.TshirtSize = core.StringPtr(tshirtSize) + return _options +} + +// SetDcCpu : Allow user to set DcCpu +func (_options *CreateMilvusServiceOptions) SetDcCpu(dcCpu float64) *CreateMilvusServiceOptions { + _options.DcCpu = core.Float64Ptr(dcCpu) + return _options +} + +// SetDcMemory : Allow user to set DcMemory +func (_options *CreateMilvusServiceOptions) SetDcMemory(dcMemory float64) *CreateMilvusServiceOptions { + _options.DcMemory = core.Float64Ptr(dcMemory) return _options } -// SetBucketType : Allow user to set BucketType -func (_options *CreateMilvusServiceOptions) SetBucketType(bucketType string) *CreateMilvusServiceOptions { - _options.BucketType = core.StringPtr(bucketType) +// SetDcReplicas : Allow user to set DcReplicas +func (_options *CreateMilvusServiceOptions) SetDcReplicas(dcReplicas int64) *CreateMilvusServiceOptions { + _options.DcReplicas = core.Int64Ptr(dcReplicas) return _options } @@ -13874,15 +14646,171 @@ func (_options *CreateMilvusServiceOptions) SetDescription(description string) * return _options } +// SetDwCpu : Allow user to set DwCpu +func (_options *CreateMilvusServiceOptions) SetDwCpu(dwCpu float64) *CreateMilvusServiceOptions { + _options.DwCpu = core.Float64Ptr(dwCpu) + return _options +} + +// SetDwMemory : Allow user to set DwMemory +func (_options *CreateMilvusServiceOptions) SetDwMemory(dwMemory float64) *CreateMilvusServiceOptions { + _options.DwMemory = core.Float64Ptr(dwMemory) + return _options +} + +// SetDwReplicas : Allow user to set DwReplicas +func (_options *CreateMilvusServiceOptions) SetDwReplicas(dwReplicas int64) *CreateMilvusServiceOptions { + _options.DwReplicas = core.Int64Ptr(dwReplicas) + return _options +} + +// SetEtcdCpu : Allow user to set EtcdCpu +func (_options *CreateMilvusServiceOptions) SetEtcdCpu(etcdCpu float64) *CreateMilvusServiceOptions { + _options.EtcdCpu = core.Float64Ptr(etcdCpu) + return _options +} + +// SetEtcdMemory : Allow user to set EtcdMemory +func (_options *CreateMilvusServiceOptions) SetEtcdMemory(etcdMemory float64) *CreateMilvusServiceOptions { + _options.EtcdMemory = core.Float64Ptr(etcdMemory) + return _options +} + +// SetID : Allow user to set ID +func (_options *CreateMilvusServiceOptions) SetID(id string) *CreateMilvusServiceOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIndexType : Allow user to set IndexType +func (_options *CreateMilvusServiceOptions) SetIndexType(indexType string) *CreateMilvusServiceOptions { + _options.IndexType = core.StringPtr(indexType) + return _options +} + +// SetIwCpu : Allow user to set IwCpu +func (_options *CreateMilvusServiceOptions) SetIwCpu(iwCpu float64) *CreateMilvusServiceOptions { + _options.IwCpu = core.Float64Ptr(iwCpu) + return _options +} + +// SetIwMemory : Allow user to set IwMemory +func (_options *CreateMilvusServiceOptions) SetIwMemory(iwMemory float64) *CreateMilvusServiceOptions { + _options.IwMemory = core.Float64Ptr(iwMemory) + return _options +} + +// SetIwReplicas : Allow user to set IwReplicas +func (_options *CreateMilvusServiceOptions) SetIwReplicas(iwReplicas int64) *CreateMilvusServiceOptions { + _options.IwReplicas = core.Int64Ptr(iwReplicas) + return _options +} + +// SetKafkaCpu : Allow user to set KafkaCpu +func (_options *CreateMilvusServiceOptions) SetKafkaCpu(kafkaCpu float64) *CreateMilvusServiceOptions { + _options.KafkaCpu = core.Float64Ptr(kafkaCpu) + return _options +} + +// SetKafkaMemory : Allow user to set KafkaMemory +func (_options *CreateMilvusServiceOptions) SetKafkaMemory(kafkaMemory float64) *CreateMilvusServiceOptions { + _options.KafkaMemory = core.Float64Ptr(kafkaMemory) + return _options +} + +// SetProxyCpu : Allow user to set ProxyCpu +func (_options *CreateMilvusServiceOptions) SetProxyCpu(proxyCpu float64) *CreateMilvusServiceOptions { + _options.ProxyCpu = core.Float64Ptr(proxyCpu) + return _options +} + +// SetProxyMemory : Allow user to set ProxyMemory +func (_options *CreateMilvusServiceOptions) SetProxyMemory(proxyMemory float64) *CreateMilvusServiceOptions { + _options.ProxyMemory = core.Float64Ptr(proxyMemory) + return _options +} + +// SetProxyReplicas : Allow user to set ProxyReplicas +func (_options *CreateMilvusServiceOptions) SetProxyReplicas(proxyReplicas int64) *CreateMilvusServiceOptions { + _options.ProxyReplicas = core.Int64Ptr(proxyReplicas) + return _options +} + +// SetQcCpu : Allow user to set QcCpu +func (_options *CreateMilvusServiceOptions) SetQcCpu(qcCpu float64) *CreateMilvusServiceOptions { + _options.QcCpu = core.Float64Ptr(qcCpu) + return _options +} + +// SetQcMemory : Allow user to set QcMemory +func (_options *CreateMilvusServiceOptions) SetQcMemory(qcMemory float64) *CreateMilvusServiceOptions { + _options.QcMemory = core.Float64Ptr(qcMemory) + return _options +} + +// SetQcReplicas : Allow user to set QcReplicas +func (_options *CreateMilvusServiceOptions) SetQcReplicas(qcReplicas int64) *CreateMilvusServiceOptions { + _options.QcReplicas = core.Int64Ptr(qcReplicas) + return _options +} + +// SetQwCpu : Allow user to set QwCpu +func (_options *CreateMilvusServiceOptions) SetQwCpu(qwCpu float64) *CreateMilvusServiceOptions { + _options.QwCpu = core.Float64Ptr(qwCpu) + return _options +} + +// SetQwMemory : Allow user to set QwMemory +func (_options *CreateMilvusServiceOptions) SetQwMemory(qwMemory float64) *CreateMilvusServiceOptions { + _options.QwMemory = core.Float64Ptr(qwMemory) + return _options +} + +// SetQwReplicas : Allow user to set QwReplicas +func (_options *CreateMilvusServiceOptions) SetQwReplicas(qwReplicas int64) *CreateMilvusServiceOptions { + _options.QwReplicas = core.Int64Ptr(qwReplicas) + return _options +} + +// SetRcCpu : Allow user to set RcCpu +func (_options *CreateMilvusServiceOptions) SetRcCpu(rcCpu float64) *CreateMilvusServiceOptions { + _options.RcCpu = core.Float64Ptr(rcCpu) + return _options +} + +// SetRcMemory : Allow user to set RcMemory +func (_options *CreateMilvusServiceOptions) SetRcMemory(rcMemory float64) *CreateMilvusServiceOptions { + _options.RcMemory = core.Float64Ptr(rcMemory) + return _options +} + +// SetRcReplicas : Allow user to set RcReplicas +func (_options *CreateMilvusServiceOptions) SetRcReplicas(rcReplicas int64) *CreateMilvusServiceOptions { + _options.RcReplicas = core.Int64Ptr(rcReplicas) + return _options +} + +// SetStorageName : Allow user to set StorageName +func (_options *CreateMilvusServiceOptions) SetStorageName(storageName string) *CreateMilvusServiceOptions { + _options.StorageName = core.StringPtr(storageName) + return _options +} + // SetTags : Allow user to set Tags func (_options *CreateMilvusServiceOptions) SetTags(tags []string) *CreateMilvusServiceOptions { _options.Tags = tags return _options } -// SetTshirtSize : Allow user to set TshirtSize -func (_options *CreateMilvusServiceOptions) SetTshirtSize(tshirtSize string) *CreateMilvusServiceOptions { - _options.TshirtSize = core.StringPtr(tshirtSize) +// SetVector : Allow user to set Vector +func (_options *CreateMilvusServiceOptions) SetVector(vector int64) *CreateMilvusServiceOptions { + _options.Vector = core.Int64Ptr(vector) + return _options +} + +// SetVectorDimension : Allow user to set VectorDimension +func (_options *CreateMilvusServiceOptions) SetVectorDimension(vectorDimension int64) *CreateMilvusServiceOptions { + _options.VectorDimension = core.Int64Ptr(vectorDimension) return _options } @@ -13900,10 +14828,10 @@ func (options *CreateMilvusServiceOptions) SetHeaders(param map[string]string) * // CreateMilvusServicePauseOptions : The CreateMilvusServicePause options. type CreateMilvusServicePauseOptions struct { - // service id. - ServiceID *string `json:"service_id" validate:"required,ne="` + // id. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -13911,15 +14839,15 @@ type CreateMilvusServicePauseOptions struct { } // NewCreateMilvusServicePauseOptions : Instantiate CreateMilvusServicePauseOptions -func (*WatsonxDataV2) NewCreateMilvusServicePauseOptions(serviceID string) *CreateMilvusServicePauseOptions { +func (*WatsonxDataV3) NewCreateMilvusServicePauseOptions(id string) *CreateMilvusServicePauseOptions { return &CreateMilvusServicePauseOptions{ - ServiceID: core.StringPtr(serviceID), + ID: core.StringPtr(id), } } -// SetServiceID : Allow user to set ServiceID -func (_options *CreateMilvusServicePauseOptions) SetServiceID(serviceID string) *CreateMilvusServicePauseOptions { - _options.ServiceID = core.StringPtr(serviceID) +// SetID : Allow user to set ID +func (_options *CreateMilvusServicePauseOptions) SetID(id string) *CreateMilvusServicePauseOptions { + _options.ID = core.StringPtr(id) return _options } @@ -13937,10 +14865,10 @@ func (options *CreateMilvusServicePauseOptions) SetHeaders(param map[string]stri // CreateMilvusServiceResumeOptions : The CreateMilvusServiceResume options. type CreateMilvusServiceResumeOptions struct { - // service id. - ServiceID *string `json:"service_id" validate:"required,ne="` + // id. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -13948,15 +14876,15 @@ type CreateMilvusServiceResumeOptions struct { } // NewCreateMilvusServiceResumeOptions : Instantiate CreateMilvusServiceResumeOptions -func (*WatsonxDataV2) NewCreateMilvusServiceResumeOptions(serviceID string) *CreateMilvusServiceResumeOptions { +func (*WatsonxDataV3) NewCreateMilvusServiceResumeOptions(id string) *CreateMilvusServiceResumeOptions { return &CreateMilvusServiceResumeOptions{ - ServiceID: core.StringPtr(serviceID), + ID: core.StringPtr(id), } } -// SetServiceID : Allow user to set ServiceID -func (_options *CreateMilvusServiceResumeOptions) SetServiceID(serviceID string) *CreateMilvusServiceResumeOptions { - _options.ServiceID = core.StringPtr(serviceID) +// SetID : Allow user to set ID +func (_options *CreateMilvusServiceResumeOptions) SetID(id string) *CreateMilvusServiceResumeOptions { + _options.ID = core.StringPtr(id) return _options } @@ -13974,29 +14902,142 @@ func (options *CreateMilvusServiceResumeOptions) SetHeaders(param map[string]str // CreateMilvusServiceScaleOptions : The CreateMilvusServiceScale options. type CreateMilvusServiceScaleOptions struct { - // service id. - ServiceID *string `json:"service_id" validate:"required,ne="` + // id. + ID *string `json:"id" validate:"required,ne="` // tshirt size. - TshirtSize *string `json:"tshirt_size,omitempty"` + TshirtSize *string `json:"tshirt_size" validate:"required"` + + // data coordinator cpus, only configurable in cpd. + DcCpu *float64 `json:"dc_cpu,omitempty"` + + // data coordinator memory, only configurable in cpd. + DcMemory *float64 `json:"dc_memory,omitempty"` + + // data coordinator replicas, only configurable in cpd. + DcReplicas *int64 `json:"dc_replicas,omitempty"` + + // data worker cpus, only configurable in cpd. + DwCpu *float64 `json:"dw_cpu,omitempty"` + + // data worker memory, only configurable in cpd. + DwMemory *float64 `json:"dw_memory,omitempty"` + + // data worker replicas, only configurable in cpd. + DwReplicas *int64 `json:"dw_replicas,omitempty"` + + // etcd cpus, only configurable in cpd. + EtcdCpu *float64 `json:"etcd_cpu,omitempty"` + + // etcd memory, only configurable in cpd. + EtcdMemory *float64 `json:"etcd_memory,omitempty"` + + // index type, required for custom size. + IndexType *string `json:"index_type,omitempty"` + + // index worker cpus. + IwCpu *float64 `json:"iw_cpu,omitempty"` + + // index worker memory. + IwMemory *float64 `json:"iw_memory,omitempty"` + + // index worker replicas. + IwReplicas *int64 `json:"iw_replicas,omitempty"` + + // kafka cpus, only configurable in cpd. + KafkaCpu *float64 `json:"kafka_cpu,omitempty"` + + // kafka memory, only configurable in cpd. + KafkaMemory *float64 `json:"kafka_memory,omitempty"` + + // proxy cpus, only configurable in cpd. + ProxyCpu *float64 `json:"proxy_cpu,omitempty"` + + // proxy memory, only configurable in cpd. + ProxyMemory *float64 `json:"proxy_memory,omitempty"` + + // proxy replicas, only configurable in cpd. + ProxyReplicas *int64 `json:"proxy_replicas,omitempty"` + + // query coordinator cpus, only configurable in cpd. + QcCpu *float64 `json:"qc_cpu,omitempty"` + + // query coordinator memory, only configurable in cpd. + QcMemory *float64 `json:"qc_memory,omitempty"` + + // query coordinator replicas, only configurable in cpd. + QcReplicas *int64 `json:"qc_replicas,omitempty"` + + // query worker cpus. + QwCpu *float64 `json:"qw_cpu,omitempty"` + + // query worker memory. + QwMemory *float64 `json:"qw_memory,omitempty"` + + // query worker replicas. + QwReplicas *int64 `json:"qw_replicas,omitempty"` - // CRN. + // root coordinator cpus, only configurable in cpd. + RcCpu *float64 `json:"rc_cpu,omitempty"` + + // root coodinator memory, only configurable in cpd. + RcMemory *float64 `json:"rc_memory,omitempty"` + + // root coordinator replicas, only configurable in cpd. + RcReplicas *int64 `json:"rc_replicas,omitempty"` + + // vector. + Vector *int64 `json:"vector,omitempty"` + + // vector dimension. + VectorDimension *int64 `json:"vector_dimension,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } +// Constants associated with the CreateMilvusServiceScaleOptions.TshirtSize property. +// tshirt size. +const ( + CreateMilvusServiceScaleOptions_TshirtSize_Custom = "custom" + CreateMilvusServiceScaleOptions_TshirtSize_Large = "large" + CreateMilvusServiceScaleOptions_TshirtSize_Medium = "medium" + CreateMilvusServiceScaleOptions_TshirtSize_Small = "small" + CreateMilvusServiceScaleOptions_TshirtSize_Starter = "starter" + CreateMilvusServiceScaleOptions_TshirtSize_Xlarge = "xlarge" + CreateMilvusServiceScaleOptions_TshirtSize_Xxlarge = "xxlarge" +) + +// Constants associated with the CreateMilvusServiceScaleOptions.IndexType property. +// index type, required for custom size. +const ( + CreateMilvusServiceScaleOptions_IndexType_Flat = "flat" + CreateMilvusServiceScaleOptions_IndexType_Gpu = "gpu" + CreateMilvusServiceScaleOptions_IndexType_GpuBruteForce = "gpu_brute_force" + CreateMilvusServiceScaleOptions_IndexType_GpuCagra = "gpu_cagra" + CreateMilvusServiceScaleOptions_IndexType_GpuIvfFlat = "gpu_ivf_flat" + CreateMilvusServiceScaleOptions_IndexType_GpuIvfPq = "gpu_ivf_pq" + CreateMilvusServiceScaleOptions_IndexType_Hnsw = "hnsw" + CreateMilvusServiceScaleOptions_IndexType_IvfFlat = "ivf_flat" + CreateMilvusServiceScaleOptions_IndexType_IvfPq = "ivf_pq" + CreateMilvusServiceScaleOptions_IndexType_IvfSq8 = "ivf_sq8" + CreateMilvusServiceScaleOptions_IndexType_Scann = "scann" +) + // NewCreateMilvusServiceScaleOptions : Instantiate CreateMilvusServiceScaleOptions -func (*WatsonxDataV2) NewCreateMilvusServiceScaleOptions(serviceID string) *CreateMilvusServiceScaleOptions { +func (*WatsonxDataV3) NewCreateMilvusServiceScaleOptions(id string, tshirtSize string) *CreateMilvusServiceScaleOptions { return &CreateMilvusServiceScaleOptions{ - ServiceID: core.StringPtr(serviceID), + ID: core.StringPtr(id), + TshirtSize: core.StringPtr(tshirtSize), } } -// SetServiceID : Allow user to set ServiceID -func (_options *CreateMilvusServiceScaleOptions) SetServiceID(serviceID string) *CreateMilvusServiceScaleOptions { - _options.ServiceID = core.StringPtr(serviceID) +// SetID : Allow user to set ID +func (_options *CreateMilvusServiceScaleOptions) SetID(id string) *CreateMilvusServiceScaleOptions { + _options.ID = core.StringPtr(id) return _options } @@ -14006,6 +15047,174 @@ func (_options *CreateMilvusServiceScaleOptions) SetTshirtSize(tshirtSize string return _options } +// SetDcCpu : Allow user to set DcCpu +func (_options *CreateMilvusServiceScaleOptions) SetDcCpu(dcCpu float64) *CreateMilvusServiceScaleOptions { + _options.DcCpu = core.Float64Ptr(dcCpu) + return _options +} + +// SetDcMemory : Allow user to set DcMemory +func (_options *CreateMilvusServiceScaleOptions) SetDcMemory(dcMemory float64) *CreateMilvusServiceScaleOptions { + _options.DcMemory = core.Float64Ptr(dcMemory) + return _options +} + +// SetDcReplicas : Allow user to set DcReplicas +func (_options *CreateMilvusServiceScaleOptions) SetDcReplicas(dcReplicas int64) *CreateMilvusServiceScaleOptions { + _options.DcReplicas = core.Int64Ptr(dcReplicas) + return _options +} + +// SetDwCpu : Allow user to set DwCpu +func (_options *CreateMilvusServiceScaleOptions) SetDwCpu(dwCpu float64) *CreateMilvusServiceScaleOptions { + _options.DwCpu = core.Float64Ptr(dwCpu) + return _options +} + +// SetDwMemory : Allow user to set DwMemory +func (_options *CreateMilvusServiceScaleOptions) SetDwMemory(dwMemory float64) *CreateMilvusServiceScaleOptions { + _options.DwMemory = core.Float64Ptr(dwMemory) + return _options +} + +// SetDwReplicas : Allow user to set DwReplicas +func (_options *CreateMilvusServiceScaleOptions) SetDwReplicas(dwReplicas int64) *CreateMilvusServiceScaleOptions { + _options.DwReplicas = core.Int64Ptr(dwReplicas) + return _options +} + +// SetEtcdCpu : Allow user to set EtcdCpu +func (_options *CreateMilvusServiceScaleOptions) SetEtcdCpu(etcdCpu float64) *CreateMilvusServiceScaleOptions { + _options.EtcdCpu = core.Float64Ptr(etcdCpu) + return _options +} + +// SetEtcdMemory : Allow user to set EtcdMemory +func (_options *CreateMilvusServiceScaleOptions) SetEtcdMemory(etcdMemory float64) *CreateMilvusServiceScaleOptions { + _options.EtcdMemory = core.Float64Ptr(etcdMemory) + return _options +} + +// SetIndexType : Allow user to set IndexType +func (_options *CreateMilvusServiceScaleOptions) SetIndexType(indexType string) *CreateMilvusServiceScaleOptions { + _options.IndexType = core.StringPtr(indexType) + return _options +} + +// SetIwCpu : Allow user to set IwCpu +func (_options *CreateMilvusServiceScaleOptions) SetIwCpu(iwCpu float64) *CreateMilvusServiceScaleOptions { + _options.IwCpu = core.Float64Ptr(iwCpu) + return _options +} + +// SetIwMemory : Allow user to set IwMemory +func (_options *CreateMilvusServiceScaleOptions) SetIwMemory(iwMemory float64) *CreateMilvusServiceScaleOptions { + _options.IwMemory = core.Float64Ptr(iwMemory) + return _options +} + +// SetIwReplicas : Allow user to set IwReplicas +func (_options *CreateMilvusServiceScaleOptions) SetIwReplicas(iwReplicas int64) *CreateMilvusServiceScaleOptions { + _options.IwReplicas = core.Int64Ptr(iwReplicas) + return _options +} + +// SetKafkaCpu : Allow user to set KafkaCpu +func (_options *CreateMilvusServiceScaleOptions) SetKafkaCpu(kafkaCpu float64) *CreateMilvusServiceScaleOptions { + _options.KafkaCpu = core.Float64Ptr(kafkaCpu) + return _options +} + +// SetKafkaMemory : Allow user to set KafkaMemory +func (_options *CreateMilvusServiceScaleOptions) SetKafkaMemory(kafkaMemory float64) *CreateMilvusServiceScaleOptions { + _options.KafkaMemory = core.Float64Ptr(kafkaMemory) + return _options +} + +// SetProxyCpu : Allow user to set ProxyCpu +func (_options *CreateMilvusServiceScaleOptions) SetProxyCpu(proxyCpu float64) *CreateMilvusServiceScaleOptions { + _options.ProxyCpu = core.Float64Ptr(proxyCpu) + return _options +} + +// SetProxyMemory : Allow user to set ProxyMemory +func (_options *CreateMilvusServiceScaleOptions) SetProxyMemory(proxyMemory float64) *CreateMilvusServiceScaleOptions { + _options.ProxyMemory = core.Float64Ptr(proxyMemory) + return _options +} + +// SetProxyReplicas : Allow user to set ProxyReplicas +func (_options *CreateMilvusServiceScaleOptions) SetProxyReplicas(proxyReplicas int64) *CreateMilvusServiceScaleOptions { + _options.ProxyReplicas = core.Int64Ptr(proxyReplicas) + return _options +} + +// SetQcCpu : Allow user to set QcCpu +func (_options *CreateMilvusServiceScaleOptions) SetQcCpu(qcCpu float64) *CreateMilvusServiceScaleOptions { + _options.QcCpu = core.Float64Ptr(qcCpu) + return _options +} + +// SetQcMemory : Allow user to set QcMemory +func (_options *CreateMilvusServiceScaleOptions) SetQcMemory(qcMemory float64) *CreateMilvusServiceScaleOptions { + _options.QcMemory = core.Float64Ptr(qcMemory) + return _options +} + +// SetQcReplicas : Allow user to set QcReplicas +func (_options *CreateMilvusServiceScaleOptions) SetQcReplicas(qcReplicas int64) *CreateMilvusServiceScaleOptions { + _options.QcReplicas = core.Int64Ptr(qcReplicas) + return _options +} + +// SetQwCpu : Allow user to set QwCpu +func (_options *CreateMilvusServiceScaleOptions) SetQwCpu(qwCpu float64) *CreateMilvusServiceScaleOptions { + _options.QwCpu = core.Float64Ptr(qwCpu) + return _options +} + +// SetQwMemory : Allow user to set QwMemory +func (_options *CreateMilvusServiceScaleOptions) SetQwMemory(qwMemory float64) *CreateMilvusServiceScaleOptions { + _options.QwMemory = core.Float64Ptr(qwMemory) + return _options +} + +// SetQwReplicas : Allow user to set QwReplicas +func (_options *CreateMilvusServiceScaleOptions) SetQwReplicas(qwReplicas int64) *CreateMilvusServiceScaleOptions { + _options.QwReplicas = core.Int64Ptr(qwReplicas) + return _options +} + +// SetRcCpu : Allow user to set RcCpu +func (_options *CreateMilvusServiceScaleOptions) SetRcCpu(rcCpu float64) *CreateMilvusServiceScaleOptions { + _options.RcCpu = core.Float64Ptr(rcCpu) + return _options +} + +// SetRcMemory : Allow user to set RcMemory +func (_options *CreateMilvusServiceScaleOptions) SetRcMemory(rcMemory float64) *CreateMilvusServiceScaleOptions { + _options.RcMemory = core.Float64Ptr(rcMemory) + return _options +} + +// SetRcReplicas : Allow user to set RcReplicas +func (_options *CreateMilvusServiceScaleOptions) SetRcReplicas(rcReplicas int64) *CreateMilvusServiceScaleOptions { + _options.RcReplicas = core.Int64Ptr(rcReplicas) + return _options +} + +// SetVector : Allow user to set Vector +func (_options *CreateMilvusServiceScaleOptions) SetVector(vector int64) *CreateMilvusServiceScaleOptions { + _options.Vector = core.Int64Ptr(vector) + return _options +} + +// SetVectorDimension : Allow user to set VectorDimension +func (_options *CreateMilvusServiceScaleOptions) SetVectorDimension(vectorDimension int64) *CreateMilvusServiceScaleOptions { + _options.VectorDimension = core.Int64Ptr(vectorDimension) + return _options +} + // SetAuthInstanceID : Allow user to set AuthInstanceID func (_options *CreateMilvusServiceScaleOptions) SetAuthInstanceID(authInstanceID string) *CreateMilvusServiceScaleOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) @@ -14020,22 +15229,22 @@ func (options *CreateMilvusServiceScaleOptions) SetHeaders(param map[string]stri // CreateNetezzaEngineOptions : The CreateNetezzaEngine options. type CreateNetezzaEngineOptions struct { + // External engine details. + Configuration *NetezzaEngineConfigurationBody `json:"configuration" validate:"required"` + + // Engine display name. + DisplayName *string `json:"display_name" validate:"required"` + // Origin - created or registered. Origin *string `json:"origin" validate:"required"` // Engine description. Description *string `json:"description,omitempty"` - // External engine details. - EngineDetails *NetezzaEngineDetailsBody `json:"engine_details,omitempty"` - - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` - // Tags. Tags []string `json:"tags,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -14045,39 +15254,39 @@ type CreateNetezzaEngineOptions struct { // Constants associated with the CreateNetezzaEngineOptions.Origin property. // Origin - created or registered. const ( - CreateNetezzaEngineOptions_Origin_Discover = "discover" CreateNetezzaEngineOptions_Origin_External = "external" - CreateNetezzaEngineOptions_Origin_Native = "native" ) // NewCreateNetezzaEngineOptions : Instantiate CreateNetezzaEngineOptions -func (*WatsonxDataV2) NewCreateNetezzaEngineOptions(origin string) *CreateNetezzaEngineOptions { +func (*WatsonxDataV3) NewCreateNetezzaEngineOptions(configuration *NetezzaEngineConfigurationBody, displayName string, origin string) *CreateNetezzaEngineOptions { return &CreateNetezzaEngineOptions{ + Configuration: configuration, + DisplayName: core.StringPtr(displayName), Origin: core.StringPtr(origin), } } -// SetOrigin : Allow user to set Origin -func (_options *CreateNetezzaEngineOptions) SetOrigin(origin string) *CreateNetezzaEngineOptions { - _options.Origin = core.StringPtr(origin) +// SetConfiguration : Allow user to set Configuration +func (_options *CreateNetezzaEngineOptions) SetConfiguration(configuration *NetezzaEngineConfigurationBody) *CreateNetezzaEngineOptions { + _options.Configuration = configuration return _options } -// SetDescription : Allow user to set Description -func (_options *CreateNetezzaEngineOptions) SetDescription(description string) *CreateNetezzaEngineOptions { - _options.Description = core.StringPtr(description) +// SetDisplayName : Allow user to set DisplayName +func (_options *CreateNetezzaEngineOptions) SetDisplayName(displayName string) *CreateNetezzaEngineOptions { + _options.DisplayName = core.StringPtr(displayName) return _options } -// SetEngineDetails : Allow user to set EngineDetails -func (_options *CreateNetezzaEngineOptions) SetEngineDetails(engineDetails *NetezzaEngineDetailsBody) *CreateNetezzaEngineOptions { - _options.EngineDetails = engineDetails +// SetOrigin : Allow user to set Origin +func (_options *CreateNetezzaEngineOptions) SetOrigin(origin string) *CreateNetezzaEngineOptions { + _options.Origin = core.StringPtr(origin) return _options } -// SetEngineDisplayName : Allow user to set EngineDisplayName -func (_options *CreateNetezzaEngineOptions) SetEngineDisplayName(engineDisplayName string) *CreateNetezzaEngineOptions { - _options.EngineDisplayName = core.StringPtr(engineDisplayName) +// SetDescription : Allow user to set Description +func (_options *CreateNetezzaEngineOptions) SetDescription(description string) *CreateNetezzaEngineOptions { + _options.Description = core.StringPtr(description) return _options } @@ -14102,21 +15311,21 @@ func (options *CreateNetezzaEngineOptions) SetHeaders(param map[string]string) * // CreateOtherEngineOptions : The CreateOtherEngine options. type CreateOtherEngineOptions struct { // External engine details. - EngineDetails *OtherEngineDetailsBody `json:"engine_details" validate:"required"` + Configuration *OtherEngineConfigurationBody `json:"configuration" validate:"required"` // engine display name. - EngineDisplayName *string `json:"engine_display_name" validate:"required"` + DisplayName *string `json:"display_name" validate:"required"` + + // Origin - created or registered. + Origin *string `json:"origin" validate:"required"` // engine description. Description *string `json:"description,omitempty"` - // Origin - created or registered. - Origin *string `json:"origin,omitempty"` - // other engine tags. Tags []string `json:"tags,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -14126,34 +15335,27 @@ type CreateOtherEngineOptions struct { // Constants associated with the CreateOtherEngineOptions.Origin property. // Origin - created or registered. const ( - CreateOtherEngineOptions_Origin_Discover = "discover" CreateOtherEngineOptions_Origin_External = "external" - CreateOtherEngineOptions_Origin_Native = "native" ) // NewCreateOtherEngineOptions : Instantiate CreateOtherEngineOptions -func (*WatsonxDataV2) NewCreateOtherEngineOptions(engineDetails *OtherEngineDetailsBody, engineDisplayName string) *CreateOtherEngineOptions { +func (*WatsonxDataV3) NewCreateOtherEngineOptions(configuration *OtherEngineConfigurationBody, displayName string, origin string) *CreateOtherEngineOptions { return &CreateOtherEngineOptions{ - EngineDetails: engineDetails, - EngineDisplayName: core.StringPtr(engineDisplayName), + Configuration: configuration, + DisplayName: core.StringPtr(displayName), + Origin: core.StringPtr(origin), } } -// SetEngineDetails : Allow user to set EngineDetails -func (_options *CreateOtherEngineOptions) SetEngineDetails(engineDetails *OtherEngineDetailsBody) *CreateOtherEngineOptions { - _options.EngineDetails = engineDetails - return _options -} - -// SetEngineDisplayName : Allow user to set EngineDisplayName -func (_options *CreateOtherEngineOptions) SetEngineDisplayName(engineDisplayName string) *CreateOtherEngineOptions { - _options.EngineDisplayName = core.StringPtr(engineDisplayName) +// SetConfiguration : Allow user to set Configuration +func (_options *CreateOtherEngineOptions) SetConfiguration(configuration *OtherEngineConfigurationBody) *CreateOtherEngineOptions { + _options.Configuration = configuration return _options } -// SetDescription : Allow user to set Description -func (_options *CreateOtherEngineOptions) SetDescription(description string) *CreateOtherEngineOptions { - _options.Description = core.StringPtr(description) +// SetDisplayName : Allow user to set DisplayName +func (_options *CreateOtherEngineOptions) SetDisplayName(displayName string) *CreateOtherEngineOptions { + _options.DisplayName = core.StringPtr(displayName) return _options } @@ -14163,6 +15365,12 @@ func (_options *CreateOtherEngineOptions) SetOrigin(origin string) *CreateOtherE return _options } +// SetDescription : Allow user to set Description +func (_options *CreateOtherEngineOptions) SetDescription(description string) *CreateOtherEngineOptions { + _options.Description = core.StringPtr(description) + return _options +} + // SetTags : Allow user to set Tags func (_options *CreateOtherEngineOptions) SetTags(tags []string) *CreateOtherEngineOptions { _options.Tags = tags @@ -14184,12 +15392,12 @@ func (options *CreateOtherEngineOptions) SetHeaders(param map[string]string) *Cr // CreatePrestissimoEngineCatalogsOptions : The CreatePrestissimoEngineCatalogs options. type CreatePrestissimoEngineCatalogsOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` - // catalog names. - CatalogName *string `json:"catalog_name,omitempty"` + // Catalog names. + CatalogNames []string `json:"catalog_names" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -14197,21 +15405,22 @@ type CreatePrestissimoEngineCatalogsOptions struct { } // NewCreatePrestissimoEngineCatalogsOptions : Instantiate CreatePrestissimoEngineCatalogsOptions -func (*WatsonxDataV2) NewCreatePrestissimoEngineCatalogsOptions(engineID string) *CreatePrestissimoEngineCatalogsOptions { +func (*WatsonxDataV3) NewCreatePrestissimoEngineCatalogsOptions(id string, catalogNames []string) *CreatePrestissimoEngineCatalogsOptions { return &CreatePrestissimoEngineCatalogsOptions{ - EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), + CatalogNames: catalogNames, } } -// SetEngineID : Allow user to set EngineID -func (_options *CreatePrestissimoEngineCatalogsOptions) SetEngineID(engineID string) *CreatePrestissimoEngineCatalogsOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *CreatePrestissimoEngineCatalogsOptions) SetID(id string) *CreatePrestissimoEngineCatalogsOptions { + _options.ID = core.StringPtr(id) return _options } -// SetCatalogName : Allow user to set CatalogName -func (_options *CreatePrestissimoEngineCatalogsOptions) SetCatalogName(catalogName string) *CreatePrestissimoEngineCatalogsOptions { - _options.CatalogName = core.StringPtr(catalogName) +// SetCatalogNames : Allow user to set CatalogNames +func (_options *CreatePrestissimoEngineCatalogsOptions) SetCatalogNames(catalogNames []string) *CreatePrestissimoEngineCatalogsOptions { + _options.CatalogNames = catalogNames return _options } @@ -14229,6 +15438,12 @@ func (options *CreatePrestissimoEngineCatalogsOptions) SetHeaders(param map[stri // CreatePrestissimoEngineOptions : The CreatePrestissimoEngine options. type CreatePrestissimoEngineOptions struct { + // External engine details. + Configuration *PrestissimoEngineDetails `json:"configuration" validate:"required"` + + // Engine display name. + DisplayName *string `json:"display_name" validate:"required"` + // Origin - created or registered. Origin *string `json:"origin" validate:"required"` @@ -14238,22 +15453,13 @@ type CreatePrestissimoEngineOptions struct { // Engine description. Description *string `json:"description,omitempty"` - // External engine details. - EngineDetails *PrestissimoEngineDetails `json:"engine_details,omitempty"` - - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` - - // Region (cloud). - Region *string `json:"region,omitempty"` + // Engine id. + ID *string `json:"id,omitempty"` // Tags. Tags []string `json:"tags,omitempty"` - // Version like 0.278 for prestissimo or else. - Version *string `json:"version,omitempty"` - - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -14263,18 +15469,30 @@ type CreatePrestissimoEngineOptions struct { // Constants associated with the CreatePrestissimoEngineOptions.Origin property. // Origin - created or registered. const ( - CreatePrestissimoEngineOptions_Origin_Discover = "discover" - CreatePrestissimoEngineOptions_Origin_External = "external" CreatePrestissimoEngineOptions_Origin_Native = "native" ) // NewCreatePrestissimoEngineOptions : Instantiate CreatePrestissimoEngineOptions -func (*WatsonxDataV2) NewCreatePrestissimoEngineOptions(origin string) *CreatePrestissimoEngineOptions { +func (*WatsonxDataV3) NewCreatePrestissimoEngineOptions(configuration *PrestissimoEngineDetails, displayName string, origin string) *CreatePrestissimoEngineOptions { return &CreatePrestissimoEngineOptions{ + Configuration: configuration, + DisplayName: core.StringPtr(displayName), Origin: core.StringPtr(origin), } } +// SetConfiguration : Allow user to set Configuration +func (_options *CreatePrestissimoEngineOptions) SetConfiguration(configuration *PrestissimoEngineDetails) *CreatePrestissimoEngineOptions { + _options.Configuration = configuration + return _options +} + +// SetDisplayName : Allow user to set DisplayName +func (_options *CreatePrestissimoEngineOptions) SetDisplayName(displayName string) *CreatePrestissimoEngineOptions { + _options.DisplayName = core.StringPtr(displayName) + return _options +} + // SetOrigin : Allow user to set Origin func (_options *CreatePrestissimoEngineOptions) SetOrigin(origin string) *CreatePrestissimoEngineOptions { _options.Origin = core.StringPtr(origin) @@ -14293,21 +15511,9 @@ func (_options *CreatePrestissimoEngineOptions) SetDescription(description strin return _options } -// SetEngineDetails : Allow user to set EngineDetails -func (_options *CreatePrestissimoEngineOptions) SetEngineDetails(engineDetails *PrestissimoEngineDetails) *CreatePrestissimoEngineOptions { - _options.EngineDetails = engineDetails - return _options -} - -// SetEngineDisplayName : Allow user to set EngineDisplayName -func (_options *CreatePrestissimoEngineOptions) SetEngineDisplayName(engineDisplayName string) *CreatePrestissimoEngineOptions { - _options.EngineDisplayName = core.StringPtr(engineDisplayName) - return _options -} - -// SetRegion : Allow user to set Region -func (_options *CreatePrestissimoEngineOptions) SetRegion(region string) *CreatePrestissimoEngineOptions { - _options.Region = core.StringPtr(region) +// SetID : Allow user to set ID +func (_options *CreatePrestissimoEngineOptions) SetID(id string) *CreatePrestissimoEngineOptions { + _options.ID = core.StringPtr(id) return _options } @@ -14317,12 +15523,6 @@ func (_options *CreatePrestissimoEngineOptions) SetTags(tags []string) *CreatePr return _options } -// SetVersion : Allow user to set Version -func (_options *CreatePrestissimoEngineOptions) SetVersion(version string) *CreatePrestissimoEngineOptions { - _options.Version = core.StringPtr(version) - return _options -} - // SetAuthInstanceID : Allow user to set AuthInstanceID func (_options *CreatePrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *CreatePrestissimoEngineOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) @@ -14340,10 +15540,10 @@ type CreatePrestoEngineCatalogsOptions struct { // engine id. EngineID *string `json:"engine_id" validate:"required,ne="` - // catalog names. - CatalogName *string `json:"catalog_name,omitempty"` + // Catalog names. + CatalogNames []string `json:"catalog_names" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -14351,9 +15551,10 @@ type CreatePrestoEngineCatalogsOptions struct { } // NewCreatePrestoEngineCatalogsOptions : Instantiate CreatePrestoEngineCatalogsOptions -func (*WatsonxDataV2) NewCreatePrestoEngineCatalogsOptions(engineID string) *CreatePrestoEngineCatalogsOptions { +func (*WatsonxDataV3) NewCreatePrestoEngineCatalogsOptions(engineID string, catalogNames []string) *CreatePrestoEngineCatalogsOptions { return &CreatePrestoEngineCatalogsOptions{ EngineID: core.StringPtr(engineID), + CatalogNames: catalogNames, } } @@ -14363,9 +15564,9 @@ func (_options *CreatePrestoEngineCatalogsOptions) SetEngineID(engineID string) return _options } -// SetCatalogName : Allow user to set CatalogName -func (_options *CreatePrestoEngineCatalogsOptions) SetCatalogName(catalogName string) *CreatePrestoEngineCatalogsOptions { - _options.CatalogName = core.StringPtr(catalogName) +// SetCatalogNames : Allow user to set CatalogNames +func (_options *CreatePrestoEngineCatalogsOptions) SetCatalogNames(catalogNames []string) *CreatePrestoEngineCatalogsOptions { + _options.CatalogNames = catalogNames return _options } @@ -14383,31 +15584,28 @@ func (options *CreatePrestoEngineCatalogsOptions) SetHeaders(param map[string]st // CreatePrestoEngineOptions : The CreatePrestoEngine options. type CreatePrestoEngineOptions struct { - // Origin - created or registered. + // Engine configuration details. + Configuration *EngineDetails `json:"configuration" validate:"required"` + + // Engine display name. + DisplayName *string `json:"display_name" validate:"required"` + + // Origin of presto engine . Origin *string `json:"origin" validate:"required"` - // Associated catalogs. + // Catalogs associated to the presto engine. AssociatedCatalogs []string `json:"associated_catalogs,omitempty"` // Engine description. Description *string `json:"description,omitempty"` - // Node details. - EngineDetails *EngineDetailsBody `json:"engine_details,omitempty"` - - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` - - // Region (cloud). - Region *string `json:"region,omitempty"` + // Engine id. + ID *string `json:"id,omitempty"` // Tags. Tags []string `json:"tags,omitempty"` - // Version like 0.278 for presto or else. - Version *string `json:"version,omitempty"` - - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -14415,20 +15613,32 @@ type CreatePrestoEngineOptions struct { } // Constants associated with the CreatePrestoEngineOptions.Origin property. -// Origin - created or registered. +// Origin of presto engine . const ( - CreatePrestoEngineOptions_Origin_Discover = "discover" - CreatePrestoEngineOptions_Origin_External = "external" CreatePrestoEngineOptions_Origin_Native = "native" ) // NewCreatePrestoEngineOptions : Instantiate CreatePrestoEngineOptions -func (*WatsonxDataV2) NewCreatePrestoEngineOptions(origin string) *CreatePrestoEngineOptions { +func (*WatsonxDataV3) NewCreatePrestoEngineOptions(configuration *EngineDetails, displayName string, origin string) *CreatePrestoEngineOptions { return &CreatePrestoEngineOptions{ + Configuration: configuration, + DisplayName: core.StringPtr(displayName), Origin: core.StringPtr(origin), } } +// SetConfiguration : Allow user to set Configuration +func (_options *CreatePrestoEngineOptions) SetConfiguration(configuration *EngineDetails) *CreatePrestoEngineOptions { + _options.Configuration = configuration + return _options +} + +// SetDisplayName : Allow user to set DisplayName +func (_options *CreatePrestoEngineOptions) SetDisplayName(displayName string) *CreatePrestoEngineOptions { + _options.DisplayName = core.StringPtr(displayName) + return _options +} + // SetOrigin : Allow user to set Origin func (_options *CreatePrestoEngineOptions) SetOrigin(origin string) *CreatePrestoEngineOptions { _options.Origin = core.StringPtr(origin) @@ -14447,21 +15657,9 @@ func (_options *CreatePrestoEngineOptions) SetDescription(description string) *C return _options } -// SetEngineDetails : Allow user to set EngineDetails -func (_options *CreatePrestoEngineOptions) SetEngineDetails(engineDetails *EngineDetailsBody) *CreatePrestoEngineOptions { - _options.EngineDetails = engineDetails - return _options -} - -// SetEngineDisplayName : Allow user to set EngineDisplayName -func (_options *CreatePrestoEngineOptions) SetEngineDisplayName(engineDisplayName string) *CreatePrestoEngineOptions { - _options.EngineDisplayName = core.StringPtr(engineDisplayName) - return _options -} - -// SetRegion : Allow user to set Region -func (_options *CreatePrestoEngineOptions) SetRegion(region string) *CreatePrestoEngineOptions { - _options.Region = core.StringPtr(region) +// SetID : Allow user to set ID +func (_options *CreatePrestoEngineOptions) SetID(id string) *CreatePrestoEngineOptions { + _options.ID = core.StringPtr(id) return _options } @@ -14471,12 +15669,6 @@ func (_options *CreatePrestoEngineOptions) SetTags(tags []string) *CreatePrestoE return _options } -// SetVersion : Allow user to set Version -func (_options *CreatePrestoEngineOptions) SetVersion(version string) *CreatePrestoEngineOptions { - _options.Version = core.StringPtr(version) - return _options -} - // SetAuthInstanceID : Allow user to set AuthInstanceID func (_options *CreatePrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *CreatePrestoEngineOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) @@ -14489,120 +15681,12 @@ func (options *CreatePrestoEngineOptions) SetHeaders(param map[string]string) *C return options } -// CreatePreviewIngestionFileOptions : The CreatePreviewIngestionFile options. -type CreatePreviewIngestionFileOptions struct { - // CRN. - AuthInstanceID *string `json:"AuthInstanceId" validate:"required"` - - // Comma separated source file or directory path. - SourceDataFiles *string `json:"source_data_files" validate:"required"` - - // CSV properties of source file(s). - CsvProperty *PreviewIngestionFilePrototypeCsvProperty `json:"csv_property,omitempty"` - - // File format of source file(s). - SourceFileType *string `json:"source_file_type,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// Constants associated with the CreatePreviewIngestionFileOptions.SourceFileType property. -// File format of source file(s). -const ( - CreatePreviewIngestionFileOptions_SourceFileType_Csv = "csv" - CreatePreviewIngestionFileOptions_SourceFileType_JSON = "json" - CreatePreviewIngestionFileOptions_SourceFileType_Parquet = "parquet" -) - -// NewCreatePreviewIngestionFileOptions : Instantiate CreatePreviewIngestionFileOptions -func (*WatsonxDataV2) NewCreatePreviewIngestionFileOptions(authInstanceID string, sourceDataFiles string) *CreatePreviewIngestionFileOptions { - return &CreatePreviewIngestionFileOptions{ - AuthInstanceID: core.StringPtr(authInstanceID), - SourceDataFiles: core.StringPtr(sourceDataFiles), - } -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *CreatePreviewIngestionFileOptions) SetAuthInstanceID(authInstanceID string) *CreatePreviewIngestionFileOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetSourceDataFiles : Allow user to set SourceDataFiles -func (_options *CreatePreviewIngestionFileOptions) SetSourceDataFiles(sourceDataFiles string) *CreatePreviewIngestionFileOptions { - _options.SourceDataFiles = core.StringPtr(sourceDataFiles) - return _options -} - -// SetCsvProperty : Allow user to set CsvProperty -func (_options *CreatePreviewIngestionFileOptions) SetCsvProperty(csvProperty *PreviewIngestionFilePrototypeCsvProperty) *CreatePreviewIngestionFileOptions { - _options.CsvProperty = csvProperty - return _options -} - -// SetSourceFileType : Allow user to set SourceFileType -func (_options *CreatePreviewIngestionFileOptions) SetSourceFileType(sourceFileType string) *CreatePreviewIngestionFileOptions { - _options.SourceFileType = core.StringPtr(sourceFileType) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreatePreviewIngestionFileOptions) SetHeaders(param map[string]string) *CreatePreviewIngestionFileOptions { - options.Headers = param - return options -} - -// CreateSalIntegrationEnrichmentGlobalSettingsOptions : The CreateSalIntegrationEnrichmentGlobalSettings options. -type CreateSalIntegrationEnrichmentGlobalSettingsOptions struct { - // semantic expansion. - SemanticExpansion *SalIntegrationEnrichmentSettingsSemanticExpansion `json:"semantic_expansion,omitempty"` - - // semantic expansion. - TermAssignment *SalIntegrationEnrichmentSettingsTermAssignment `json:"term_assignment,omitempty"` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewCreateSalIntegrationEnrichmentGlobalSettingsOptions : Instantiate CreateSalIntegrationEnrichmentGlobalSettingsOptions -func (*WatsonxDataV2) NewCreateSalIntegrationEnrichmentGlobalSettingsOptions() *CreateSalIntegrationEnrichmentGlobalSettingsOptions { - return &CreateSalIntegrationEnrichmentGlobalSettingsOptions{} -} - -// SetSemanticExpansion : Allow user to set SemanticExpansion -func (_options *CreateSalIntegrationEnrichmentGlobalSettingsOptions) SetSemanticExpansion(semanticExpansion *SalIntegrationEnrichmentSettingsSemanticExpansion) *CreateSalIntegrationEnrichmentGlobalSettingsOptions { - _options.SemanticExpansion = semanticExpansion - return _options -} - -// SetTermAssignment : Allow user to set TermAssignment -func (_options *CreateSalIntegrationEnrichmentGlobalSettingsOptions) SetTermAssignment(termAssignment *SalIntegrationEnrichmentSettingsTermAssignment) *CreateSalIntegrationEnrichmentGlobalSettingsOptions { - _options.TermAssignment = termAssignment - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *CreateSalIntegrationEnrichmentGlobalSettingsOptions) SetAuthInstanceID(authInstanceID string) *CreateSalIntegrationEnrichmentGlobalSettingsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSalIntegrationEnrichmentGlobalSettingsOptions) SetHeaders(param map[string]string) *CreateSalIntegrationEnrichmentGlobalSettingsOptions { - options.Headers = param - return options -} - // CreateSalIntegrationEnrichmentOptions : The CreateSalIntegrationEnrichment options. type CreateSalIntegrationEnrichmentOptions struct { - // Encrichment api object. - EnrichmentPrototype *EnrichmentObj `json:"enrichment_prototype,omitempty"` + // changed to be submitted and processed by the enrichment job. + Changes []EnrichmentObj `json:"changes,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -14610,13 +15694,13 @@ type CreateSalIntegrationEnrichmentOptions struct { } // NewCreateSalIntegrationEnrichmentOptions : Instantiate CreateSalIntegrationEnrichmentOptions -func (*WatsonxDataV2) NewCreateSalIntegrationEnrichmentOptions() *CreateSalIntegrationEnrichmentOptions { +func (*WatsonxDataV3) NewCreateSalIntegrationEnrichmentOptions() *CreateSalIntegrationEnrichmentOptions { return &CreateSalIntegrationEnrichmentOptions{} } -// SetEnrichmentPrototype : Allow user to set EnrichmentPrototype -func (_options *CreateSalIntegrationEnrichmentOptions) SetEnrichmentPrototype(enrichmentPrototype *EnrichmentObj) *CreateSalIntegrationEnrichmentOptions { - _options.EnrichmentPrototype = enrichmentPrototype +// SetChanges : Allow user to set Changes +func (_options *CreateSalIntegrationEnrichmentOptions) SetChanges(changes []EnrichmentObj) *CreateSalIntegrationEnrichmentOptions { + _options.Changes = changes return _options } @@ -14632,85 +15716,38 @@ func (options *CreateSalIntegrationEnrichmentOptions) SetHeaders(param map[strin return options } -// CreateSalIntegrationEnrichmentSettingsOptions : The CreateSalIntegrationEnrichmentSettings options. -type CreateSalIntegrationEnrichmentSettingsOptions struct { - // semantic expansion. - SemanticExpansion *SalIntegrationEnrichmentSettingsSemanticExpansion `json:"semantic_expansion,omitempty"` - - // semantic expansion. - TermAssignment *SalIntegrationEnrichmentSettingsTermAssignment `json:"term_assignment,omitempty"` - - // wkc project id. - ProjectID *string `json:"project_id,omitempty"` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewCreateSalIntegrationEnrichmentSettingsOptions : Instantiate CreateSalIntegrationEnrichmentSettingsOptions -func (*WatsonxDataV2) NewCreateSalIntegrationEnrichmentSettingsOptions() *CreateSalIntegrationEnrichmentSettingsOptions { - return &CreateSalIntegrationEnrichmentSettingsOptions{} -} - -// SetSemanticExpansion : Allow user to set SemanticExpansion -func (_options *CreateSalIntegrationEnrichmentSettingsOptions) SetSemanticExpansion(semanticExpansion *SalIntegrationEnrichmentSettingsSemanticExpansion) *CreateSalIntegrationEnrichmentSettingsOptions { - _options.SemanticExpansion = semanticExpansion - return _options -} - -// SetTermAssignment : Allow user to set TermAssignment -func (_options *CreateSalIntegrationEnrichmentSettingsOptions) SetTermAssignment(termAssignment *SalIntegrationEnrichmentSettingsTermAssignment) *CreateSalIntegrationEnrichmentSettingsOptions { - _options.TermAssignment = termAssignment - return _options -} - -// SetProjectID : Allow user to set ProjectID -func (_options *CreateSalIntegrationEnrichmentSettingsOptions) SetProjectID(projectID string) *CreateSalIntegrationEnrichmentSettingsOptions { - _options.ProjectID = core.StringPtr(projectID) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *CreateSalIntegrationEnrichmentSettingsOptions) SetAuthInstanceID(authInstanceID string) *CreateSalIntegrationEnrichmentSettingsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *CreateSalIntegrationEnrichmentSettingsOptions) SetHeaders(param map[string]string) *CreateSalIntegrationEnrichmentSettingsOptions { - options.Headers = param - return options -} - // CreateSalIntegrationOptions : The CreateSalIntegration options. type CreateSalIntegrationOptions struct { - // IAM apikey. + // IAM apikey with IBM Knowledge Catalog access. Apikey *string `json:"apikey" validate:"required"` - // engine ID. + // ID of the engine(support presto or prestissimo) to be registered for SAL integration. EngineID *string `json:"engine_id" validate:"required"` - // COS storage resource crn. + // COS storage resource crn, required on Watsonx.data SaaS and not applicable for CPD. StorageResourceCrn *string `json:"storage_resource_crn,omitempty"` - // COS storage type. + // COS storage type, required on Watsonx.data SaaS and not applicable for CPD. StorageType *string `json:"storage_type,omitempty"` - // COS storage type. + // whether the integration is based on IKC trial plan, which is available on IBMCloud only. TrialPlan *bool `json:"trial_plan,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } +// Constants associated with the CreateSalIntegrationOptions.StorageType property. +// COS storage type, required on Watsonx.data SaaS and not applicable for CPD. +const ( + CreateSalIntegrationOptions_StorageType_BmcosObjectStorage = "bmcos_object_storage" +) + // NewCreateSalIntegrationOptions : Instantiate CreateSalIntegrationOptions -func (*WatsonxDataV2) NewCreateSalIntegrationOptions(apikey string, engineID string) *CreateSalIntegrationOptions { +func (*WatsonxDataV3) NewCreateSalIntegrationOptions(apikey string, engineID string) *CreateSalIntegrationOptions { return &CreateSalIntegrationOptions{ Apikey: core.StringPtr(apikey), EngineID: core.StringPtr(engineID), @@ -14770,7 +15807,7 @@ type CreateSalIntegrationUploadGlossaryOptions struct { // The content type of glossaryCsv. GlossaryCsvContentType *string `json:"glossary_csv_content_type,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -14786,7 +15823,7 @@ const ( ) // NewCreateSalIntegrationUploadGlossaryOptions : Instantiate CreateSalIntegrationUploadGlossaryOptions -func (*WatsonxDataV2) NewCreateSalIntegrationUploadGlossaryOptions(replaceOption string) *CreateSalIntegrationUploadGlossaryOptions { +func (*WatsonxDataV3) NewCreateSalIntegrationUploadGlossaryOptions(replaceOption string) *CreateSalIntegrationUploadGlossaryOptions { return &CreateSalIntegrationUploadGlossaryOptions{ ReplaceOption: core.StringPtr(replaceOption), } @@ -14822,48 +15859,30 @@ func (options *CreateSalIntegrationUploadGlossaryOptions) SetHeaders(param map[s return options } -// CreateSchemaCreatedBody : success response. -type CreateSchemaCreatedBody struct { - // Response of success. - Response *SuccessResponse `json:"response,omitempty"` -} - -// UnmarshalCreateSchemaCreatedBody unmarshals an instance of CreateSchemaCreatedBody from the specified map of raw messages. -func UnmarshalCreateSchemaCreatedBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(CreateSchemaCreatedBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // CreateSchemaOptions : The CreateSchema options. type CreateSchemaOptions struct { - // Engine name. + // Engine id. EngineID *string `json:"engine_id" validate:"required"` - // Catalog name. - CatalogID *string `json:"catalog_id" validate:"required,ne="` + // Catalog id. + ID *string `json:"id" validate:"required,ne="` - // Path associated with bucket. + // Path within bucket where schema will be created. CustomPath *string `json:"custom_path" validate:"required"` - // Schema name. - SchemaName *string `json:"schema_name" validate:"required"` - - // Bucket associated to metastore where schema will be added. - BucketName *string `json:"bucket_name,omitempty"` + // Unique schema name, schemas with same names are not allowed in a catalog. + Name *string `json:"name" validate:"required"` - // Host name. + // Host name of the HDFS bucket. Need to be provided if using HDFS. Hostname *string `json:"hostname,omitempty"` - // Port. + // Port of the HDFS bucket. Need to be provided if using HDFS. Port *int64 `json:"port,omitempty"` - // CRN. + // Bucket associated to catalog where schema will be added. + StorageName *string `json:"storage_name,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -14871,12 +15890,12 @@ type CreateSchemaOptions struct { } // NewCreateSchemaOptions : Instantiate CreateSchemaOptions -func (*WatsonxDataV2) NewCreateSchemaOptions(engineID string, catalogID string, customPath string, schemaName string) *CreateSchemaOptions { +func (*WatsonxDataV3) NewCreateSchemaOptions(engineID string, id string, customPath string, name string) *CreateSchemaOptions { return &CreateSchemaOptions{ EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), + ID: core.StringPtr(id), CustomPath: core.StringPtr(customPath), - SchemaName: core.StringPtr(schemaName), + Name: core.StringPtr(name), } } @@ -14886,9 +15905,9 @@ func (_options *CreateSchemaOptions) SetEngineID(engineID string) *CreateSchemaO return _options } -// SetCatalogID : Allow user to set CatalogID -func (_options *CreateSchemaOptions) SetCatalogID(catalogID string) *CreateSchemaOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetID : Allow user to set ID +func (_options *CreateSchemaOptions) SetID(id string) *CreateSchemaOptions { + _options.ID = core.StringPtr(id) return _options } @@ -14898,15 +15917,9 @@ func (_options *CreateSchemaOptions) SetCustomPath(customPath string) *CreateSch return _options } -// SetSchemaName : Allow user to set SchemaName -func (_options *CreateSchemaOptions) SetSchemaName(schemaName string) *CreateSchemaOptions { - _options.SchemaName = core.StringPtr(schemaName) - return _options -} - -// SetBucketName : Allow user to set BucketName -func (_options *CreateSchemaOptions) SetBucketName(bucketName string) *CreateSchemaOptions { - _options.BucketName = core.StringPtr(bucketName) +// SetName : Allow user to set Name +func (_options *CreateSchemaOptions) SetName(name string) *CreateSchemaOptions { + _options.Name = core.StringPtr(name) return _options } @@ -14922,6 +15935,12 @@ func (_options *CreateSchemaOptions) SetPort(port int64) *CreateSchemaOptions { return _options } +// SetStorageName : Allow user to set StorageName +func (_options *CreateSchemaOptions) SetStorageName(storageName string) *CreateSchemaOptions { + _options.StorageName = core.StringPtr(storageName) + return _options +} + // SetAuthInstanceID : Allow user to set AuthInstanceID func (_options *CreateSchemaOptions) SetAuthInstanceID(authInstanceID string) *CreateSchemaOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) @@ -14934,54 +15953,149 @@ func (options *CreateSchemaOptions) SetHeaders(param map[string]string) *CreateS return options } +// CreateSemanticSearchQueriesOptions : The CreateSemanticSearchQueries options. +type CreateSemanticSearchQueriesOptions struct { + // engine id. + EngineID *string `json:"engine_id" validate:"required"` + + // search string. + QueryInput *string `json:"query_input" validate:"required"` + + // request payload for semantic search configurations. + SearchConfig *SemanticSearchBodySearchConfig `json:"search_config,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewCreateSemanticSearchQueriesOptions : Instantiate CreateSemanticSearchQueriesOptions +func (*WatsonxDataV3) NewCreateSemanticSearchQueriesOptions(engineID string, queryInput string) *CreateSemanticSearchQueriesOptions { + return &CreateSemanticSearchQueriesOptions{ + EngineID: core.StringPtr(engineID), + QueryInput: core.StringPtr(queryInput), + } +} + +// SetEngineID : Allow user to set EngineID +func (_options *CreateSemanticSearchQueriesOptions) SetEngineID(engineID string) *CreateSemanticSearchQueriesOptions { + _options.EngineID = core.StringPtr(engineID) + return _options +} + +// SetQueryInput : Allow user to set QueryInput +func (_options *CreateSemanticSearchQueriesOptions) SetQueryInput(queryInput string) *CreateSemanticSearchQueriesOptions { + _options.QueryInput = core.StringPtr(queryInput) + return _options +} + +// SetSearchConfig : Allow user to set SearchConfig +func (_options *CreateSemanticSearchQueriesOptions) SetSearchConfig(searchConfig *SemanticSearchBodySearchConfig) *CreateSemanticSearchQueriesOptions { + _options.SearchConfig = searchConfig + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *CreateSemanticSearchQueriesOptions) SetAuthInstanceID(authInstanceID string) *CreateSemanticSearchQueriesOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSemanticSearchQueriesOptions) SetHeaders(param map[string]string) *CreateSemanticSearchQueriesOptions { + options.Headers = param + return options +} + // CreateSparkEngineApplicationOptions : The CreateSparkEngineApplication options. type CreateSparkEngineApplicationOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` // Application details. ApplicationDetails *SparkApplicationDetails `json:"application_details" validate:"required"` + // Spark Engine Application Callback. + Callback *SparkEngineApplicationCallback `json:"callback,omitempty"` + + // GUID. + ContextID *string `json:"context_id,omitempty"` + + // type of context for the spark application. + ContextType *string `json:"context_type,omitempty"` + + // mode. + DeployMode *string `json:"deploy_mode,omitempty"` + + // Unique key to ensure idempotent operation. + IdempotencyKey *string `json:"idempotency_key,omitempty"` + + // Initialization scripts to run before the application starts. + InitScripts []string `json:"init_scripts,omitempty"` + // Job endpoint. JobEndpoint *string `json:"job_endpoint,omitempty"` + // Maximum number of retries for the application. Supported only in watsonx.data software. + MaxRetries *string `json:"max_retries,omitempty"` + + // Minimum retry interval in seconds between retry attempts. Supported only in watsonx.data software. + MinRetryIntervalInSeconds *string `json:"min_retry_interval_in_seconds,omitempty"` + // Service Instance ID for POST. ServiceInstanceID *string `json:"service_instance_id,omitempty"` + // Timeout for the application in seconds. + TimeoutInSeconds *string `json:"timeout_in_seconds,omitempty"` + // Engine Type. Type *string `json:"type,omitempty"` - // Spark application volumes to mount. + // Spark application volumes to mount. This property is applicable only in watsonx.data software. Volumes []SparkVolumeDetails `json:"volumes,omitempty"` - // CRN. + // watsonx.data instance ID. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // state. - State []string `json:"state,omitempty"` - // Allows users to set headers on API requests. Headers map[string]string } +// Constants associated with the CreateSparkEngineApplicationOptions.ContextType property. +// type of context for the spark application. +const ( + CreateSparkEngineApplicationOptions_ContextType_GitProject = "git_project" + CreateSparkEngineApplicationOptions_ContextType_Project = "project" + CreateSparkEngineApplicationOptions_ContextType_Space = "space" +) + +// Constants associated with the CreateSparkEngineApplicationOptions.ServiceInstanceID property. +// Service Instance ID for POST. +const ( + CreateSparkEngineApplicationOptions_ServiceInstanceID_Emr = "emr" + CreateSparkEngineApplicationOptions_ServiceInstanceID_Iae = "iae" +) + // Constants associated with the CreateSparkEngineApplicationOptions.Type property. // Engine Type. const ( - CreateSparkEngineApplicationOptions_Type_Emr = "emr" - CreateSparkEngineApplicationOptions_Type_Iae = "iae" + CreateSparkEngineApplicationOptions_Type_Gluten = "gluten" + CreateSparkEngineApplicationOptions_Type_Spark = "spark" ) // NewCreateSparkEngineApplicationOptions : Instantiate CreateSparkEngineApplicationOptions -func (*WatsonxDataV2) NewCreateSparkEngineApplicationOptions(engineID string, applicationDetails *SparkApplicationDetails) *CreateSparkEngineApplicationOptions { +func (*WatsonxDataV3) NewCreateSparkEngineApplicationOptions(id string, applicationDetails *SparkApplicationDetails) *CreateSparkEngineApplicationOptions { return &CreateSparkEngineApplicationOptions{ - EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), ApplicationDetails: applicationDetails, } } -// SetEngineID : Allow user to set EngineID -func (_options *CreateSparkEngineApplicationOptions) SetEngineID(engineID string) *CreateSparkEngineApplicationOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *CreateSparkEngineApplicationOptions) SetID(id string) *CreateSparkEngineApplicationOptions { + _options.ID = core.StringPtr(id) return _options } @@ -14991,18 +16105,72 @@ func (_options *CreateSparkEngineApplicationOptions) SetApplicationDetails(appli return _options } +// SetCallback : Allow user to set Callback +func (_options *CreateSparkEngineApplicationOptions) SetCallback(callback *SparkEngineApplicationCallback) *CreateSparkEngineApplicationOptions { + _options.Callback = callback + return _options +} + +// SetContextID : Allow user to set ContextID +func (_options *CreateSparkEngineApplicationOptions) SetContextID(contextID string) *CreateSparkEngineApplicationOptions { + _options.ContextID = core.StringPtr(contextID) + return _options +} + +// SetContextType : Allow user to set ContextType +func (_options *CreateSparkEngineApplicationOptions) SetContextType(contextType string) *CreateSparkEngineApplicationOptions { + _options.ContextType = core.StringPtr(contextType) + return _options +} + +// SetDeployMode : Allow user to set DeployMode +func (_options *CreateSparkEngineApplicationOptions) SetDeployMode(deployMode string) *CreateSparkEngineApplicationOptions { + _options.DeployMode = core.StringPtr(deployMode) + return _options +} + +// SetIdempotencyKey : Allow user to set IdempotencyKey +func (_options *CreateSparkEngineApplicationOptions) SetIdempotencyKey(idempotencyKey string) *CreateSparkEngineApplicationOptions { + _options.IdempotencyKey = core.StringPtr(idempotencyKey) + return _options +} + +// SetInitScripts : Allow user to set InitScripts +func (_options *CreateSparkEngineApplicationOptions) SetInitScripts(initScripts []string) *CreateSparkEngineApplicationOptions { + _options.InitScripts = initScripts + return _options +} + // SetJobEndpoint : Allow user to set JobEndpoint func (_options *CreateSparkEngineApplicationOptions) SetJobEndpoint(jobEndpoint string) *CreateSparkEngineApplicationOptions { _options.JobEndpoint = core.StringPtr(jobEndpoint) return _options } +// SetMaxRetries : Allow user to set MaxRetries +func (_options *CreateSparkEngineApplicationOptions) SetMaxRetries(maxRetries string) *CreateSparkEngineApplicationOptions { + _options.MaxRetries = core.StringPtr(maxRetries) + return _options +} + +// SetMinRetryIntervalInSeconds : Allow user to set MinRetryIntervalInSeconds +func (_options *CreateSparkEngineApplicationOptions) SetMinRetryIntervalInSeconds(minRetryIntervalInSeconds string) *CreateSparkEngineApplicationOptions { + _options.MinRetryIntervalInSeconds = core.StringPtr(minRetryIntervalInSeconds) + return _options +} + // SetServiceInstanceID : Allow user to set ServiceInstanceID func (_options *CreateSparkEngineApplicationOptions) SetServiceInstanceID(serviceInstanceID string) *CreateSparkEngineApplicationOptions { _options.ServiceInstanceID = core.StringPtr(serviceInstanceID) return _options } +// SetTimeoutInSeconds : Allow user to set TimeoutInSeconds +func (_options *CreateSparkEngineApplicationOptions) SetTimeoutInSeconds(timeoutInSeconds string) *CreateSparkEngineApplicationOptions { + _options.TimeoutInSeconds = core.StringPtr(timeoutInSeconds) + return _options +} + // SetType : Allow user to set Type func (_options *CreateSparkEngineApplicationOptions) SetType(typeVar string) *CreateSparkEngineApplicationOptions { _options.Type = core.StringPtr(typeVar) @@ -15021,12 +16189,6 @@ func (_options *CreateSparkEngineApplicationOptions) SetAuthInstanceID(authInsta return _options } -// SetState : Allow user to set State -func (_options *CreateSparkEngineApplicationOptions) SetState(state []string) *CreateSparkEngineApplicationOptions { - _options.State = state - return _options -} - // SetHeaders : Allow user to set Headers func (options *CreateSparkEngineApplicationOptions) SetHeaders(param map[string]string) *CreateSparkEngineApplicationOptions { options.Headers = param @@ -15036,12 +16198,12 @@ func (options *CreateSparkEngineApplicationOptions) SetHeaders(param map[string] // CreateSparkEngineCatalogsOptions : The CreateSparkEngineCatalogs options. type CreateSparkEngineCatalogsOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` - // catalog names. - CatalogName *string `json:"catalog_name,omitempty"` + // Catalog names. + CatalogNames []string `json:"catalog_names" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -15049,21 +16211,22 @@ type CreateSparkEngineCatalogsOptions struct { } // NewCreateSparkEngineCatalogsOptions : Instantiate CreateSparkEngineCatalogsOptions -func (*WatsonxDataV2) NewCreateSparkEngineCatalogsOptions(engineID string) *CreateSparkEngineCatalogsOptions { +func (*WatsonxDataV3) NewCreateSparkEngineCatalogsOptions(id string, catalogNames []string) *CreateSparkEngineCatalogsOptions { return &CreateSparkEngineCatalogsOptions{ - EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), + CatalogNames: catalogNames, } } -// SetEngineID : Allow user to set EngineID -func (_options *CreateSparkEngineCatalogsOptions) SetEngineID(engineID string) *CreateSparkEngineCatalogsOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *CreateSparkEngineCatalogsOptions) SetID(id string) *CreateSparkEngineCatalogsOptions { + _options.ID = core.StringPtr(id) return _options } -// SetCatalogName : Allow user to set CatalogName -func (_options *CreateSparkEngineCatalogsOptions) SetCatalogName(catalogName string) *CreateSparkEngineCatalogsOptions { - _options.CatalogName = core.StringPtr(catalogName) +// SetCatalogNames : Allow user to set CatalogNames +func (_options *CreateSparkEngineCatalogsOptions) SetCatalogNames(catalogNames []string) *CreateSparkEngineCatalogsOptions { + _options.CatalogNames = catalogNames return _options } @@ -15081,31 +16244,34 @@ func (options *CreateSparkEngineCatalogsOptions) SetHeaders(param map[string]str // CreateSparkEngineOptions : The CreateSparkEngine options. type CreateSparkEngineOptions struct { + // Engine display name. + DisplayName *string `json:"display_name" validate:"required"` + // Origin - created or registered. Origin *string `json:"origin" validate:"required"` - // Associated catalogs. + // Catalogs to be Associated to the engine. AssociatedCatalogs []string `json:"associated_catalogs,omitempty"` - // Engine description. - Description *string `json:"description,omitempty"` + // Spark engine configuration details. + Configuration *SparkEngineDetails `json:"configuration,omitempty"` - // Node details. - EngineDetails *SparkEngineDetailsPrototype `json:"engine_details,omitempty"` + // Information on the Spark engine. + Description *string `json:"description,omitempty"` - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` + // Engine id. + ID *string `json:"id,omitempty"` - // Engine status. + // Status of engine. Status *string `json:"status,omitempty"` // Tags. Tags []string `json:"tags,omitempty"` - // spark type. + // Type of spark engine. Type *string `json:"type,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -15121,19 +16287,26 @@ const ( ) // Constants associated with the CreateSparkEngineOptions.Type property. -// spark type. +// Type of spark engine. const ( CreateSparkEngineOptions_Type_Gluten = "gluten" CreateSparkEngineOptions_Type_Spark = "spark" ) // NewCreateSparkEngineOptions : Instantiate CreateSparkEngineOptions -func (*WatsonxDataV2) NewCreateSparkEngineOptions(origin string) *CreateSparkEngineOptions { +func (*WatsonxDataV3) NewCreateSparkEngineOptions(displayName string, origin string) *CreateSparkEngineOptions { return &CreateSparkEngineOptions{ + DisplayName: core.StringPtr(displayName), Origin: core.StringPtr(origin), } } +// SetDisplayName : Allow user to set DisplayName +func (_options *CreateSparkEngineOptions) SetDisplayName(displayName string) *CreateSparkEngineOptions { + _options.DisplayName = core.StringPtr(displayName) + return _options +} + // SetOrigin : Allow user to set Origin func (_options *CreateSparkEngineOptions) SetOrigin(origin string) *CreateSparkEngineOptions { _options.Origin = core.StringPtr(origin) @@ -15146,21 +16319,21 @@ func (_options *CreateSparkEngineOptions) SetAssociatedCatalogs(associatedCatalo return _options } -// SetDescription : Allow user to set Description -func (_options *CreateSparkEngineOptions) SetDescription(description string) *CreateSparkEngineOptions { - _options.Description = core.StringPtr(description) +// SetConfiguration : Allow user to set Configuration +func (_options *CreateSparkEngineOptions) SetConfiguration(configuration *SparkEngineDetails) *CreateSparkEngineOptions { + _options.Configuration = configuration return _options } -// SetEngineDetails : Allow user to set EngineDetails -func (_options *CreateSparkEngineOptions) SetEngineDetails(engineDetails *SparkEngineDetailsPrototype) *CreateSparkEngineOptions { - _options.EngineDetails = engineDetails +// SetDescription : Allow user to set Description +func (_options *CreateSparkEngineOptions) SetDescription(description string) *CreateSparkEngineOptions { + _options.Description = core.StringPtr(description) return _options } -// SetEngineDisplayName : Allow user to set EngineDisplayName -func (_options *CreateSparkEngineOptions) SetEngineDisplayName(engineDisplayName string) *CreateSparkEngineOptions { - _options.EngineDisplayName = core.StringPtr(engineDisplayName) +// SetID : Allow user to set ID +func (_options *CreateSparkEngineOptions) SetID(id string) *CreateSparkEngineOptions { + _options.ID = core.StringPtr(id) return _options } @@ -15194,13 +16367,147 @@ func (options *CreateSparkEngineOptions) SetHeaders(param map[string]string) *Cr return options } +// CreateStorageRegistrationOptions : The CreateStorageRegistration options. +type CreateStorageRegistrationOptions struct { + // storage description. + Description *string `json:"description" validate:"required"` + + // Storage display name. + DisplayName *string `json:"display_name" validate:"required"` + + // managed by. + ManagedBy *string `json:"managed_by" validate:"required"` + + // storage type. + Type *string `json:"type" validate:"required"` + + // storage catalog. + AssociatedCatalog *StorageCatalogPrototype `json:"associated_catalog,omitempty"` + + // storage details. + Connection *StorageDetails `json:"connection,omitempty"` + + // Region where the storage is located. + Region *string `json:"region,omitempty"` + + // parameter to show whether the bucket is of acl or qhmm use. Allowed values are qhmm or acl. + StorageUse *string `json:"storage_use,omitempty"` + + // tags. + Tags []string `json:"tags,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// Constants associated with the CreateStorageRegistrationOptions.ManagedBy property. +// managed by. +const ( + CreateStorageRegistrationOptions_ManagedBy_Customer = "customer" + CreateStorageRegistrationOptions_ManagedBy_Ibm = "ibm" +) + +// Constants associated with the CreateStorageRegistrationOptions.Type property. +// storage type. +const ( + CreateStorageRegistrationOptions_Type_AdlsGen1 = "adls_gen1" + CreateStorageRegistrationOptions_Type_AdlsGen2 = "adls_gen2" + CreateStorageRegistrationOptions_Type_AwsS3 = "aws_s3" + CreateStorageRegistrationOptions_Type_GoogleCs = "google_cs" + CreateStorageRegistrationOptions_Type_IbmCeph = "ibm_ceph" + CreateStorageRegistrationOptions_Type_IbmCos = "ibm_cos" + CreateStorageRegistrationOptions_Type_IbmStorageScale = "ibm_storage_scale" + CreateStorageRegistrationOptions_Type_Minio = "minio" + CreateStorageRegistrationOptions_Type_Ozone = "ozone" + CreateStorageRegistrationOptions_Type_S3 = "s3" +) + +// NewCreateStorageRegistrationOptions : Instantiate CreateStorageRegistrationOptions +func (*WatsonxDataV3) NewCreateStorageRegistrationOptions(description string, displayName string, managedBy string, typeVar string) *CreateStorageRegistrationOptions { + return &CreateStorageRegistrationOptions{ + Description: core.StringPtr(description), + DisplayName: core.StringPtr(displayName), + ManagedBy: core.StringPtr(managedBy), + Type: core.StringPtr(typeVar), + } +} + +// SetDescription : Allow user to set Description +func (_options *CreateStorageRegistrationOptions) SetDescription(description string) *CreateStorageRegistrationOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetDisplayName : Allow user to set DisplayName +func (_options *CreateStorageRegistrationOptions) SetDisplayName(displayName string) *CreateStorageRegistrationOptions { + _options.DisplayName = core.StringPtr(displayName) + return _options +} + +// SetManagedBy : Allow user to set ManagedBy +func (_options *CreateStorageRegistrationOptions) SetManagedBy(managedBy string) *CreateStorageRegistrationOptions { + _options.ManagedBy = core.StringPtr(managedBy) + return _options +} + +// SetType : Allow user to set Type +func (_options *CreateStorageRegistrationOptions) SetType(typeVar string) *CreateStorageRegistrationOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetAssociatedCatalog : Allow user to set AssociatedCatalog +func (_options *CreateStorageRegistrationOptions) SetAssociatedCatalog(associatedCatalog *StorageCatalogPrototype) *CreateStorageRegistrationOptions { + _options.AssociatedCatalog = associatedCatalog + return _options +} + +// SetConnection : Allow user to set Connection +func (_options *CreateStorageRegistrationOptions) SetConnection(connection *StorageDetails) *CreateStorageRegistrationOptions { + _options.Connection = connection + return _options +} + +// SetRegion : Allow user to set Region +func (_options *CreateStorageRegistrationOptions) SetRegion(region string) *CreateStorageRegistrationOptions { + _options.Region = core.StringPtr(region) + return _options +} + +// SetStorageUse : Allow user to set StorageUse +func (_options *CreateStorageRegistrationOptions) SetStorageUse(storageUse string) *CreateStorageRegistrationOptions { + _options.StorageUse = core.StringPtr(storageUse) + return _options +} + +// SetTags : Allow user to set Tags +func (_options *CreateStorageRegistrationOptions) SetTags(tags []string) *CreateStorageRegistrationOptions { + _options.Tags = tags + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *CreateStorageRegistrationOptions) SetAuthInstanceID(authInstanceID string) *CreateStorageRegistrationOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateStorageRegistrationOptions) SetHeaders(param map[string]string) *CreateStorageRegistrationOptions { + options.Headers = param + return options +} + // DatabaseCatalog : database catalog. type DatabaseCatalog struct { // catalog name. CatalogName *string `json:"catalog_name,omitempty"` // catalog tags. - CatalogTags []string `json:"catalog_tags,omitempty"` + CatalogTags []string `json:"catalog_tags" validate:"required"` // catalog type. CatalogType *string `json:"catalog_type,omitempty"` @@ -15228,11 +16535,43 @@ func UnmarshalDatabaseCatalog(m map[string]json.RawMessage, result interface{}) return } +// DatabaseCatalogPrototype : database catalog. +type DatabaseCatalogPrototype struct { + // catalog name. + CatalogName *string `json:"catalog_name,omitempty"` + + // catalog type. + CatalogType *string `json:"catalog_type,omitempty"` +} + +// UnmarshalDatabaseCatalogPrototype unmarshals an instance of DatabaseCatalogPrototype from the specified map of raw messages. +func UnmarshalDatabaseCatalogPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseCatalogPrototype) + err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "catalog_type", &obj.CatalogType) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // DatabaseDetails : database details. type DatabaseDetails struct { // Authentication method. AuthenticationType *string `json:"authentication_type,omitempty"` + // Authentication method. + AuthenticationValue *string `json:"authentication_value,omitempty"` + + // secret details. + AuthenticationValueKeyVault *SecretDetails `json:"authentication_value_key_vault,omitempty"` + // Broker authentication password. BrokerAuthenticationPassword *string `json:"broker_authentication_password,omitempty"` @@ -15242,6 +16581,12 @@ type DatabaseDetails struct { // Broker authentication user. BrokerAuthenticationUser *string `json:"broker_authentication_user,omitempty"` + // Broker host. + BrokerHost *string `json:"broker_host,omitempty"` + + // Broker port. + BrokerPort *int64 `json:"broker_port,omitempty"` + // contents of a pem/crt file. Certificate *string `json:"certificate,omitempty"` @@ -15266,17 +16611,26 @@ type DatabaseDetails struct { // Controller authentication type. ControllerAuthenticationType *string `json:"controller_authentication_type,omitempty"` + // secret details. + PasswordKeyVault *SecretDetails `json:"password_key_vault,omitempty"` + // Controller authentication user. ControllerAuthenticationUser *string `json:"controller_authentication_user,omitempty"` + // Coordinator host. + CoordinatorHost *string `json:"coordinator_host,omitempty"` + + // Coordinator port. + CoordinatorPort *int64 `json:"coordinator_port,omitempty"` + // CPD Hostname. CpdHostname *string `json:"cpd_hostname,omitempty"` // Base 64 encoded json file. CredentialsKey *string `json:"credentials_key,omitempty"` - // Database name. - DatabaseName *string `json:"database_name,omitempty"` + // Domain name. + DomainName *string `json:"domain_name,omitempty"` // Host name. Hostname *string `json:"hostname,omitempty"` @@ -15290,6 +16644,9 @@ type DatabaseDetails struct { // informix server value. InformixServer *string `json:"informix_server,omitempty"` + // Database name. + Name *string `json:"name,omitempty"` + // Psssword. Password *string `json:"password,omitempty"` @@ -15299,9 +16656,21 @@ type DatabaseDetails struct { // Project ID. ProjectID *string `json:"project_id,omitempty"` + // This will hold all the properties for a custom database. + Properties []DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems `json:"properties" validate:"required"` + // SASL Mode. Sasl *bool `json:"sasl,omitempty"` + // sasl mechanism for kafka. Allowed values are plain, scram_sha_256, scram_sha_512. + SaslMechanism *string `json:"sasl_mechanism,omitempty"` + + // Schema name. + SchemaName *string `json:"schema_name,omitempty"` + + // Add tables. + Schemas *string `json:"schemas,omitempty"` + // service api key. ServiceApiKey *string `json:"service_api_key,omitempty"` @@ -15326,7 +16695,7 @@ type DatabaseDetails struct { // SSL Mode. Ssl *bool `json:"ssl,omitempty"` - // Only for Kafka - Add kafka tables. + // Add tables. Tables *string `json:"tables,omitempty"` // Username. @@ -15337,6 +16706,18 @@ type DatabaseDetails struct { // Verify host name. VerifyHostName *bool `json:"verify_host_name,omitempty"` + + // secret details. + SslcertificateKeyVault *SecretDetails `json:"sslcertificate_key_vault,omitempty"` + + // vault enabled or not. + VaultEnabled *bool `json:"vault_enabled,omitempty"` + + // secret details. + UsernameKeyVault *SecretDetails `json:"username_key_vault,omitempty"` + + // Warehouse name. + WarehouseName *string `json:"warehouse_name,omitempty"` } // UnmarshalDatabaseDetails unmarshals an instance of DatabaseDetails from the specified map of raw messages. @@ -15347,6 +16728,16 @@ func UnmarshalDatabaseDetails(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "authentication_type-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "authentication_value", &obj.AuthenticationValue) + if err != nil { + err = core.SDKErrorf(err, "", "authentication_value-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "authentication_value_key_vault", &obj.AuthenticationValueKeyVault, UnmarshalSecretDetails) + if err != nil { + err = core.SDKErrorf(err, "", "authentication_value_key_vault-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "broker_authentication_password", &obj.BrokerAuthenticationPassword) if err != nil { err = core.SDKErrorf(err, "", "broker_authentication_password-error", common.GetComponentInfo()) @@ -15362,6 +16753,16 @@ func UnmarshalDatabaseDetails(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "broker_authentication_user-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "broker_host", &obj.BrokerHost) + if err != nil { + err = core.SDKErrorf(err, "", "broker_host-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "broker_port", &obj.BrokerPort) + if err != nil { + err = core.SDKErrorf(err, "", "broker_port-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "certificate", &obj.Certificate) if err != nil { err = core.SDKErrorf(err, "", "certificate-error", common.GetComponentInfo()) @@ -15402,11 +16803,26 @@ func UnmarshalDatabaseDetails(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "controller_authentication_type-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "password_key_vault", &obj.PasswordKeyVault, UnmarshalSecretDetails) + if err != nil { + err = core.SDKErrorf(err, "", "password_key_vault-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "controller_authentication_user", &obj.ControllerAuthenticationUser) if err != nil { err = core.SDKErrorf(err, "", "controller_authentication_user-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "coordinator_host", &obj.CoordinatorHost) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator_host-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "coordinator_port", &obj.CoordinatorPort) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator_port-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "cpd_hostname", &obj.CpdHostname) if err != nil { err = core.SDKErrorf(err, "", "cpd_hostname-error", common.GetComponentInfo()) @@ -15417,9 +16833,9 @@ func UnmarshalDatabaseDetails(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "credentials_key-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "database_name", &obj.DatabaseName) + err = core.UnmarshalPrimitive(m, "domain_name", &obj.DomainName) if err != nil { - err = core.SDKErrorf(err, "", "database_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "domain_name-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) @@ -15442,6 +16858,11 @@ func UnmarshalDatabaseDetails(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "informix_server-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "password", &obj.Password) if err != nil { err = core.SDKErrorf(err, "", "password-error", common.GetComponentInfo()) @@ -15457,11 +16878,31 @@ func UnmarshalDatabaseDetails(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "project_id-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "properties", &obj.Properties, UnmarshalDatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems) + if err != nil { + err = core.SDKErrorf(err, "", "properties-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "sasl", &obj.Sasl) if err != nil { err = core.SDKErrorf(err, "", "sasl-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "sasl_mechanism", &obj.SaslMechanism) + if err != nil { + err = core.SDKErrorf(err, "", "sasl_mechanism-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "schema_name", &obj.SchemaName) + if err != nil { + err = core.SDKErrorf(err, "", "schema_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "schemas", &obj.Schemas) + if err != nil { + err = core.SDKErrorf(err, "", "schemas-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "service_api_key", &obj.ServiceApiKey) if err != nil { err = core.SDKErrorf(err, "", "service_api_key-error", common.GetComponentInfo()) @@ -15522,548 +16963,584 @@ func UnmarshalDatabaseDetails(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "verify_host_name-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "sslcertificate_key_vault", &obj.SslcertificateKeyVault, UnmarshalSecretDetails) + if err != nil { + err = core.SDKErrorf(err, "", "sslcertificate_key_vault-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "vault_enabled", &obj.VaultEnabled) + if err != nil { + err = core.SDKErrorf(err, "", "vault_enabled-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "username_key_vault", &obj.UsernameKeyVault, UnmarshalSecretDetails) + if err != nil { + err = core.SDKErrorf(err, "", "username_key_vault-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "warehouse_name", &obj.WarehouseName) + if err != nil { + err = core.SDKErrorf(err, "", "warehouse_name-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// DatabaseRegistration : database registration object. -type DatabaseRegistration struct { - // actions. - Actions []string `json:"actions,omitempty"` +// DatabaseDetailsPrototype : database details. +type DatabaseDetailsPrototype struct { + // Authentication method. + AuthenticationType *string `json:"authentication_type,omitempty"` - // database catalog. - AssociatedCatalog *DatabaseCatalog `json:"associated_catalog,omitempty"` + // Authentication method. + AuthenticationValue *string `json:"authentication_value,omitempty"` - // Catalog name. - CatalogName *string `json:"catalog_name,omitempty"` + // secret details. + AuthenticationValueKeyVault *SecretDetails `json:"authentication_value_key_vault,omitempty"` - // Created by. - CreatedBy *string `json:"created_by,omitempty"` + // Broker authentication password. + BrokerAuthenticationPassword *string `json:"broker_authentication_password,omitempty"` - // Created on. - CreatedOn *string `json:"created_on,omitempty"` + // Broker authentication type. + BrokerAuthenticationType *string `json:"broker_authentication_type,omitempty"` - // database details. - DatabaseDetails *DatabaseDetails `json:"database_details" validate:"required"` + // Broker authentication user. + BrokerAuthenticationUser *string `json:"broker_authentication_user,omitempty"` - // Database display name. - DatabaseDisplayName *string `json:"database_display_name" validate:"required"` + // Broker host. + BrokerHost *string `json:"broker_host,omitempty"` - // Database ID. - DatabaseID *string `json:"database_id,omitempty"` + // Broker port. + BrokerPort *int64 `json:"broker_port,omitempty"` - // This will hold all the properties for a custom database. - DatabaseProperties []DatabaseRegistrationDatabasePropertiesItems `json:"database_properties,omitempty"` + // contents of a pem/crt file. + Certificate *string `json:"certificate,omitempty"` - // Connector type. - DatabaseType *string `json:"database_type" validate:"required"` + // extension of the certificate file. + CertificateExtension *string `json:"certificate_extension,omitempty"` - // Database description. - Description *string `json:"description,omitempty"` + // connection mode. + ConnectionMethod *string `json:"connection_method,omitempty"` - // tags. - Tags []string `json:"tags,omitempty"` + // connection mode. + ConnectionMode *string `json:"connection_mode,omitempty"` - // List of topics. - Topics []DatabaseRegistrationTopicsItems `json:"topics,omitempty"` -} + // connection mode value. + ConnectionModeValue *string `json:"connection_mode_value,omitempty"` -// UnmarshalDatabaseRegistration unmarshals an instance of DatabaseRegistration from the specified map of raw messages. -func UnmarshalDatabaseRegistration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DatabaseRegistration) - err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) - if err != nil { - err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "associated_catalog", &obj.AssociatedCatalog, UnmarshalDatabaseCatalog) + // Connection type. + ConnectionType *string `json:"connection_type,omitempty"` + + // Controller authentication password. + ControllerAuthenticationPassword *string `json:"controller_authentication_password,omitempty"` + + // Controller authentication type. + ControllerAuthenticationType *string `json:"controller_authentication_type,omitempty"` + + // Controller authentication user. + ControllerAuthenticationUser *string `json:"controller_authentication_user,omitempty"` + + // Coordinator host. + CoordinatorHost *string `json:"coordinator_host,omitempty"` + + // Coordinator port. + CoordinatorPort *int64 `json:"coordinator_port,omitempty"` + + // CPD Hostname. + CpdHostname *string `json:"cpd_hostname,omitempty"` + + // Base 64 encoded json file. + CredentialsKey *string `json:"credentials_key,omitempty"` + + // Domain name. + DomainName *string `json:"domain_name,omitempty"` + + // Host name. + Hostname *string `json:"hostname,omitempty"` + + // Hostname in certificate. + HostnameInCertificate *string `json:"hostname_in_certificate,omitempty"` + + // String of hostname:port. + Hosts *string `json:"hosts,omitempty"` + + // informix server value. + InformixServer *string `json:"informix_server,omitempty"` + + // Database name. + Name *string `json:"name,omitempty"` + + // Psssword. + Password *string `json:"password,omitempty"` + + // secret details. + PasswordKeyVault *SecretDetails `json:"password_key_vault,omitempty"` + + // Port. + Port *int64 `json:"port,omitempty"` + + // Project ID. + ProjectID *string `json:"project_id,omitempty"` + + // SASL Mode. + Sasl *bool `json:"sasl,omitempty"` + + // sasl mechanism for kafka. Allowed values are plain, scram_sha_256, scram_sha_512. + SaslMechanism *string `json:"sasl_mechanism,omitempty"` + + // Schema name. + SchemaName *string `json:"schema_name,omitempty"` + + // Add tables. + Schemas *string `json:"schemas,omitempty"` + + // service api key. + ServiceApiKey *string `json:"service_api_key,omitempty"` + + // service hostname. + ServiceHostname *string `json:"service_hostname,omitempty"` + + // service password. + ServicePassword *string `json:"service_password,omitempty"` + + // Service Port. + ServicePort *int64 `json:"service_port,omitempty"` + + // Service SSL Mode. + ServiceSsl *bool `json:"service_ssl,omitempty"` + + // service token url. + ServiceTokenURL *string `json:"service_token_url,omitempty"` + + // service username. + ServiceUsername *string `json:"service_username,omitempty"` + + // SSL Mode. + Ssl *bool `json:"ssl,omitempty"` + + // secret details. + SslcertificateKeyVault *SecretDetails `json:"sslcertificate_key_vault,omitempty"` + + // Add tables. + Tables *string `json:"tables,omitempty"` + + // Username. + Username *string `json:"username,omitempty"` + + // secret details. + UsernameKeyVault *SecretDetails `json:"username_key_vault,omitempty"` + + // Verify certificate. + ValidateServerCertificate *bool `json:"validate_server_certificate,omitempty"` + + // vault enabled or not. + VaultEnabled *bool `json:"vault_enabled,omitempty"` + + // Verify host name. + VerifyHostName *bool `json:"verify_host_name,omitempty"` + + // Warehouse name. + WarehouseName *string `json:"warehouse_name,omitempty"` +} + +// UnmarshalDatabaseDetailsPrototype unmarshals an instance of DatabaseDetailsPrototype from the specified map of raw messages. +func UnmarshalDatabaseDetailsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseDetailsPrototype) + err = core.UnmarshalPrimitive(m, "authentication_type", &obj.AuthenticationType) if err != nil { - err = core.SDKErrorf(err, "", "associated_catalog-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "authentication_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + err = core.UnmarshalPrimitive(m, "authentication_value", &obj.AuthenticationValue) if err != nil { - err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "authentication_value-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + err = core.UnmarshalModel(m, "authentication_value_key_vault", &obj.AuthenticationValueKeyVault, UnmarshalSecretDetails) if err != nil { - err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "authentication_value_key_vault-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + err = core.UnmarshalPrimitive(m, "broker_authentication_password", &obj.BrokerAuthenticationPassword) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "broker_authentication_password-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "database_details", &obj.DatabaseDetails, UnmarshalDatabaseDetails) + err = core.UnmarshalPrimitive(m, "broker_authentication_type", &obj.BrokerAuthenticationType) if err != nil { - err = core.SDKErrorf(err, "", "database_details-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "broker_authentication_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "database_display_name", &obj.DatabaseDisplayName) + err = core.UnmarshalPrimitive(m, "broker_authentication_user", &obj.BrokerAuthenticationUser) if err != nil { - err = core.SDKErrorf(err, "", "database_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "broker_authentication_user-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "database_id", &obj.DatabaseID) + err = core.UnmarshalPrimitive(m, "broker_host", &obj.BrokerHost) if err != nil { - err = core.SDKErrorf(err, "", "database_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "broker_host-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "database_properties", &obj.DatabaseProperties, UnmarshalDatabaseRegistrationDatabasePropertiesItems) + err = core.UnmarshalPrimitive(m, "broker_port", &obj.BrokerPort) if err != nil { - err = core.SDKErrorf(err, "", "database_properties-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "broker_port-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "database_type", &obj.DatabaseType) + err = core.UnmarshalPrimitive(m, "certificate", &obj.Certificate) if err != nil { - err = core.SDKErrorf(err, "", "database_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "certificate-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalPrimitive(m, "certificate_extension", &obj.CertificateExtension) if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "certificate_extension-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalPrimitive(m, "connection_method", &obj.ConnectionMethod) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "connection_method-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "topics", &obj.Topics, UnmarshalDatabaseRegistrationTopicsItems) + err = core.UnmarshalPrimitive(m, "connection_mode", &obj.ConnectionMode) if err != nil { - err = core.SDKErrorf(err, "", "topics-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "connection_mode-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DatabaseRegistrationCollection : list database registrations. -type DatabaseRegistrationCollection struct { - // Database body. - DatabaseRegistrations []DatabaseRegistration `json:"database_registrations,omitempty"` -} - -// UnmarshalDatabaseRegistrationCollection unmarshals an instance of DatabaseRegistrationCollection from the specified map of raw messages. -func UnmarshalDatabaseRegistrationCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DatabaseRegistrationCollection) - err = core.UnmarshalModel(m, "database_registrations", &obj.DatabaseRegistrations, UnmarshalDatabaseRegistration) + err = core.UnmarshalPrimitive(m, "connection_mode_value", &obj.ConnectionModeValue) if err != nil { - err = core.SDKErrorf(err, "", "database_registrations-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "connection_mode_value-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DatabaseRegistrationDatabasePropertiesItems : Key value object. -type DatabaseRegistrationDatabasePropertiesItems struct { - // Wether the value is to be encrypted before storing. - Encrypt *bool `json:"encrypt" validate:"required"` - - // Key of the database property. - Key *string `json:"key" validate:"required"` - - // Value of the database property. - Value *string `json:"value" validate:"required"` -} - -// UnmarshalDatabaseRegistrationDatabasePropertiesItems unmarshals an instance of DatabaseRegistrationDatabasePropertiesItems from the specified map of raw messages. -func UnmarshalDatabaseRegistrationDatabasePropertiesItems(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DatabaseRegistrationDatabasePropertiesItems) - err = core.UnmarshalPrimitive(m, "encrypt", &obj.Encrypt) + err = core.UnmarshalPrimitive(m, "connection_type", &obj.ConnectionType) if err != nil { - err = core.SDKErrorf(err, "", "encrypt-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "connection_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "key", &obj.Key) + err = core.UnmarshalPrimitive(m, "controller_authentication_password", &obj.ControllerAuthenticationPassword) if err != nil { - err = core.SDKErrorf(err, "", "key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "controller_authentication_password-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "controller_authentication_type", &obj.ControllerAuthenticationType) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "controller_authentication_type-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DatabaseRegistrationPatch : update db body. -type DatabaseRegistrationPatch struct { - // New database details. - DatabaseDetails *DatabaseRegistrationPatchDatabaseDetails `json:"database_details,omitempty"` - - // New database display name. - DatabaseDisplayName *string `json:"database_display_name,omitempty"` - - // New database description. - Description *string `json:"description,omitempty"` - - // New tags. - Tags []string `json:"tags,omitempty"` - - // List of topics. - Topics []DatabaseRegistrationPatchTopicsItems `json:"topics,omitempty"` -} - -// UnmarshalDatabaseRegistrationPatch unmarshals an instance of DatabaseRegistrationPatch from the specified map of raw messages. -func UnmarshalDatabaseRegistrationPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DatabaseRegistrationPatch) - err = core.UnmarshalModel(m, "database_details", &obj.DatabaseDetails, UnmarshalDatabaseRegistrationPatchDatabaseDetails) + err = core.UnmarshalPrimitive(m, "controller_authentication_user", &obj.ControllerAuthenticationUser) if err != nil { - err = core.SDKErrorf(err, "", "database_details-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "controller_authentication_user-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "database_display_name", &obj.DatabaseDisplayName) + err = core.UnmarshalPrimitive(m, "coordinator_host", &obj.CoordinatorHost) if err != nil { - err = core.SDKErrorf(err, "", "database_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator_host-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalPrimitive(m, "coordinator_port", &obj.CoordinatorPort) if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator_port-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalPrimitive(m, "cpd_hostname", &obj.CpdHostname) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cpd_hostname-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "topics", &obj.Topics, UnmarshalDatabaseRegistrationPatchTopicsItems) + err = core.UnmarshalPrimitive(m, "credentials_key", &obj.CredentialsKey) if err != nil { - err = core.SDKErrorf(err, "", "topics-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "credentials_key-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the DatabaseRegistrationPatch -func (databaseRegistrationPatch *DatabaseRegistrationPatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(databaseRegistrationPatch.DatabaseDetails) { - _patch["database_details"] = databaseRegistrationPatch.DatabaseDetails.asPatch() - } - if !core.IsNil(databaseRegistrationPatch.DatabaseDisplayName) { - _patch["database_display_name"] = databaseRegistrationPatch.DatabaseDisplayName - } - if !core.IsNil(databaseRegistrationPatch.Description) { - _patch["description"] = databaseRegistrationPatch.Description + err = core.UnmarshalPrimitive(m, "domain_name", &obj.DomainName) + if err != nil { + err = core.SDKErrorf(err, "", "domain_name-error", common.GetComponentInfo()) + return } - if !core.IsNil(databaseRegistrationPatch.Tags) { - _patch["tags"] = databaseRegistrationPatch.Tags + err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + if err != nil { + err = core.SDKErrorf(err, "", "hostname-error", common.GetComponentInfo()) + return } - if !core.IsNil(databaseRegistrationPatch.Topics) { - var topicsPatches []map[string]interface{} - for _, topics := range databaseRegistrationPatch.Topics { - topicsPatches = append(topicsPatches, topics.asPatch()) - } - _patch["topics"] = topicsPatches + err = core.UnmarshalPrimitive(m, "hostname_in_certificate", &obj.HostnameInCertificate) + if err != nil { + err = core.SDKErrorf(err, "", "hostname_in_certificate-error", common.GetComponentInfo()) + return } - - return -} - -// DatabaseRegistrationPatchDatabaseDetails : New database details. -type DatabaseRegistrationPatchDatabaseDetails struct { - // New password. - Password *string `json:"password,omitempty"` - - // New username. - Username *string `json:"username,omitempty"` -} - -// UnmarshalDatabaseRegistrationPatchDatabaseDetails unmarshals an instance of DatabaseRegistrationPatchDatabaseDetails from the specified map of raw messages. -func UnmarshalDatabaseRegistrationPatchDatabaseDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DatabaseRegistrationPatchDatabaseDetails) - err = core.UnmarshalPrimitive(m, "password", &obj.Password) + err = core.UnmarshalPrimitive(m, "hosts", &obj.Hosts) if err != nil { - err = core.SDKErrorf(err, "", "password-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "hosts-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "username", &obj.Username) + err = core.UnmarshalPrimitive(m, "informix_server", &obj.InformixServer) if err != nil { - err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "informix_server-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the DatabaseRegistrationPatchDatabaseDetails -func (databaseRegistrationPatchDatabaseDetails *DatabaseRegistrationPatchDatabaseDetails) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(databaseRegistrationPatchDatabaseDetails.Password) { - _patch["password"] = databaseRegistrationPatchDatabaseDetails.Password + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return } - if !core.IsNil(databaseRegistrationPatchDatabaseDetails.Username) { - _patch["username"] = databaseRegistrationPatchDatabaseDetails.Username + err = core.UnmarshalPrimitive(m, "password", &obj.Password) + if err != nil { + err = core.SDKErrorf(err, "", "password-error", common.GetComponentInfo()) + return } - - return -} - -// DatabaseRegistrationPatchTopicsItems : Topic. -type DatabaseRegistrationPatchTopicsItems struct { - // Created on. - CreatedOn *string `json:"created_on,omitempty"` - - // file contents. - FileContents *string `json:"file_contents,omitempty"` - - // file name. - FileName *string `json:"file_name,omitempty"` - - // topic name. - TopicName *string `json:"topic_name,omitempty"` -} - -// UnmarshalDatabaseRegistrationPatchTopicsItems unmarshals an instance of DatabaseRegistrationPatchTopicsItems from the specified map of raw messages. -func UnmarshalDatabaseRegistrationPatchTopicsItems(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DatabaseRegistrationPatchTopicsItems) - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + err = core.UnmarshalModel(m, "password_key_vault", &obj.PasswordKeyVault, UnmarshalSecretDetails) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "password_key_vault-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "file_contents", &obj.FileContents) + err = core.UnmarshalPrimitive(m, "port", &obj.Port) if err != nil { - err = core.SDKErrorf(err, "", "file_contents-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "file_name", &obj.FileName) + err = core.UnmarshalPrimitive(m, "project_id", &obj.ProjectID) if err != nil { - err = core.SDKErrorf(err, "", "file_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "project_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "topic_name", &obj.TopicName) + err = core.UnmarshalPrimitive(m, "sasl", &obj.Sasl) if err != nil { - err = core.SDKErrorf(err, "", "topic_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "sasl-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// asPatch returns a generic map representation of the DatabaseRegistrationPatchTopicsItems -func (databaseRegistrationPatchTopicsItems *DatabaseRegistrationPatchTopicsItems) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(databaseRegistrationPatchTopicsItems.CreatedOn) { - _patch["created_on"] = databaseRegistrationPatchTopicsItems.CreatedOn + err = core.UnmarshalPrimitive(m, "sasl_mechanism", &obj.SaslMechanism) + if err != nil { + err = core.SDKErrorf(err, "", "sasl_mechanism-error", common.GetComponentInfo()) + return } - if !core.IsNil(databaseRegistrationPatchTopicsItems.FileContents) { - _patch["file_contents"] = databaseRegistrationPatchTopicsItems.FileContents + err = core.UnmarshalPrimitive(m, "schema_name", &obj.SchemaName) + if err != nil { + err = core.SDKErrorf(err, "", "schema_name-error", common.GetComponentInfo()) + return } - if !core.IsNil(databaseRegistrationPatchTopicsItems.FileName) { - _patch["file_name"] = databaseRegistrationPatchTopicsItems.FileName + err = core.UnmarshalPrimitive(m, "schemas", &obj.Schemas) + if err != nil { + err = core.SDKErrorf(err, "", "schemas-error", common.GetComponentInfo()) + return } - if !core.IsNil(databaseRegistrationPatchTopicsItems.TopicName) { - _patch["topic_name"] = databaseRegistrationPatchTopicsItems.TopicName + err = core.UnmarshalPrimitive(m, "service_api_key", &obj.ServiceApiKey) + if err != nil { + err = core.SDKErrorf(err, "", "service_api_key-error", common.GetComponentInfo()) + return } - - return -} - -// DatabaseRegistrationPrototypeDatabasePropertiesItems : Key value object. -type DatabaseRegistrationPrototypeDatabasePropertiesItems struct { - // Wether the value is to be encrypted before storing. - Encrypt *bool `json:"encrypt" validate:"required"` - - // Key of the database property. - Key *string `json:"key" validate:"required"` - - // Value of the database property. - Value *string `json:"value" validate:"required"` -} - -// NewDatabaseRegistrationPrototypeDatabasePropertiesItems : Instantiate DatabaseRegistrationPrototypeDatabasePropertiesItems (Generic Model Constructor) -func (*WatsonxDataV2) NewDatabaseRegistrationPrototypeDatabasePropertiesItems(encrypt bool, key string, value string) (_model *DatabaseRegistrationPrototypeDatabasePropertiesItems, err error) { - _model = &DatabaseRegistrationPrototypeDatabasePropertiesItems{ - Encrypt: core.BoolPtr(encrypt), - Key: core.StringPtr(key), - Value: core.StringPtr(value), + err = core.UnmarshalPrimitive(m, "service_hostname", &obj.ServiceHostname) + if err != nil { + err = core.SDKErrorf(err, "", "service_hostname-error", common.GetComponentInfo()) + return } - err = core.ValidateStruct(_model, "required parameters") + err = core.UnmarshalPrimitive(m, "service_password", &obj.ServicePassword) if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "service_password-error", common.GetComponentInfo()) + return } - return -} - -// UnmarshalDatabaseRegistrationPrototypeDatabasePropertiesItems unmarshals an instance of DatabaseRegistrationPrototypeDatabasePropertiesItems from the specified map of raw messages. -func UnmarshalDatabaseRegistrationPrototypeDatabasePropertiesItems(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DatabaseRegistrationPrototypeDatabasePropertiesItems) - err = core.UnmarshalPrimitive(m, "encrypt", &obj.Encrypt) + err = core.UnmarshalPrimitive(m, "service_port", &obj.ServicePort) if err != nil { - err = core.SDKErrorf(err, "", "encrypt-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "service_port-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "key", &obj.Key) + err = core.UnmarshalPrimitive(m, "service_ssl", &obj.ServiceSsl) if err != nil { - err = core.SDKErrorf(err, "", "key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "service_ssl-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + err = core.UnmarshalPrimitive(m, "service_token_url", &obj.ServiceTokenURL) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "service_token_url-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// DatabaseRegistrationTopicsItems : Topic. -type DatabaseRegistrationTopicsItems struct { - // Created on. - CreatedOn *string `json:"created_on,omitempty"` - - // file content. - FileContents *string `json:"file_contents,omitempty"` - - // file name. - FileName *string `json:"file_name,omitempty"` - - // topic name. - TopicName *string `json:"topic_name,omitempty"` -} - -// UnmarshalDatabaseRegistrationTopicsItems unmarshals an instance of DatabaseRegistrationTopicsItems from the specified map of raw messages. -func UnmarshalDatabaseRegistrationTopicsItems(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DatabaseRegistrationTopicsItems) - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + err = core.UnmarshalPrimitive(m, "service_username", &obj.ServiceUsername) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "service_username-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "file_contents", &obj.FileContents) + err = core.UnmarshalPrimitive(m, "ssl", &obj.Ssl) if err != nil { - err = core.SDKErrorf(err, "", "file_contents-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "ssl-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "file_name", &obj.FileName) + err = core.UnmarshalModel(m, "sslcertificate_key_vault", &obj.SslcertificateKeyVault, UnmarshalSecretDetails) if err != nil { - err = core.SDKErrorf(err, "", "file_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "sslcertificate_key_vault-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "topic_name", &obj.TopicName) + err = core.UnmarshalPrimitive(m, "tables", &obj.Tables) if err != nil { - err = core.SDKErrorf(err, "", "topic_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "tables-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "username_key_vault", &obj.UsernameKeyVault, UnmarshalSecretDetails) + if err != nil { + err = core.SDKErrorf(err, "", "username_key_vault-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "validate_server_certificate", &obj.ValidateServerCertificate) + if err != nil { + err = core.SDKErrorf(err, "", "validate_server_certificate-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "vault_enabled", &obj.VaultEnabled) + if err != nil { + err = core.SDKErrorf(err, "", "vault_enabled-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "verify_host_name", &obj.VerifyHostName) + if err != nil { + err = core.SDKErrorf(err, "", "verify_host_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "warehouse_name", &obj.WarehouseName) + if err != nil { + err = core.SDKErrorf(err, "", "warehouse_name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// Db2Engine : Db2 engine details. -type Db2Engine struct { - // Actions. - Actions []string `json:"actions,omitempty"` +// DatabaseRegistration : Database registration object. +type DatabaseRegistration struct { + // actions. + Actions []string `json:"actions" validate:"required"` - // watsonx.data build version. - BuildVersion *string `json:"build_version,omitempty"` + // database catalog. + AssociatedCatalog *DatabaseCatalog `json:"associated_catalog,omitempty"` - // Created user name. - CreatedBy *string `json:"created_by,omitempty"` + // Catalog name. + CatalogName *string `json:"catalog_name,omitempty"` - // Created time in epoch format. - CreatedOn *int64 `json:"created_on,omitempty"` + // database details. + Connection *DatabaseDetails `json:"connection" validate:"required"` - // Engine description. + // Created on. + CreatedAt *string `json:"created_at,omitempty"` + + // Created by. + CreatedBy *string `json:"created_by,omitempty"` + + // Database description. Description *string `json:"description,omitempty"` - // External engine details. - EngineDetails *Db2EngineDetails `json:"engine_details,omitempty"` + // Database display name. + DisplayName *string `json:"display_name" validate:"required"` - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` + // Database ID. + ID *string `json:"id,omitempty"` - // Engine programmatic name. - EngineID *string `json:"engine_id,omitempty"` + // This will hold all the properties for a custom database. + Properties []DatabaseRegistrationDatabasePropertiesItems `json:"properties" validate:"required"` - // Engine host name. In case of OCP based clusters, this is internal hostname. - HostName *string `json:"host_name,omitempty"` + // Target catalog id in the platform to save the database connection. + TargetCatalogID *string `json:"target_catalog_id,omitempty"` - // Origin - place holder. - Origin *string `json:"origin,omitempty"` + // Source connection assset Id from platform. + SourceAssetID *string `json:"source_asset_id,omitempty"` - // Engine port. - Port *int64 `json:"port,omitempty"` + // Source catalog Id from platform. + SourceCatalogID *string `json:"source_catalog_id,omitempty"` - // Engine status. - Status *string `json:"status,omitempty"` + // Source project Id from platform. + SourceProjectID *string `json:"source_project_id,omitempty"` - // Tags. - Tags []string `json:"tags,omitempty"` + // List of tables. + Tables []DatabaseRegistrationTablesItems `json:"tables" validate:"required"` - // Engine type. - Type *string `json:"type,omitempty"` + // tags. + Tags []string `json:"tags" validate:"required"` + + // List of topics. + Topics []DatabaseRegistrationTopicsItems `json:"topics" validate:"required"` + + // Connector type. + Type *string `json:"type" validate:"required"` + + // vault enabled or not. + VaultEnabled *bool `json:"vault_enabled,omitempty"` } -// UnmarshalDb2Engine unmarshals an instance of Db2Engine from the specified map of raw messages. -func UnmarshalDb2Engine(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Db2Engine) +// UnmarshalDatabaseRegistration unmarshals an instance of DatabaseRegistration from the specified map of raw messages. +func UnmarshalDatabaseRegistration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseRegistration) err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) if err != nil { err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "build_version", &obj.BuildVersion) + err = core.UnmarshalModel(m, "associated_catalog", &obj.AssociatedCatalog, UnmarshalDatabaseCatalog) if err != nil { - err = core.SDKErrorf(err, "", "build_version-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "associated_catalog-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) if err != nil { - err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + err = core.UnmarshalModel(m, "connection", &obj.Connection, UnmarshalDatabaseDetails) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "connection-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "engine_details", &obj.EngineDetails, UnmarshalDb2EngineDetails) + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) if err != nil { - err = core.SDKErrorf(err, "", "engine_details-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_display_name", &obj.EngineDisplayName) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { - err = core.SDKErrorf(err, "", "engine_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) if err != nil { - err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "host_name", &obj.HostName) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "host_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + err = core.UnmarshalModel(m, "properties", &obj.Properties, UnmarshalDatabaseRegistrationDatabasePropertiesItems) if err != nil { - err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "properties-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) + err = core.UnmarshalPrimitive(m, "target_catalog_id", &obj.TargetCatalogID) if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "target_catalog_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "source_asset_id", &obj.SourceAssetID) if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "source_asset_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "source_catalog_id", &obj.SourceCatalogID) + if err != nil { + err = core.SDKErrorf(err, "", "source_catalog_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "source_project_id", &obj.SourceProjectID) + if err != nil { + err = core.SDKErrorf(err, "", "source_project_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "tables", &obj.Tables, UnmarshalDatabaseRegistrationTablesItems) + if err != nil { + err = core.SDKErrorf(err, "", "tables-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) @@ -16071,100 +17548,119 @@ func UnmarshalDb2Engine(m map[string]json.RawMessage, result interface{}) (err e err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "topics", &obj.Topics, UnmarshalDatabaseRegistrationTopicsItems) + if err != nil { + err = core.SDKErrorf(err, "", "topics-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "vault_enabled", &obj.VaultEnabled) + if err != nil { + err = core.SDKErrorf(err, "", "vault_enabled-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// Db2EngineCollection : list db2 engines. -type Db2EngineCollection struct { - // list db2 engines. - Db2Engines []Db2Engine `json:"db2_engines,omitempty"` +// DatabaseRegistrationCollection : Database registrations collection. +type DatabaseRegistrationCollection struct { + // Database body. + DatabaseRegistrations []DatabaseRegistration `json:"database_registrations" validate:"required"` } -// UnmarshalDb2EngineCollection unmarshals an instance of Db2EngineCollection from the specified map of raw messages. -func UnmarshalDb2EngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Db2EngineCollection) - err = core.UnmarshalModel(m, "db2_engines", &obj.Db2Engines, UnmarshalDb2Engine) +// UnmarshalDatabaseRegistrationCollection unmarshals an instance of DatabaseRegistrationCollection from the specified map of raw messages. +func UnmarshalDatabaseRegistrationCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseRegistrationCollection) + err = core.UnmarshalModel(m, "database_registrations", &obj.DatabaseRegistrations, UnmarshalDatabaseRegistration) if err != nil { - err = core.SDKErrorf(err, "", "db2_engines-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "database_registrations-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// Db2EngineDetails : External engine details. -type Db2EngineDetails struct { - // External engine connection string. - ConnectionString *string `json:"connection_string,omitempty"` +// DatabaseRegistrationDatabasePropertiesItems : Key value object. +type DatabaseRegistrationDatabasePropertiesItems struct { + // Indicates if the value must be encrypted before storing. + Encrypt *bool `json:"encrypt" validate:"required"` - // Metastore host. - MetastoreHost *string `json:"metastore_host,omitempty"` + // Key of the database property. + Key *string `json:"key" validate:"required"` + + // Value of the database property. + Value *string `json:"value" validate:"required"` } -// UnmarshalDb2EngineDetails unmarshals an instance of Db2EngineDetails from the specified map of raw messages. -func UnmarshalDb2EngineDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Db2EngineDetails) - err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) +// UnmarshalDatabaseRegistrationDatabasePropertiesItems unmarshals an instance of DatabaseRegistrationDatabasePropertiesItems from the specified map of raw messages. +func UnmarshalDatabaseRegistrationDatabasePropertiesItems(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseRegistrationDatabasePropertiesItems) + err = core.UnmarshalPrimitive(m, "encrypt", &obj.Encrypt) if err != nil { - err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "encrypt-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "metastore_host", &obj.MetastoreHost) + err = core.UnmarshalPrimitive(m, "key", &obj.Key) if err != nil { - err = core.SDKErrorf(err, "", "metastore_host-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "key-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Db2EngineDetailsBody : External engine details. -type Db2EngineDetailsBody struct { - // External engine connection string. - ConnectionString *string `json:"connection_string,omitempty"` -} - -// UnmarshalDb2EngineDetailsBody unmarshals an instance of Db2EngineDetailsBody from the specified map of raw messages. -func UnmarshalDb2EngineDetailsBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Db2EngineDetailsBody) - err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { - err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// Db2EnginePatch : UpdateEngine body. -type Db2EnginePatch struct { - // Modified description. +// DatabaseRegistrationPatch : Database registration update request details. +type DatabaseRegistrationPatch struct { + // Database details update. Only credentials can be updated. + Connection *DatabaseRegistrationPatchDatabaseDetails `json:"connection,omitempty"` + + // New database description. Description *string `json:"description,omitempty"` - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` + // New database display name. + DisplayName *string `json:"display_name,omitempty"` - // Tags. + // List of tables. + Tables []DatabaseRegistrationPatchTablesItems `json:"tables,omitempty"` + + // New tags. Tags []string `json:"tags,omitempty"` + + // List of topics. + Topics []DatabaseRegistrationPatchTopicsItems `json:"topics,omitempty"` } -// UnmarshalDb2EnginePatch unmarshals an instance of Db2EnginePatch from the specified map of raw messages. -func UnmarshalDb2EnginePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Db2EnginePatch) +// UnmarshalDatabaseRegistrationPatch unmarshals an instance of DatabaseRegistrationPatch from the specified map of raw messages. +func UnmarshalDatabaseRegistrationPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseRegistrationPatch) + err = core.UnmarshalModel(m, "connection", &obj.Connection, UnmarshalDatabaseRegistrationPatchDatabaseDetails) + if err != nil { + err = core.SDKErrorf(err, "", "connection-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_display_name", &obj.EngineDisplayName) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "tables", &obj.Tables, UnmarshalDatabaseRegistrationPatchTablesItems) if err != nil { - err = core.SDKErrorf(err, "", "engine_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "tables-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) @@ -16172,3021 +17668,3310 @@ func UnmarshalDb2EnginePatch(m map[string]json.RawMessage, result interface{}) ( err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "topics", &obj.Topics, UnmarshalDatabaseRegistrationPatchTopicsItems) + if err != nil { + err = core.SDKErrorf(err, "", "topics-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the Db2EnginePatch -func (db2EnginePatch *Db2EnginePatch) AsPatch() (_patch map[string]interface{}, err error) { +// AsPatch returns a generic map representation of the DatabaseRegistrationPatch +func (databaseRegistrationPatch *DatabaseRegistrationPatch) AsPatch() (_patch map[string]interface{}, err error) { _patch = map[string]interface{}{} - if !core.IsNil(db2EnginePatch.Description) { - _patch["description"] = db2EnginePatch.Description + if !core.IsNil(databaseRegistrationPatch.Connection) { + _patch["connection"] = databaseRegistrationPatch.Connection.asPatch() } - if !core.IsNil(db2EnginePatch.EngineDisplayName) { - _patch["engine_display_name"] = db2EnginePatch.EngineDisplayName + if !core.IsNil(databaseRegistrationPatch.Description) { + _patch["description"] = databaseRegistrationPatch.Description } - if !core.IsNil(db2EnginePatch.Tags) { - _patch["tags"] = db2EnginePatch.Tags + if !core.IsNil(databaseRegistrationPatch.DisplayName) { + _patch["display_name"] = databaseRegistrationPatch.DisplayName + } + if !core.IsNil(databaseRegistrationPatch.Tables) { + var tablesPatches []map[string]interface{} + for _, tables := range databaseRegistrationPatch.Tables { + tablesPatches = append(tablesPatches, tables.asPatch()) + } + _patch["tables"] = tablesPatches + } + if !core.IsNil(databaseRegistrationPatch.Tags) { + _patch["tags"] = databaseRegistrationPatch.Tags + } + if !core.IsNil(databaseRegistrationPatch.Topics) { + var topicsPatches []map[string]interface{} + for _, topics := range databaseRegistrationPatch.Topics { + topicsPatches = append(topicsPatches, topics.asPatch()) + } + _patch["topics"] = topicsPatches } return } -// DeleteBucketRegistrationOptions : The DeleteBucketRegistration options. -type DeleteBucketRegistrationOptions struct { - // bucket id. - BucketID *string `json:"bucket_id" validate:"required,ne="` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewDeleteBucketRegistrationOptions : Instantiate DeleteBucketRegistrationOptions -func (*WatsonxDataV2) NewDeleteBucketRegistrationOptions(bucketID string) *DeleteBucketRegistrationOptions { - return &DeleteBucketRegistrationOptions{ - BucketID: core.StringPtr(bucketID), - } -} +// DatabaseRegistrationPatchDatabaseDetails : Database details update. Only credentials can be updated. +type DatabaseRegistrationPatchDatabaseDetails struct { + // Authentication method. + AuthenticationValue *string `json:"authentication_value,omitempty"` -// SetBucketID : Allow user to set BucketID -func (_options *DeleteBucketRegistrationOptions) SetBucketID(bucketID string) *DeleteBucketRegistrationOptions { - _options.BucketID = core.StringPtr(bucketID) - return _options -} + // Broker authentication password. + BrokerAuthenticationPassword *string `json:"broker_authentication_password,omitempty"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteBucketRegistrationOptions) SetAuthInstanceID(authInstanceID string) *DeleteBucketRegistrationOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} + // Broker authentication type. + BrokerAuthenticationType *string `json:"broker_authentication_type,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *DeleteBucketRegistrationOptions) SetHeaders(param map[string]string) *DeleteBucketRegistrationOptions { - options.Headers = param - return options -} + // Broker authentication user. + BrokerAuthenticationUser *string `json:"broker_authentication_user,omitempty"` -// DeleteColumnOptions : The DeleteColumn options. -type DeleteColumnOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required"` + // Controller authentication password. + ControllerAuthenticationPassword *string `json:"controller_authentication_password,omitempty"` - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` + // Controller authentication type. + ControllerAuthenticationType *string `json:"controller_authentication_type,omitempty"` - // URL encoded schema name. - SchemaID *string `json:"schema_id" validate:"required,ne="` + // Controller authentication user. + ControllerAuthenticationUser *string `json:"controller_authentication_user,omitempty"` - // URL encoded schema name. - TableID *string `json:"table_id" validate:"required,ne="` + // Base 64 encoded json file. + CredentialsKey *string `json:"credentials_key,omitempty"` - // URL encoded schema name. - ColumnID *string `json:"column_id" validate:"required,ne="` + // New password. + Password *string `json:"password,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // This will hold all the properties for a custom database. + Properties []DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems `json:"properties,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // New username. + Username *string `json:"username,omitempty"` } -// NewDeleteColumnOptions : Instantiate DeleteColumnOptions -func (*WatsonxDataV2) NewDeleteColumnOptions(engineID string, catalogID string, schemaID string, tableID string, columnID string) *DeleteColumnOptions { - return &DeleteColumnOptions{ - EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - TableID: core.StringPtr(tableID), - ColumnID: core.StringPtr(columnID), +// UnmarshalDatabaseRegistrationPatchDatabaseDetails unmarshals an instance of DatabaseRegistrationPatchDatabaseDetails from the specified map of raw messages. +func UnmarshalDatabaseRegistrationPatchDatabaseDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseRegistrationPatchDatabaseDetails) + err = core.UnmarshalPrimitive(m, "authentication_value", &obj.AuthenticationValue) + if err != nil { + err = core.SDKErrorf(err, "", "authentication_value-error", common.GetComponentInfo()) + return } -} - -// SetEngineID : Allow user to set EngineID -func (_options *DeleteColumnOptions) SetEngineID(engineID string) *DeleteColumnOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetCatalogID : Allow user to set CatalogID -func (_options *DeleteColumnOptions) SetCatalogID(catalogID string) *DeleteColumnOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options -} - -// SetSchemaID : Allow user to set SchemaID -func (_options *DeleteColumnOptions) SetSchemaID(schemaID string) *DeleteColumnOptions { - _options.SchemaID = core.StringPtr(schemaID) - return _options -} - -// SetTableID : Allow user to set TableID -func (_options *DeleteColumnOptions) SetTableID(tableID string) *DeleteColumnOptions { - _options.TableID = core.StringPtr(tableID) - return _options -} - -// SetColumnID : Allow user to set ColumnID -func (_options *DeleteColumnOptions) SetColumnID(columnID string) *DeleteColumnOptions { - _options.ColumnID = core.StringPtr(columnID) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteColumnOptions) SetAuthInstanceID(authInstanceID string) *DeleteColumnOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteColumnOptions) SetHeaders(param map[string]string) *DeleteColumnOptions { - options.Headers = param - return options -} - -// DeleteDatabaseCatalogOptions : The DeleteDatabaseCatalog options. -type DeleteDatabaseCatalogOptions struct { - // database id. - DatabaseID *string `json:"database_id" validate:"required,ne="` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewDeleteDatabaseCatalogOptions : Instantiate DeleteDatabaseCatalogOptions -func (*WatsonxDataV2) NewDeleteDatabaseCatalogOptions(databaseID string) *DeleteDatabaseCatalogOptions { - return &DeleteDatabaseCatalogOptions{ - DatabaseID: core.StringPtr(databaseID), + err = core.UnmarshalPrimitive(m, "broker_authentication_password", &obj.BrokerAuthenticationPassword) + if err != nil { + err = core.SDKErrorf(err, "", "broker_authentication_password-error", common.GetComponentInfo()) + return } + err = core.UnmarshalPrimitive(m, "broker_authentication_type", &obj.BrokerAuthenticationType) + if err != nil { + err = core.SDKErrorf(err, "", "broker_authentication_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "broker_authentication_user", &obj.BrokerAuthenticationUser) + if err != nil { + err = core.SDKErrorf(err, "", "broker_authentication_user-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "controller_authentication_password", &obj.ControllerAuthenticationPassword) + if err != nil { + err = core.SDKErrorf(err, "", "controller_authentication_password-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "controller_authentication_type", &obj.ControllerAuthenticationType) + if err != nil { + err = core.SDKErrorf(err, "", "controller_authentication_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "controller_authentication_user", &obj.ControllerAuthenticationUser) + if err != nil { + err = core.SDKErrorf(err, "", "controller_authentication_user-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "credentials_key", &obj.CredentialsKey) + if err != nil { + err = core.SDKErrorf(err, "", "credentials_key-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "password", &obj.Password) + if err != nil { + err = core.SDKErrorf(err, "", "password-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "properties", &obj.Properties, UnmarshalDatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems) + if err != nil { + err = core.SDKErrorf(err, "", "properties-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetDatabaseID : Allow user to set DatabaseID -func (_options *DeleteDatabaseCatalogOptions) SetDatabaseID(databaseID string) *DeleteDatabaseCatalogOptions { - _options.DatabaseID = core.StringPtr(databaseID) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteDatabaseCatalogOptions) SetAuthInstanceID(authInstanceID string) *DeleteDatabaseCatalogOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} +// asPatch returns a generic map representation of the DatabaseRegistrationPatchDatabaseDetails +func (databaseRegistrationPatchDatabaseDetails *DatabaseRegistrationPatchDatabaseDetails) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(databaseRegistrationPatchDatabaseDetails.AuthenticationValue) { + _patch["authentication_value"] = databaseRegistrationPatchDatabaseDetails.AuthenticationValue + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetails.BrokerAuthenticationPassword) { + _patch["broker_authentication_password"] = databaseRegistrationPatchDatabaseDetails.BrokerAuthenticationPassword + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetails.BrokerAuthenticationType) { + _patch["broker_authentication_type"] = databaseRegistrationPatchDatabaseDetails.BrokerAuthenticationType + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetails.BrokerAuthenticationUser) { + _patch["broker_authentication_user"] = databaseRegistrationPatchDatabaseDetails.BrokerAuthenticationUser + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetails.ControllerAuthenticationPassword) { + _patch["controller_authentication_password"] = databaseRegistrationPatchDatabaseDetails.ControllerAuthenticationPassword + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetails.ControllerAuthenticationType) { + _patch["controller_authentication_type"] = databaseRegistrationPatchDatabaseDetails.ControllerAuthenticationType + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetails.ControllerAuthenticationUser) { + _patch["controller_authentication_user"] = databaseRegistrationPatchDatabaseDetails.ControllerAuthenticationUser + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetails.CredentialsKey) { + _patch["credentials_key"] = databaseRegistrationPatchDatabaseDetails.CredentialsKey + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetails.Password) { + _patch["password"] = databaseRegistrationPatchDatabaseDetails.Password + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetails.Properties) { + var propertiesPatches []map[string]interface{} + for _, properties := range databaseRegistrationPatchDatabaseDetails.Properties { + propertiesPatches = append(propertiesPatches, properties.asPatch()) + } + _patch["properties"] = propertiesPatches + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetails.Username) { + _patch["username"] = databaseRegistrationPatchDatabaseDetails.Username + } -// SetHeaders : Allow user to set Headers -func (options *DeleteDatabaseCatalogOptions) SetHeaders(param map[string]string) *DeleteDatabaseCatalogOptions { - options.Headers = param - return options + return } -// DeleteDb2EngineOptions : The DeleteDb2Engine options. -type DeleteDb2EngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems : Key value object. +type DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems struct { + // Indicates if the value must be encrypted before storing. + Encrypt *bool `json:"encrypt" validate:"required"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Key of the database property. + Key *string `json:"key" validate:"required"` - // Allows users to set headers on API requests. - Headers map[string]string + // Value of the database property. + Value *string `json:"value" validate:"required"` } -// NewDeleteDb2EngineOptions : Instantiate DeleteDb2EngineOptions -func (*WatsonxDataV2) NewDeleteDb2EngineOptions(engineID string) *DeleteDb2EngineOptions { - return &DeleteDb2EngineOptions{ - EngineID: core.StringPtr(engineID), +// NewDatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems : Instantiate DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems (Generic Model Constructor) +func (*WatsonxDataV3) NewDatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems(encrypt bool, key string, value string) (_model *DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems, err error) { + _model = &DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems{ + Encrypt: core.BoolPtr(encrypt), + Key: core.StringPtr(key), + Value: core.StringPtr(value), } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return } -// SetEngineID : Allow user to set EngineID -func (_options *DeleteDb2EngineOptions) SetEngineID(engineID string) *DeleteDb2EngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteDb2EngineOptions) SetAuthInstanceID(authInstanceID string) *DeleteDb2EngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteDb2EngineOptions) SetHeaders(param map[string]string) *DeleteDb2EngineOptions { - options.Headers = param - return options -} - -// DeleteDeactivateBucketOptions : The DeleteDeactivateBucket options. -type DeleteDeactivateBucketOptions struct { - // bucket id. - BucketID *string `json:"bucket_id" validate:"required,ne="` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewDeleteDeactivateBucketOptions : Instantiate DeleteDeactivateBucketOptions -func (*WatsonxDataV2) NewDeleteDeactivateBucketOptions(bucketID string) *DeleteDeactivateBucketOptions { - return &DeleteDeactivateBucketOptions{ - BucketID: core.StringPtr(bucketID), +// UnmarshalDatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems unmarshals an instance of DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems from the specified map of raw messages. +func UnmarshalDatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems) + err = core.UnmarshalPrimitive(m, "encrypt", &obj.Encrypt) + if err != nil { + err = core.SDKErrorf(err, "", "encrypt-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "key", &obj.Key) + if err != nil { + err = core.SDKErrorf(err, "", "key-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetBucketID : Allow user to set BucketID -func (_options *DeleteDeactivateBucketOptions) SetBucketID(bucketID string) *DeleteDeactivateBucketOptions { - _options.BucketID = core.StringPtr(bucketID) - return _options -} +// asPatch returns a generic map representation of the DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems +func (databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems *DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems.Encrypt) { + _patch["encrypt"] = databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems.Encrypt + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems.Key) { + _patch["key"] = databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems.Key + } + if !core.IsNil(databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems.Value) { + _patch["value"] = databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems.Value + } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteDeactivateBucketOptions) SetAuthInstanceID(authInstanceID string) *DeleteDeactivateBucketOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options + return } -// SetHeaders : Allow user to set Headers -func (options *DeleteDeactivateBucketOptions) SetHeaders(param map[string]string) *DeleteDeactivateBucketOptions { - options.Headers = param - return options -} +// DatabaseRegistrationPatchTablesItems : Table. +type DatabaseRegistrationPatchTablesItems struct { + // Created on. + CreatedAt *string `json:"created_at,omitempty"` -// DeleteDriverEnginesOptions : The DeleteDriverEngines options. -type DeleteDriverEnginesOptions struct { - // driver id. - DriverID *string `json:"driver_id" validate:"required,ne="` + // file content. + FileContents *string `json:"file_contents,omitempty"` - // Engine id(s) to be disassociated from the driver, comma separated. - EngineIds *string `json:"engine_ids" validate:"required"` + // file name. + FileName *string `json:"file_name,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // schema name. + SchemaName *string `json:"schema_name,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // table name. + TableName *string `json:"table_name,omitempty"` } -// NewDeleteDriverEnginesOptions : Instantiate DeleteDriverEnginesOptions -func (*WatsonxDataV2) NewDeleteDriverEnginesOptions(driverID string, engineIds string) *DeleteDriverEnginesOptions { - return &DeleteDriverEnginesOptions{ - DriverID: core.StringPtr(driverID), - EngineIds: core.StringPtr(engineIds), +// UnmarshalDatabaseRegistrationPatchTablesItems unmarshals an instance of DatabaseRegistrationPatchTablesItems from the specified map of raw messages. +func UnmarshalDatabaseRegistrationPatchTablesItems(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseRegistrationPatchTablesItems) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return } + err = core.UnmarshalPrimitive(m, "file_contents", &obj.FileContents) + if err != nil { + err = core.SDKErrorf(err, "", "file_contents-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "file_name", &obj.FileName) + if err != nil { + err = core.SDKErrorf(err, "", "file_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "schema_name", &obj.SchemaName) + if err != nil { + err = core.SDKErrorf(err, "", "schema_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "table_name", &obj.TableName) + if err != nil { + err = core.SDKErrorf(err, "", "table_name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetDriverID : Allow user to set DriverID -func (_options *DeleteDriverEnginesOptions) SetDriverID(driverID string) *DeleteDriverEnginesOptions { - _options.DriverID = core.StringPtr(driverID) - return _options -} - -// SetEngineIds : Allow user to set EngineIds -func (_options *DeleteDriverEnginesOptions) SetEngineIds(engineIds string) *DeleteDriverEnginesOptions { - _options.EngineIds = core.StringPtr(engineIds) - return _options -} +// asPatch returns a generic map representation of the DatabaseRegistrationPatchTablesItems +func (databaseRegistrationPatchTablesItems *DatabaseRegistrationPatchTablesItems) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(databaseRegistrationPatchTablesItems.CreatedAt) { + _patch["created_at"] = databaseRegistrationPatchTablesItems.CreatedAt + } + if !core.IsNil(databaseRegistrationPatchTablesItems.FileContents) { + _patch["file_contents"] = databaseRegistrationPatchTablesItems.FileContents + } + if !core.IsNil(databaseRegistrationPatchTablesItems.FileName) { + _patch["file_name"] = databaseRegistrationPatchTablesItems.FileName + } + if !core.IsNil(databaseRegistrationPatchTablesItems.SchemaName) { + _patch["schema_name"] = databaseRegistrationPatchTablesItems.SchemaName + } + if !core.IsNil(databaseRegistrationPatchTablesItems.TableName) { + _patch["table_name"] = databaseRegistrationPatchTablesItems.TableName + } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteDriverEnginesOptions) SetAuthInstanceID(authInstanceID string) *DeleteDriverEnginesOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options + return } -// SetHeaders : Allow user to set Headers -func (options *DeleteDriverEnginesOptions) SetHeaders(param map[string]string) *DeleteDriverEnginesOptions { - options.Headers = param - return options -} +// DatabaseRegistrationPatchTopicsItems : Topic. +type DatabaseRegistrationPatchTopicsItems struct { + // Created on. + CreatedAt *string `json:"created_at,omitempty"` -// DeleteDriverRegistrationOptions : The DeleteDriverRegistration options. -type DeleteDriverRegistrationOptions struct { - // Driver ID. - DriverID *string `json:"driver_id" validate:"required,ne="` + // file contents. + FileContents *string `json:"file_contents,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // file name. + FileName *string `json:"file_name,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // topic name. + TopicName *string `json:"topic_name,omitempty"` } -// NewDeleteDriverRegistrationOptions : Instantiate DeleteDriverRegistrationOptions -func (*WatsonxDataV2) NewDeleteDriverRegistrationOptions(driverID string) *DeleteDriverRegistrationOptions { - return &DeleteDriverRegistrationOptions{ - DriverID: core.StringPtr(driverID), +// UnmarshalDatabaseRegistrationPatchTopicsItems unmarshals an instance of DatabaseRegistrationPatchTopicsItems from the specified map of raw messages. +func UnmarshalDatabaseRegistrationPatchTopicsItems(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseRegistrationPatchTopicsItems) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "file_contents", &obj.FileContents) + if err != nil { + err = core.SDKErrorf(err, "", "file_contents-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "file_name", &obj.FileName) + if err != nil { + err = core.SDKErrorf(err, "", "file_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "topic_name", &obj.TopicName) + if err != nil { + err = core.SDKErrorf(err, "", "topic_name-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetDriverID : Allow user to set DriverID -func (_options *DeleteDriverRegistrationOptions) SetDriverID(driverID string) *DeleteDriverRegistrationOptions { - _options.DriverID = core.StringPtr(driverID) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteDriverRegistrationOptions) SetAuthInstanceID(authInstanceID string) *DeleteDriverRegistrationOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} +// asPatch returns a generic map representation of the DatabaseRegistrationPatchTopicsItems +func (databaseRegistrationPatchTopicsItems *DatabaseRegistrationPatchTopicsItems) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(databaseRegistrationPatchTopicsItems.CreatedAt) { + _patch["created_at"] = databaseRegistrationPatchTopicsItems.CreatedAt + } + if !core.IsNil(databaseRegistrationPatchTopicsItems.FileContents) { + _patch["file_contents"] = databaseRegistrationPatchTopicsItems.FileContents + } + if !core.IsNil(databaseRegistrationPatchTopicsItems.FileName) { + _patch["file_name"] = databaseRegistrationPatchTopicsItems.FileName + } + if !core.IsNil(databaseRegistrationPatchTopicsItems.TopicName) { + _patch["topic_name"] = databaseRegistrationPatchTopicsItems.TopicName + } -// SetHeaders : Allow user to set Headers -func (options *DeleteDriverRegistrationOptions) SetHeaders(param map[string]string) *DeleteDriverRegistrationOptions { - options.Headers = param - return options + return } -// DeleteEngineOptions : The DeleteEngine options. -type DeleteEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// DatabaseRegistrationPrototypeDatabasePropertiesItems : Key value object. +type DatabaseRegistrationPrototypeDatabasePropertiesItems struct { + // Indicates if the value must be encrypted before storing. + Encrypt *bool `json:"encrypt" validate:"required"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Key of the database property. + Key *string `json:"key" validate:"required"` - // Allows users to set headers on API requests. - Headers map[string]string + // Value of the database property. + Value *string `json:"value" validate:"required"` } -// NewDeleteEngineOptions : Instantiate DeleteEngineOptions -func (*WatsonxDataV2) NewDeleteEngineOptions(engineID string) *DeleteEngineOptions { - return &DeleteEngineOptions{ - EngineID: core.StringPtr(engineID), +// NewDatabaseRegistrationPrototypeDatabasePropertiesItems : Instantiate DatabaseRegistrationPrototypeDatabasePropertiesItems (Generic Model Constructor) +func (*WatsonxDataV3) NewDatabaseRegistrationPrototypeDatabasePropertiesItems(encrypt bool, key string, value string) (_model *DatabaseRegistrationPrototypeDatabasePropertiesItems, err error) { + _model = &DatabaseRegistrationPrototypeDatabasePropertiesItems{ + Encrypt: core.BoolPtr(encrypt), + Key: core.StringPtr(key), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } + return } -// SetEngineID : Allow user to set EngineID -func (_options *DeleteEngineOptions) SetEngineID(engineID string) *DeleteEngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options +// UnmarshalDatabaseRegistrationPrototypeDatabasePropertiesItems unmarshals an instance of DatabaseRegistrationPrototypeDatabasePropertiesItems from the specified map of raw messages. +func UnmarshalDatabaseRegistrationPrototypeDatabasePropertiesItems(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseRegistrationPrototypeDatabasePropertiesItems) + err = core.UnmarshalPrimitive(m, "encrypt", &obj.Encrypt) + if err != nil { + err = core.SDKErrorf(err, "", "encrypt-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "key", &obj.Key) + if err != nil { + err = core.SDKErrorf(err, "", "key-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteEngineOptions) SetAuthInstanceID(authInstanceID string) *DeleteEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} +// DatabaseRegistrationTablesItems : Table. +type DatabaseRegistrationTablesItems struct { + // Created on. + CreatedAt *string `json:"created_at,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *DeleteEngineOptions) SetHeaders(param map[string]string) *DeleteEngineOptions { - options.Headers = param - return options -} + // file content. + FileContents *string `json:"file_contents,omitempty"` -// DeleteIngestionJobsOptions : The DeleteIngestionJobs options. -type DeleteIngestionJobsOptions struct { - // ingestion job id. - JobID *string `json:"job_id" validate:"required,ne="` + // file name. + FileName *string `json:"file_name,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId" validate:"required"` + // schema name. + SchemaName *string `json:"schema_name,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // table name. + TableName *string `json:"table_name,omitempty"` } -// NewDeleteIngestionJobsOptions : Instantiate DeleteIngestionJobsOptions -func (*WatsonxDataV2) NewDeleteIngestionJobsOptions(jobID string, authInstanceID string) *DeleteIngestionJobsOptions { - return &DeleteIngestionJobsOptions{ - JobID: core.StringPtr(jobID), - AuthInstanceID: core.StringPtr(authInstanceID), +// UnmarshalDatabaseRegistrationTablesItems unmarshals an instance of DatabaseRegistrationTablesItems from the specified map of raw messages. +func UnmarshalDatabaseRegistrationTablesItems(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseRegistrationTablesItems) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return } + err = core.UnmarshalPrimitive(m, "file_contents", &obj.FileContents) + if err != nil { + err = core.SDKErrorf(err, "", "file_contents-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "file_name", &obj.FileName) + if err != nil { + err = core.SDKErrorf(err, "", "file_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "schema_name", &obj.SchemaName) + if err != nil { + err = core.SDKErrorf(err, "", "schema_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "table_name", &obj.TableName) + if err != nil { + err = core.SDKErrorf(err, "", "table_name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetJobID : Allow user to set JobID -func (_options *DeleteIngestionJobsOptions) SetJobID(jobID string) *DeleteIngestionJobsOptions { - _options.JobID = core.StringPtr(jobID) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteIngestionJobsOptions) SetAuthInstanceID(authInstanceID string) *DeleteIngestionJobsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *DeleteIngestionJobsOptions) SetHeaders(param map[string]string) *DeleteIngestionJobsOptions { - options.Headers = param - return options -} +// DatabaseRegistrationTopicsItems : Topic. +type DatabaseRegistrationTopicsItems struct { + // Created on. + CreatedAt *string `json:"created_at,omitempty"` -// DeleteIntegrationOptions : The DeleteIntegration options. -type DeleteIntegrationOptions struct { - // integration_id. - IntegrationID *string `json:"integration_id" validate:"required,ne="` + // file content. + FileContents *string `json:"file_contents,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // file name. + FileName *string `json:"file_name,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // topic name. + TopicName *string `json:"topic_name,omitempty"` } -// NewDeleteIntegrationOptions : Instantiate DeleteIntegrationOptions -func (*WatsonxDataV2) NewDeleteIntegrationOptions(integrationID string) *DeleteIntegrationOptions { - return &DeleteIntegrationOptions{ - IntegrationID: core.StringPtr(integrationID), +// UnmarshalDatabaseRegistrationTopicsItems unmarshals an instance of DatabaseRegistrationTopicsItems from the specified map of raw messages. +func UnmarshalDatabaseRegistrationTopicsItems(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DatabaseRegistrationTopicsItems) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return } + err = core.UnmarshalPrimitive(m, "file_contents", &obj.FileContents) + if err != nil { + err = core.SDKErrorf(err, "", "file_contents-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "file_name", &obj.FileName) + if err != nil { + err = core.SDKErrorf(err, "", "file_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "topic_name", &obj.TopicName) + if err != nil { + err = core.SDKErrorf(err, "", "topic_name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetIntegrationID : Allow user to set IntegrationID -func (_options *DeleteIntegrationOptions) SetIntegrationID(integrationID string) *DeleteIntegrationOptions { - _options.IntegrationID = core.StringPtr(integrationID) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteIntegrationOptions) SetAuthInstanceID(authInstanceID string) *DeleteIntegrationOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} +// Db2Engine : Db2 engine details. +type Db2Engine struct { + // Actions. + Actions []string `json:"actions" validate:"required"` -// SetHeaders : Allow user to set Headers -func (options *DeleteIntegrationOptions) SetHeaders(param map[string]string) *DeleteIntegrationOptions { - options.Headers = param - return options -} + // watsonx.data build version. + BuildVersion *string `json:"build_version,omitempty"` -// DeleteMilvusServiceOptions : The DeleteMilvusService options. -type DeleteMilvusServiceOptions struct { - // service id. - ServiceID *string `json:"service_id" validate:"required,ne="` + // External engine details. + Configuration *Db2EngineDetails `json:"configuration,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Created time in epoch format. + CreatedAt *int64 `json:"created_at,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string -} + // Username of the user who created the watsonx.data instance. + CreatedBy *string `json:"created_by,omitempty"` -// NewDeleteMilvusServiceOptions : Instantiate DeleteMilvusServiceOptions -func (*WatsonxDataV2) NewDeleteMilvusServiceOptions(serviceID string) *DeleteMilvusServiceOptions { - return &DeleteMilvusServiceOptions{ - ServiceID: core.StringPtr(serviceID), - } -} + // Engine description. + Description *string `json:"description,omitempty"` -// SetServiceID : Allow user to set ServiceID -func (_options *DeleteMilvusServiceOptions) SetServiceID(serviceID string) *DeleteMilvusServiceOptions { - _options.ServiceID = core.StringPtr(serviceID) - return _options -} + // Engine display name. + DisplayName *string `json:"display_name,omitempty"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteMilvusServiceOptions) SetAuthInstanceID(authInstanceID string) *DeleteMilvusServiceOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} + // Engine host name. In case of OCP based clusters, this is internal hostname. + HostName *string `json:"host_name,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *DeleteMilvusServiceOptions) SetHeaders(param map[string]string) *DeleteMilvusServiceOptions { - options.Headers = param - return options -} + // Engine programmatic name. + ID *string `json:"id,omitempty"` -// DeleteNetezzaEngineOptions : The DeleteNetezzaEngine options. -type DeleteNetezzaEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + // Origin - place holder. + Origin *string `json:"origin,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Engine port. + Port *int64 `json:"port,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string -} + // Status of db2 engnine. + Status *string `json:"status,omitempty"` -// NewDeleteNetezzaEngineOptions : Instantiate DeleteNetezzaEngineOptions -func (*WatsonxDataV2) NewDeleteNetezzaEngineOptions(engineID string) *DeleteNetezzaEngineOptions { - return &DeleteNetezzaEngineOptions{ - EngineID: core.StringPtr(engineID), - } -} + // Tags. + Tags []string `json:"tags" validate:"required"` -// SetEngineID : Allow user to set EngineID -func (_options *DeleteNetezzaEngineOptions) SetEngineID(engineID string) *DeleteNetezzaEngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options + // Engine type. + Type *string `json:"type,omitempty"` } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteNetezzaEngineOptions) SetAuthInstanceID(authInstanceID string) *DeleteNetezzaEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options +// UnmarshalDb2Engine unmarshals an instance of Db2Engine from the specified map of raw messages. +func UnmarshalDb2Engine(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Db2Engine) + err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) + if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "build_version", &obj.BuildVersion) + if err != nil { + err = core.SDKErrorf(err, "", "build_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalDb2EngineDetails) + if err != nil { + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "host_name", &obj.HostName) + if err != nil { + err = core.SDKErrorf(err, "", "host_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetHeaders : Allow user to set Headers -func (options *DeleteNetezzaEngineOptions) SetHeaders(param map[string]string) *DeleteNetezzaEngineOptions { - options.Headers = param - return options +// Db2EngineCollection : list db2 engines. +type Db2EngineCollection struct { + // list db2 engines. + Db2Engines []Db2Engine `json:"db2_engines" validate:"required"` } -// DeleteOtherEngineOptions : The DeleteOtherEngine options. -type DeleteOtherEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// UnmarshalDb2EngineCollection unmarshals an instance of Db2EngineCollection from the specified map of raw messages. +func UnmarshalDb2EngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Db2EngineCollection) + err = core.UnmarshalModel(m, "db2_engines", &obj.Db2Engines, UnmarshalDb2Engine) + if err != nil { + err = core.SDKErrorf(err, "", "db2_engines-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` +// Db2EngineDetails : External engine details. +type Db2EngineDetails struct { + // External engine connection string. + ConnectionString *string `json:"connection_string,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // Metastore host. + MetastoreHost *string `json:"metastore_host,omitempty"` } -// NewDeleteOtherEngineOptions : Instantiate DeleteOtherEngineOptions -func (*WatsonxDataV2) NewDeleteOtherEngineOptions(engineID string) *DeleteOtherEngineOptions { - return &DeleteOtherEngineOptions{ - EngineID: core.StringPtr(engineID), +// UnmarshalDb2EngineDetails unmarshals an instance of Db2EngineDetails from the specified map of raw messages. +func UnmarshalDb2EngineDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Db2EngineDetails) + err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) + if err != nil { + err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "metastore_host", &obj.MetastoreHost) + if err != nil { + err = core.SDKErrorf(err, "", "metastore_host-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetEngineID : Allow user to set EngineID -func (_options *DeleteOtherEngineOptions) SetEngineID(engineID string) *DeleteOtherEngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options +// Db2EngineDetailsBody : External engine details. +type Db2EngineDetailsBody struct { + // External engine connection string. + ConnectionString *string `json:"connection_string" validate:"required"` } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteOtherEngineOptions) SetAuthInstanceID(authInstanceID string) *DeleteOtherEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options +// NewDb2EngineDetailsBody : Instantiate Db2EngineDetailsBody (Generic Model Constructor) +func (*WatsonxDataV3) NewDb2EngineDetailsBody(connectionString string) (_model *Db2EngineDetailsBody, err error) { + _model = &Db2EngineDetailsBody{ + ConnectionString: core.StringPtr(connectionString), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return } -// SetHeaders : Allow user to set Headers -func (options *DeleteOtherEngineOptions) SetHeaders(param map[string]string) *DeleteOtherEngineOptions { - options.Headers = param - return options +// UnmarshalDb2EngineDetailsBody unmarshals an instance of Db2EngineDetailsBody from the specified map of raw messages. +func UnmarshalDb2EngineDetailsBody(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Db2EngineDetailsBody) + err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) + if err != nil { + err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// DeletePrestissimoEngineCatalogsOptions : The DeletePrestissimoEngineCatalogs options. -type DeletePrestissimoEngineCatalogsOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` - - // Catalog id(s) to be stopped, comma separated. - CatalogNames *string `json:"catalog_names" validate:"required"` +// Db2EnginePatch : UpdateEngine body. +type Db2EnginePatch struct { + // Modified description. + Description *string `json:"description,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Engine display name. + DisplayName *string `json:"display_name,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // Tags. + Tags []string `json:"tags,omitempty"` } -// NewDeletePrestissimoEngineCatalogsOptions : Instantiate DeletePrestissimoEngineCatalogsOptions -func (*WatsonxDataV2) NewDeletePrestissimoEngineCatalogsOptions(engineID string, catalogNames string) *DeletePrestissimoEngineCatalogsOptions { - return &DeletePrestissimoEngineCatalogsOptions{ - EngineID: core.StringPtr(engineID), - CatalogNames: core.StringPtr(catalogNames), +// UnmarshalDb2EnginePatch unmarshals an instance of Db2EnginePatch from the specified map of raw messages. +func UnmarshalDb2EnginePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Db2EnginePatch) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetEngineID : Allow user to set EngineID -func (_options *DeletePrestissimoEngineCatalogsOptions) SetEngineID(engineID string) *DeletePrestissimoEngineCatalogsOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} +// AsPatch returns a generic map representation of the Db2EnginePatch +func (db2EnginePatch *Db2EnginePatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(db2EnginePatch.Description) { + _patch["description"] = db2EnginePatch.Description + } + if !core.IsNil(db2EnginePatch.DisplayName) { + _patch["display_name"] = db2EnginePatch.DisplayName + } + if !core.IsNil(db2EnginePatch.Tags) { + _patch["tags"] = db2EnginePatch.Tags + } -// SetCatalogNames : Allow user to set CatalogNames -func (_options *DeletePrestissimoEngineCatalogsOptions) SetCatalogNames(catalogNames string) *DeletePrestissimoEngineCatalogsOptions { - _options.CatalogNames = core.StringPtr(catalogNames) - return _options + return } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeletePrestissimoEngineCatalogsOptions) SetAuthInstanceID(authInstanceID string) *DeletePrestissimoEngineCatalogsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} +// DbConnectionModel : Database credentials model. +type DbConnectionModel struct { + // ID of database. + DatabaseID *string `json:"database_id,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *DeletePrestissimoEngineCatalogsOptions) SetHeaders(param map[string]string) *DeletePrestissimoEngineCatalogsOptions { - options.Headers = param - return options -} + // Type of DB. + DbType *string `json:"db_type,omitempty"` -// DeletePrestissimoEngineOptions : The DeletePrestissimoEngine options. -type DeletePrestissimoEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + // DB host. + Host *string `json:"host,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // DB connection port. + Port *string `json:"port,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string -} + // Name of DB. + DbName *string `json:"db_name,omitempty"` -// NewDeletePrestissimoEngineOptions : Instantiate DeletePrestissimoEngineOptions -func (*WatsonxDataV2) NewDeletePrestissimoEngineOptions(engineID string) *DeletePrestissimoEngineOptions { - return &DeletePrestissimoEngineOptions{ - EngineID: core.StringPtr(engineID), - } -} + // DB username. + DbUsername *string `json:"db_username,omitempty"` -// SetEngineID : Allow user to set EngineID -func (_options *DeletePrestissimoEngineOptions) SetEngineID(engineID string) *DeletePrestissimoEngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} + // DB user password. + Password *string `json:"password,omitempty"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeletePrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *DeletePrestissimoEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} + // Authentication value. + AuthenticationValue *string `json:"authentication_value,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *DeletePrestissimoEngineOptions) SetHeaders(param map[string]string) *DeletePrestissimoEngineOptions { - options.Headers = param - return options -} + // Indication whether connection is SSL. + IsSsl *bool `json:"is_ssl,omitempty"` -// DeletePrestoEngineCatalogsOptions : The DeletePrestoEngineCatalogs options. -type DeletePrestoEngineCatalogsOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + // Location of certificate. + CertExtension *string `json:"cert_extension,omitempty"` - // Catalog id(s) to be stopped, comma separated. - CatalogNames *string `json:"catalog_names" validate:"required"` + // Content of certificate. + CertContent *string `json:"cert_content,omitempty"` + + // Connection mode. + ConnectionMode *string `json:"connection_mode,omitempty"` + + // Value of connection mode. + ConnectionModeValue *string `json:"connection_mode_value,omitempty"` + + // JDBC URL. + JdbcURL *string `json:"jdbc_url,omitempty"` +} + +// UnmarshalDbConnectionModel unmarshals an instance of DbConnectionModel from the specified map of raw messages. +func UnmarshalDbConnectionModel(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DbConnectionModel) + err = core.UnmarshalPrimitive(m, "database_id", &obj.DatabaseID) + if err != nil { + err = core.SDKErrorf(err, "", "database_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "db_type", &obj.DbType) + if err != nil { + err = core.SDKErrorf(err, "", "db_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "host", &obj.Host) + if err != nil { + err = core.SDKErrorf(err, "", "host-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "db_name", &obj.DbName) + if err != nil { + err = core.SDKErrorf(err, "", "db_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "db_username", &obj.DbUsername) + if err != nil { + err = core.SDKErrorf(err, "", "db_username-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "password", &obj.Password) + if err != nil { + err = core.SDKErrorf(err, "", "password-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "authentication_value", &obj.AuthenticationValue) + if err != nil { + err = core.SDKErrorf(err, "", "authentication_value-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "is_ssl", &obj.IsSsl) + if err != nil { + err = core.SDKErrorf(err, "", "is_ssl-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "cert_extension", &obj.CertExtension) + if err != nil { + err = core.SDKErrorf(err, "", "cert_extension-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "cert_content", &obj.CertContent) + if err != nil { + err = core.SDKErrorf(err, "", "cert_content-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "connection_mode", &obj.ConnectionMode) + if err != nil { + err = core.SDKErrorf(err, "", "connection_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "connection_mode_value", &obj.ConnectionModeValue) + if err != nil { + err = core.SDKErrorf(err, "", "connection_mode_value-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "jdbc_url", &obj.JdbcURL) + if err != nil { + err = core.SDKErrorf(err, "", "jdbc_url-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DeleteCatalogOptions : The DeleteCatalog options. +type DeleteCatalogOptions struct { + // catalog name. + Name *string `json:"name" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Skip MDS call when Unity catalog is added. + SkipMdsCall *bool `json:"skip_mds_call,omitempty"` + // Allows users to set headers on API requests. Headers map[string]string } -// NewDeletePrestoEngineCatalogsOptions : Instantiate DeletePrestoEngineCatalogsOptions -func (*WatsonxDataV2) NewDeletePrestoEngineCatalogsOptions(engineID string, catalogNames string) *DeletePrestoEngineCatalogsOptions { - return &DeletePrestoEngineCatalogsOptions{ - EngineID: core.StringPtr(engineID), - CatalogNames: core.StringPtr(catalogNames), +// NewDeleteCatalogOptions : Instantiate DeleteCatalogOptions +func (*WatsonxDataV3) NewDeleteCatalogOptions(name string) *DeleteCatalogOptions { + return &DeleteCatalogOptions{ + Name: core.StringPtr(name), } } -// SetEngineID : Allow user to set EngineID -func (_options *DeletePrestoEngineCatalogsOptions) SetEngineID(engineID string) *DeletePrestoEngineCatalogsOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetCatalogNames : Allow user to set CatalogNames -func (_options *DeletePrestoEngineCatalogsOptions) SetCatalogNames(catalogNames string) *DeletePrestoEngineCatalogsOptions { - _options.CatalogNames = core.StringPtr(catalogNames) +// SetName : Allow user to set Name +func (_options *DeleteCatalogOptions) SetName(name string) *DeleteCatalogOptions { + _options.Name = core.StringPtr(name) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeletePrestoEngineCatalogsOptions) SetAuthInstanceID(authInstanceID string) *DeletePrestoEngineCatalogsOptions { +func (_options *DeleteCatalogOptions) SetAuthInstanceID(authInstanceID string) *DeleteCatalogOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } -// SetHeaders : Allow user to set Headers -func (options *DeletePrestoEngineCatalogsOptions) SetHeaders(param map[string]string) *DeletePrestoEngineCatalogsOptions { - options.Headers = param - return options -} - -// DeleteSalIntegrationOptions : The DeleteSalIntegration options. -type DeleteSalIntegrationOptions struct { - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewDeleteSalIntegrationOptions : Instantiate DeleteSalIntegrationOptions -func (*WatsonxDataV2) NewDeleteSalIntegrationOptions() *DeleteSalIntegrationOptions { - return &DeleteSalIntegrationOptions{} +// SetSkipMdsCall : Allow user to set SkipMdsCall +func (_options *DeleteCatalogOptions) SetSkipMdsCall(skipMdsCall bool) *DeleteCatalogOptions { + _options.SkipMdsCall = core.BoolPtr(skipMdsCall) + return _options } // SetHeaders : Allow user to set Headers -func (options *DeleteSalIntegrationOptions) SetHeaders(param map[string]string) *DeleteSalIntegrationOptions { +func (options *DeleteCatalogOptions) SetHeaders(param map[string]string) *DeleteCatalogOptions { options.Headers = param return options } -// DeleteSchemaOptions : The DeleteSchema options. -type DeleteSchemaOptions struct { - // Engine name. +// DeleteColumnOptions : The DeleteColumn options. +type DeleteColumnOptions struct { + // engine id. EngineID *string `json:"engine_id" validate:"required"` - // Catalog name. - CatalogID *string `json:"catalog_id" validate:"required,ne="` + // catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` - // URL encoded Schema name. - SchemaID *string `json:"schema_id" validate:"required,ne="` + // URL encoded schema name. + SchemaName *string `json:"schema_name" validate:"required,ne="` + + // URL encoded table name. + TableName *string `json:"table_name" validate:"required,ne="` + + // Url encoded column name. + ColumnName *string `json:"column_name" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewDeleteSchemaOptions : Instantiate DeleteSchemaOptions -func (*WatsonxDataV2) NewDeleteSchemaOptions(engineID string, catalogID string, schemaID string) *DeleteSchemaOptions { - return &DeleteSchemaOptions{ +// NewDeleteColumnOptions : Instantiate DeleteColumnOptions +func (*WatsonxDataV3) NewDeleteColumnOptions(engineID string, catalogName string, schemaName string, tableName string, columnName string) *DeleteColumnOptions { + return &DeleteColumnOptions{ EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), + CatalogName: core.StringPtr(catalogName), + SchemaName: core.StringPtr(schemaName), + TableName: core.StringPtr(tableName), + ColumnName: core.StringPtr(columnName), } } // SetEngineID : Allow user to set EngineID -func (_options *DeleteSchemaOptions) SetEngineID(engineID string) *DeleteSchemaOptions { +func (_options *DeleteColumnOptions) SetEngineID(engineID string) *DeleteColumnOptions { _options.EngineID = core.StringPtr(engineID) return _options } -// SetCatalogID : Allow user to set CatalogID -func (_options *DeleteSchemaOptions) SetCatalogID(catalogID string) *DeleteSchemaOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetCatalogName : Allow user to set CatalogName +func (_options *DeleteColumnOptions) SetCatalogName(catalogName string) *DeleteColumnOptions { + _options.CatalogName = core.StringPtr(catalogName) return _options } -// SetSchemaID : Allow user to set SchemaID -func (_options *DeleteSchemaOptions) SetSchemaID(schemaID string) *DeleteSchemaOptions { - _options.SchemaID = core.StringPtr(schemaID) +// SetSchemaName : Allow user to set SchemaName +func (_options *DeleteColumnOptions) SetSchemaName(schemaName string) *DeleteColumnOptions { + _options.SchemaName = core.StringPtr(schemaName) + return _options +} + +// SetTableName : Allow user to set TableName +func (_options *DeleteColumnOptions) SetTableName(tableName string) *DeleteColumnOptions { + _options.TableName = core.StringPtr(tableName) + return _options +} + +// SetColumnName : Allow user to set ColumnName +func (_options *DeleteColumnOptions) SetColumnName(columnName string) *DeleteColumnOptions { + _options.ColumnName = core.StringPtr(columnName) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteSchemaOptions) SetAuthInstanceID(authInstanceID string) *DeleteSchemaOptions { +func (_options *DeleteColumnOptions) SetAuthInstanceID(authInstanceID string) *DeleteColumnOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *DeleteSchemaOptions) SetHeaders(param map[string]string) *DeleteSchemaOptions { +func (options *DeleteColumnOptions) SetHeaders(param map[string]string) *DeleteColumnOptions { options.Headers = param return options } -// DeleteSparkEngineApplicationsOptions : The DeleteSparkEngineApplications options. -type DeleteSparkEngineApplicationsOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` - - // Application id(s) to be stopped, comma separated. - ApplicationID *string `json:"application_id" validate:"required"` - - // CRN. +// DeleteDataPoliciesOptions : The DeleteDataPolicies options. +type DeleteDataPoliciesOptions struct { + // Unique identifier assigned to a specific watsonx.data instance. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // state. - State []string `json:"state,omitempty"` + // Data policies that must be deleted is passing as query param, for example: ?policies=policy1,policy2. + Policies *string `json:"policies,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewDeleteSparkEngineApplicationsOptions : Instantiate DeleteSparkEngineApplicationsOptions -func (*WatsonxDataV2) NewDeleteSparkEngineApplicationsOptions(engineID string, applicationID string) *DeleteSparkEngineApplicationsOptions { - return &DeleteSparkEngineApplicationsOptions{ - EngineID: core.StringPtr(engineID), - ApplicationID: core.StringPtr(applicationID), - } -} - -// SetEngineID : Allow user to set EngineID -func (_options *DeleteSparkEngineApplicationsOptions) SetEngineID(engineID string) *DeleteSparkEngineApplicationsOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetApplicationID : Allow user to set ApplicationID -func (_options *DeleteSparkEngineApplicationsOptions) SetApplicationID(applicationID string) *DeleteSparkEngineApplicationsOptions { - _options.ApplicationID = core.StringPtr(applicationID) - return _options +// NewDeleteDataPoliciesOptions : Instantiate DeleteDataPoliciesOptions +func (*WatsonxDataV3) NewDeleteDataPoliciesOptions() *DeleteDataPoliciesOptions { + return &DeleteDataPoliciesOptions{} } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteSparkEngineApplicationsOptions) SetAuthInstanceID(authInstanceID string) *DeleteSparkEngineApplicationsOptions { +func (_options *DeleteDataPoliciesOptions) SetAuthInstanceID(authInstanceID string) *DeleteDataPoliciesOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } -// SetState : Allow user to set State -func (_options *DeleteSparkEngineApplicationsOptions) SetState(state []string) *DeleteSparkEngineApplicationsOptions { - _options.State = state +// SetPolicies : Allow user to set Policies +func (_options *DeleteDataPoliciesOptions) SetPolicies(policies string) *DeleteDataPoliciesOptions { + _options.Policies = core.StringPtr(policies) return _options } // SetHeaders : Allow user to set Headers -func (options *DeleteSparkEngineApplicationsOptions) SetHeaders(param map[string]string) *DeleteSparkEngineApplicationsOptions { +func (options *DeleteDataPoliciesOptions) SetHeaders(param map[string]string) *DeleteDataPoliciesOptions { options.Headers = param return options } -// DeleteSparkEngineCatalogsOptions : The DeleteSparkEngineCatalogs options. -type DeleteSparkEngineCatalogsOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` - - // Catalog id(s) to be stopped, comma separated. - CatalogNames *string `json:"catalog_names" validate:"required"` +// DeleteDataPolicyOptions : The DeleteDataPolicy options. +type DeleteDataPolicyOptions struct { + // Policy name which is passing as path param to delete. + Name *string `json:"name" validate:"required,ne="` - // CRN. + // Unique identifier assigned to a specific watsonx.data instance. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewDeleteSparkEngineCatalogsOptions : Instantiate DeleteSparkEngineCatalogsOptions -func (*WatsonxDataV2) NewDeleteSparkEngineCatalogsOptions(engineID string, catalogNames string) *DeleteSparkEngineCatalogsOptions { - return &DeleteSparkEngineCatalogsOptions{ - EngineID: core.StringPtr(engineID), - CatalogNames: core.StringPtr(catalogNames), +// NewDeleteDataPolicyOptions : Instantiate DeleteDataPolicyOptions +func (*WatsonxDataV3) NewDeleteDataPolicyOptions(name string) *DeleteDataPolicyOptions { + return &DeleteDataPolicyOptions{ + Name: core.StringPtr(name), } } -// SetEngineID : Allow user to set EngineID -func (_options *DeleteSparkEngineCatalogsOptions) SetEngineID(engineID string) *DeleteSparkEngineCatalogsOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetCatalogNames : Allow user to set CatalogNames -func (_options *DeleteSparkEngineCatalogsOptions) SetCatalogNames(catalogNames string) *DeleteSparkEngineCatalogsOptions { - _options.CatalogNames = core.StringPtr(catalogNames) +// SetName : Allow user to set Name +func (_options *DeleteDataPolicyOptions) SetName(name string) *DeleteDataPolicyOptions { + _options.Name = core.StringPtr(name) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteSparkEngineCatalogsOptions) SetAuthInstanceID(authInstanceID string) *DeleteSparkEngineCatalogsOptions { +func (_options *DeleteDataPolicyOptions) SetAuthInstanceID(authInstanceID string) *DeleteDataPolicyOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *DeleteSparkEngineCatalogsOptions) SetHeaders(param map[string]string) *DeleteSparkEngineCatalogsOptions { +func (options *DeleteDataPolicyOptions) SetHeaders(param map[string]string) *DeleteDataPolicyOptions { options.Headers = param return options } -// DeleteSparkEngineHistoryServerOptions : The DeleteSparkEngineHistoryServer options. -type DeleteSparkEngineHistoryServerOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// DeleteDatabaseCatalogOptions : The DeleteDatabaseCatalog options. +type DeleteDatabaseCatalogOptions struct { + // database id. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewDeleteSparkEngineHistoryServerOptions : Instantiate DeleteSparkEngineHistoryServerOptions -func (*WatsonxDataV2) NewDeleteSparkEngineHistoryServerOptions(engineID string) *DeleteSparkEngineHistoryServerOptions { - return &DeleteSparkEngineHistoryServerOptions{ - EngineID: core.StringPtr(engineID), +// NewDeleteDatabaseCatalogOptions : Instantiate DeleteDatabaseCatalogOptions +func (*WatsonxDataV3) NewDeleteDatabaseCatalogOptions(id string) *DeleteDatabaseCatalogOptions { + return &DeleteDatabaseCatalogOptions{ + ID: core.StringPtr(id), } } -// SetEngineID : Allow user to set EngineID -func (_options *DeleteSparkEngineHistoryServerOptions) SetEngineID(engineID string) *DeleteSparkEngineHistoryServerOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *DeleteDatabaseCatalogOptions) SetID(id string) *DeleteDatabaseCatalogOptions { + _options.ID = core.StringPtr(id) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteSparkEngineHistoryServerOptions) SetAuthInstanceID(authInstanceID string) *DeleteSparkEngineHistoryServerOptions { +func (_options *DeleteDatabaseCatalogOptions) SetAuthInstanceID(authInstanceID string) *DeleteDatabaseCatalogOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *DeleteSparkEngineHistoryServerOptions) SetHeaders(param map[string]string) *DeleteSparkEngineHistoryServerOptions { +func (options *DeleteDatabaseCatalogOptions) SetHeaders(param map[string]string) *DeleteDatabaseCatalogOptions { options.Headers = param return options } -// DeleteSparkEngineOptions : The DeleteSparkEngine options. -type DeleteSparkEngineOptions struct { +// DeleteDb2EngineOptions : The DeleteDb2Engine options. +type DeleteDb2EngineOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewDeleteSparkEngineOptions : Instantiate DeleteSparkEngineOptions -func (*WatsonxDataV2) NewDeleteSparkEngineOptions(engineID string) *DeleteSparkEngineOptions { - return &DeleteSparkEngineOptions{ - EngineID: core.StringPtr(engineID), +// NewDeleteDb2EngineOptions : Instantiate DeleteDb2EngineOptions +func (*WatsonxDataV3) NewDeleteDb2EngineOptions(id string) *DeleteDb2EngineOptions { + return &DeleteDb2EngineOptions{ + ID: core.StringPtr(id), } } -// SetEngineID : Allow user to set EngineID -func (_options *DeleteSparkEngineOptions) SetEngineID(engineID string) *DeleteSparkEngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *DeleteDb2EngineOptions) SetID(id string) *DeleteDb2EngineOptions { + _options.ID = core.StringPtr(id) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteSparkEngineOptions) SetAuthInstanceID(authInstanceID string) *DeleteSparkEngineOptions { +func (_options *DeleteDb2EngineOptions) SetAuthInstanceID(authInstanceID string) *DeleteDb2EngineOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *DeleteSparkEngineOptions) SetHeaders(param map[string]string) *DeleteSparkEngineOptions { +func (options *DeleteDb2EngineOptions) SetHeaders(param map[string]string) *DeleteDb2EngineOptions { options.Headers = param return options } -// DeleteTableOptions : The DeleteTable options. -type DeleteTableOptions struct { - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` - - // URL encoded schema name. - SchemaID *string `json:"schema_id" validate:"required,ne="` - - // URL encoded table name. - TableID *string `json:"table_id" validate:"required,ne="` - +// DeleteEngineOptions : The DeleteEngine options. +type DeleteEngineOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required"` - - // URL encoded table type. - Type *string `json:"type,omitempty"` + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewDeleteTableOptions : Instantiate DeleteTableOptions -func (*WatsonxDataV2) NewDeleteTableOptions(catalogID string, schemaID string, tableID string, engineID string) *DeleteTableOptions { - return &DeleteTableOptions{ - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - TableID: core.StringPtr(tableID), - EngineID: core.StringPtr(engineID), +// NewDeleteEngineOptions : Instantiate DeleteEngineOptions +func (*WatsonxDataV3) NewDeleteEngineOptions(id string) *DeleteEngineOptions { + return &DeleteEngineOptions{ + ID: core.StringPtr(id), } } -// SetCatalogID : Allow user to set CatalogID -func (_options *DeleteTableOptions) SetCatalogID(catalogID string) *DeleteTableOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetID : Allow user to set ID +func (_options *DeleteEngineOptions) SetID(id string) *DeleteEngineOptions { + _options.ID = core.StringPtr(id) return _options } -// SetSchemaID : Allow user to set SchemaID -func (_options *DeleteTableOptions) SetSchemaID(schemaID string) *DeleteTableOptions { - _options.SchemaID = core.StringPtr(schemaID) +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeleteEngineOptions) SetAuthInstanceID(authInstanceID string) *DeleteEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } -// SetTableID : Allow user to set TableID -func (_options *DeleteTableOptions) SetTableID(tableID string) *DeleteTableOptions { - _options.TableID = core.StringPtr(tableID) - return _options +// SetHeaders : Allow user to set Headers +func (options *DeleteEngineOptions) SetHeaders(param map[string]string) *DeleteEngineOptions { + options.Headers = param + return options } -// SetEngineID : Allow user to set EngineID -func (_options *DeleteTableOptions) SetEngineID(engineID string) *DeleteTableOptions { - _options.EngineID = core.StringPtr(engineID) - return _options +// DeleteIntegrationOptions : The DeleteIntegration options. +type DeleteIntegrationOptions struct { + // Unique id to identify the integration. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string } -// SetType : Allow user to set Type -func (_options *DeleteTableOptions) SetType(typeVar string) *DeleteTableOptions { - _options.Type = core.StringPtr(typeVar) +// NewDeleteIntegrationOptions : Instantiate DeleteIntegrationOptions +func (*WatsonxDataV3) NewDeleteIntegrationOptions(id string) *DeleteIntegrationOptions { + return &DeleteIntegrationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteIntegrationOptions) SetID(id string) *DeleteIntegrationOptions { + _options.ID = core.StringPtr(id) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *DeleteTableOptions) SetAuthInstanceID(authInstanceID string) *DeleteTableOptions { +func (_options *DeleteIntegrationOptions) SetAuthInstanceID(authInstanceID string) *DeleteIntegrationOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *DeleteTableOptions) SetHeaders(param map[string]string) *DeleteTableOptions { +func (options *DeleteIntegrationOptions) SetHeaders(param map[string]string) *DeleteIntegrationOptions { options.Headers = param return options } -// Details : Watsonx Instance Details. -type Details struct { - // ca certificate. - CaCertificate *string `json:"ca_certificate,omitempty"` - - // Dynamic dict. - DefaultConfigs map[string]string `json:"default_configs,omitempty"` - - // Details for the external component. - External *ExternalDetails `json:"external,omitempty"` +// DeleteMilvusServiceOptions : The DeleteMilvusService options. +type DeleteMilvusServiceOptions struct { + // id. + ID *string `json:"id" validate:"required,ne="` - // Details for the internal component. - GrpcApiEndpoint *InternalDetails `json:"grpc_api_endpoint,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // Instance Host name. - Hostname *string `json:"hostname,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string +} - // ID. - ID *string `json:"id,omitempty"` +// NewDeleteMilvusServiceOptions : Instantiate DeleteMilvusServiceOptions +func (*WatsonxDataV3) NewDeleteMilvusServiceOptions(id string) *DeleteMilvusServiceOptions { + return &DeleteMilvusServiceOptions{ + ID: core.StringPtr(id), + } +} - // instance CRN. - InstanceCrn *string `json:"instance_crn,omitempty"` +// SetID : Allow user to set ID +func (_options *DeleteMilvusServiceOptions) SetID(id string) *DeleteMilvusServiceOptions { + _options.ID = core.StringPtr(id) + return _options +} - // instance id. - InstanceID *string `json:"instance_id,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeleteMilvusServiceOptions) SetAuthInstanceID(authInstanceID string) *DeleteMilvusServiceOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // Details for the internal component. - Internal *InternalDetails `json:"internal,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *DeleteMilvusServiceOptions) SetHeaders(param map[string]string) *DeleteMilvusServiceOptions { + options.Headers = param + return options +} - // JDBC Class. - JdbcClass *string `json:"jdbc_class,omitempty"` +// DeleteNetezzaEngineOptions : The DeleteNetezzaEngine options. +type DeleteNetezzaEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // JDBC Thrift Urls. - JdbcUrls *JdbcThriftUrls `json:"jdbc_urls,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // engines services name. - Name *string `json:"name,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string +} - // Port. - Port *int64 `json:"port,omitempty"` +// NewDeleteNetezzaEngineOptions : Instantiate DeleteNetezzaEngineOptions +func (*WatsonxDataV3) NewDeleteNetezzaEngineOptions(id string) *DeleteNetezzaEngineOptions { + return &DeleteNetezzaEngineOptions{ + ID: core.StringPtr(id), + } +} - // Details for the internal component. - RestApiEndpoint *InternalDetails `json:"rest_api_endpoint,omitempty"` +// SetID : Allow user to set ID +func (_options *DeleteNetezzaEngineOptions) SetID(id string) *DeleteNetezzaEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} - // Spark Engine endpoint. - SparkEngineEndpoint *string `json:"spark_engine_endpoint,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeleteNetezzaEngineOptions) SetAuthInstanceID(authInstanceID string) *DeleteNetezzaEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // ssl certificate. - SslCertificate *string `json:"ssl_certificate,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *DeleteNetezzaEngineOptions) SetHeaders(param map[string]string) *DeleteNetezzaEngineOptions { + options.Headers = param + return options +} - // JDBC Thrift Urls. - ThriftUrls *JdbcThriftUrls `json:"thrift_urls,omitempty"` +// DeleteOtherEngineOptions : The DeleteOtherEngine options. +type DeleteOtherEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // engine version. - Version *string `json:"version,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // Watsonx data application endpoint. - WatsonxDataApplicationEndpoint *string `json:"watsonx_data_application_endpoint,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalDetails unmarshals an instance of Details from the specified map of raw messages. -func UnmarshalDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Details) - err = core.UnmarshalPrimitive(m, "ca_certificate", &obj.CaCertificate) - if err != nil { - err = core.SDKErrorf(err, "", "ca_certificate-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "default_configs", &obj.DefaultConfigs) - if err != nil { - err = core.SDKErrorf(err, "", "default_configs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "external", &obj.External, UnmarshalExternalDetails) - if err != nil { - err = core.SDKErrorf(err, "", "external-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "grpc_api_endpoint", &obj.GrpcApiEndpoint, UnmarshalInternalDetails) - if err != nil { - err = core.SDKErrorf(err, "", "grpc_api_endpoint-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) - if err != nil { - err = core.SDKErrorf(err, "", "hostname-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance_crn", &obj.InstanceCrn) - if err != nil { - err = core.SDKErrorf(err, "", "instance_crn-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) - if err != nil { - err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "internal", &obj.Internal, UnmarshalInternalDetails) - if err != nil { - err = core.SDKErrorf(err, "", "internal-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "jdbc_class", &obj.JdbcClass) - if err != nil { - err = core.SDKErrorf(err, "", "jdbc_class-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "jdbc_urls", &obj.JdbcUrls, UnmarshalJdbcThriftUrls) - if err != nil { - err = core.SDKErrorf(err, "", "jdbc_urls-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "rest_api_endpoint", &obj.RestApiEndpoint, UnmarshalInternalDetails) - if err != nil { - err = core.SDKErrorf(err, "", "rest_api_endpoint-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "spark_engine_endpoint", &obj.SparkEngineEndpoint) - if err != nil { - err = core.SDKErrorf(err, "", "spark_engine_endpoint-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "ssl_certificate", &obj.SslCertificate) - if err != nil { - err = core.SDKErrorf(err, "", "ssl_certificate-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "thrift_urls", &obj.ThriftUrls, UnmarshalJdbcThriftUrls) - if err != nil { - err = core.SDKErrorf(err, "", "thrift_urls-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) - if err != nil { - err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "watsonx_data_application_endpoint", &obj.WatsonxDataApplicationEndpoint) - if err != nil { - err = core.SDKErrorf(err, "", "watsonx_data_application_endpoint-error", common.GetComponentInfo()) - return +// NewDeleteOtherEngineOptions : Instantiate DeleteOtherEngineOptions +func (*WatsonxDataV3) NewDeleteOtherEngineOptions(id string) *DeleteOtherEngineOptions { + return &DeleteOtherEngineOptions{ + ID: core.StringPtr(id), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// DisplayNameInfoResponse : DisplayNameInfoResponse. -type DisplayNameInfoResponse struct { - // Display name. - DisplayName *string `json:"display_name" validate:"required"` +// SetID : Allow user to set ID +func (_options *DeleteOtherEngineOptions) SetID(id string) *DeleteOtherEngineOptions { + _options.ID = core.StringPtr(id) + return _options } -// UnmarshalDisplayNameInfoResponse unmarshals an instance of DisplayNameInfoResponse from the specified map of raw messages. -func UnmarshalDisplayNameInfoResponse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DisplayNameInfoResponse) - err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) - if err != nil { - err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeleteOtherEngineOptions) SetAuthInstanceID(authInstanceID string) *DeleteOtherEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options } -// Driver : Driver struct -type Driver struct { - // Connection type. - ConnectionType *string `json:"connection_type,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *DeleteOtherEngineOptions) SetHeaders(param map[string]string) *DeleteOtherEngineOptions { + options.Headers = param + return options +} - // Driver name. - DriverID *string `json:"driver_id,omitempty"` +// DeletePrestissimoEngineCatalogsOptions : The DeletePrestissimoEngineCatalogs options. +type DeletePrestissimoEngineCatalogsOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // Driver name. - DriverName *string `json:"driver_name,omitempty"` + // Catalog id(s) to be stopped, comma separated. + CatalogNames *string `json:"catalog_names" validate:"required"` - // Driver version. - DriverVersion *string `json:"driver_version,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalDriver unmarshals an instance of Driver from the specified map of raw messages. -func UnmarshalDriver(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Driver) - err = core.UnmarshalPrimitive(m, "connection_type", &obj.ConnectionType) - if err != nil { - err = core.SDKErrorf(err, "", "connection_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "driver_id", &obj.DriverID) - if err != nil { - err = core.SDKErrorf(err, "", "driver_id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "driver_name", &obj.DriverName) - if err != nil { - err = core.SDKErrorf(err, "", "driver_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "driver_version", &obj.DriverVersion) - if err != nil { - err = core.SDKErrorf(err, "", "driver_version-error", common.GetComponentInfo()) - return +// NewDeletePrestissimoEngineCatalogsOptions : Instantiate DeletePrestissimoEngineCatalogsOptions +func (*WatsonxDataV3) NewDeletePrestissimoEngineCatalogsOptions(id string, catalogNames string) *DeletePrestissimoEngineCatalogsOptions { + return &DeletePrestissimoEngineCatalogsOptions{ + ID: core.StringPtr(id), + CatalogNames: core.StringPtr(catalogNames), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// DriverRegistration : Driver registration. -type DriverRegistration struct { - // Associated engines. - AssociatedEngines []string `json:"associated_engines,omitempty"` - - // Driver connection type. - ConnectionType *string `json:"connection_type,omitempty"` +// SetID : Allow user to set ID +func (_options *DeletePrestissimoEngineCatalogsOptions) SetID(id string) *DeletePrestissimoEngineCatalogsOptions { + _options.ID = core.StringPtr(id) + return _options +} - // Driver ID auto generated during driver registration. - DriverID *string `json:"driver_id,omitempty"` +// SetCatalogNames : Allow user to set CatalogNames +func (_options *DeletePrestissimoEngineCatalogsOptions) SetCatalogNames(catalogNames string) *DeletePrestissimoEngineCatalogsOptions { + _options.CatalogNames = core.StringPtr(catalogNames) + return _options +} - // Driver name. - DriverName *string `json:"driver_name,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeletePrestissimoEngineCatalogsOptions) SetAuthInstanceID(authInstanceID string) *DeletePrestissimoEngineCatalogsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // Created on. - ModifiedAt *string `json:"modified_at,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *DeletePrestissimoEngineCatalogsOptions) SetHeaders(param map[string]string) *DeletePrestissimoEngineCatalogsOptions { + options.Headers = param + return options +} - // Created by. - ModifiedBy *string `json:"modified_by,omitempty"` +// DeletePrestissimoEngineOptions : The DeletePrestissimoEngine options. +type DeletePrestissimoEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // Driver status. - Status *string `json:"status,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // Driver version. - Version *string `json:"version,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalDriverRegistration unmarshals an instance of DriverRegistration from the specified map of raw messages. -func UnmarshalDriverRegistration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DriverRegistration) - err = core.UnmarshalPrimitive(m, "associated_engines", &obj.AssociatedEngines) - if err != nil { - err = core.SDKErrorf(err, "", "associated_engines-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "connection_type", &obj.ConnectionType) - if err != nil { - err = core.SDKErrorf(err, "", "connection_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "driver_id", &obj.DriverID) - if err != nil { - err = core.SDKErrorf(err, "", "driver_id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "driver_name", &obj.DriverName) - if err != nil { - err = core.SDKErrorf(err, "", "driver_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) - if err != nil { - err = core.SDKErrorf(err, "", "modified_at-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "modified_by", &obj.ModifiedBy) - if err != nil { - err = core.SDKErrorf(err, "", "modified_by-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) - if err != nil { - err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) - return +// NewDeletePrestissimoEngineOptions : Instantiate DeletePrestissimoEngineOptions +func (*WatsonxDataV3) NewDeletePrestissimoEngineOptions(id string) *DeletePrestissimoEngineOptions { + return &DeletePrestissimoEngineOptions{ + ID: core.StringPtr(id), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// DriverRegistrationCollection : list driver registrations. -type DriverRegistrationCollection struct { - // Driver collection body. - DriverRegistrations []DriverRegistration `json:"driver_registrations,omitempty"` +// SetID : Allow user to set ID +func (_options *DeletePrestissimoEngineOptions) SetID(id string) *DeletePrestissimoEngineOptions { + _options.ID = core.StringPtr(id) + return _options } -// UnmarshalDriverRegistrationCollection unmarshals an instance of DriverRegistrationCollection from the specified map of raw messages. -func UnmarshalDriverRegistrationCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DriverRegistrationCollection) - err = core.UnmarshalModel(m, "driver_registrations", &obj.DriverRegistrations, UnmarshalDriverRegistration) - if err != nil { - err = core.SDKErrorf(err, "", "driver_registrations-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeletePrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *DeletePrestissimoEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options } -// DriverRegistrationEngine : Engines associated to the driver. -type DriverRegistrationEngine struct { - // List of engine IDs. - Engines []string `json:"engines,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *DeletePrestissimoEngineOptions) SetHeaders(param map[string]string) *DeletePrestissimoEngineOptions { + options.Headers = param + return options } -// UnmarshalDriverRegistrationEngine unmarshals an instance of DriverRegistrationEngine from the specified map of raw messages. -func UnmarshalDriverRegistrationEngine(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DriverRegistrationEngine) - err = core.UnmarshalPrimitive(m, "engines", &obj.Engines) - if err != nil { - err = core.SDKErrorf(err, "", "engines-error", common.GetComponentInfo()) - return +// DeletePrestoEngineCatalogsOptions : The DeletePrestoEngineCatalogs options. +type DeletePrestoEngineCatalogsOptions struct { + // engine id. + EngineID *string `json:"engine_id" validate:"required,ne="` + + // Catalog id(s) to be stopped, comma separated. + CatalogNames *string `json:"catalog_names" validate:"required"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewDeletePrestoEngineCatalogsOptions : Instantiate DeletePrestoEngineCatalogsOptions +func (*WatsonxDataV3) NewDeletePrestoEngineCatalogsOptions(engineID string, catalogNames string) *DeletePrestoEngineCatalogsOptions { + return &DeletePrestoEngineCatalogsOptions{ + EngineID: core.StringPtr(engineID), + CatalogNames: core.StringPtr(catalogNames), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// DriverRegistrationEnginePrototype : Engines associated to the driver. -type DriverRegistrationEnginePrototype struct { - // List of engine IDs. - Engines []string `json:"engines,omitempty"` +// SetEngineID : Allow user to set EngineID +func (_options *DeletePrestoEngineCatalogsOptions) SetEngineID(engineID string) *DeletePrestoEngineCatalogsOptions { + _options.EngineID = core.StringPtr(engineID) + return _options } -// UnmarshalDriverRegistrationEnginePrototype unmarshals an instance of DriverRegistrationEnginePrototype from the specified map of raw messages. -func UnmarshalDriverRegistrationEnginePrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(DriverRegistrationEnginePrototype) - err = core.UnmarshalPrimitive(m, "engines", &obj.Engines) - if err != nil { - err = core.SDKErrorf(err, "", "engines-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetCatalogNames : Allow user to set CatalogNames +func (_options *DeletePrestoEngineCatalogsOptions) SetCatalogNames(catalogNames string) *DeletePrestoEngineCatalogsOptions { + _options.CatalogNames = core.StringPtr(catalogNames) + return _options } -// AsPatch returns a generic map representation of the DriverRegistrationEnginePrototype -func (driverRegistrationEnginePrototype *DriverRegistrationEnginePrototype) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(driverRegistrationEnginePrototype.Engines) { - _patch["engines"] = driverRegistrationEnginePrototype.Engines - } +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeletePrestoEngineCatalogsOptions) SetAuthInstanceID(authInstanceID string) *DeletePrestoEngineCatalogsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - return +// SetHeaders : Allow user to set Headers +func (options *DeletePrestoEngineCatalogsOptions) SetHeaders(param map[string]string) *DeletePrestoEngineCatalogsOptions { + options.Headers = param + return options } -// Endpoint : The service endpoint. -type Endpoint struct { - // The external host of the service. - ExternalHost *string `json:"external_host,omitempty"` +// DeleteSalIntegrationOptions : The DeleteSalIntegration options. +type DeleteSalIntegrationOptions struct { - // The service type. - ServiceType *string `json:"service_type,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalEndpoint unmarshals an instance of Endpoint from the specified map of raw messages. -func UnmarshalEndpoint(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Endpoint) - err = core.UnmarshalPrimitive(m, "external_host", &obj.ExternalHost) - if err != nil { - err = core.SDKErrorf(err, "", "external_host-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "service_type", &obj.ServiceType) - if err != nil { - err = core.SDKErrorf(err, "", "service_type-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// NewDeleteSalIntegrationOptions : Instantiate DeleteSalIntegrationOptions +func (*WatsonxDataV3) NewDeleteSalIntegrationOptions() *DeleteSalIntegrationOptions { + return &DeleteSalIntegrationOptions{} } -// EndpointCollection : List endpoints. -type EndpointCollection struct { - // List of the endpoints CPG and DAS. - Endpoints []Endpoint `json:"endpoints,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *DeleteSalIntegrationOptions) SetHeaders(param map[string]string) *DeleteSalIntegrationOptions { + options.Headers = param + return options } -// UnmarshalEndpointCollection unmarshals an instance of EndpointCollection from the specified map of raw messages. -func UnmarshalEndpointCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EndpointCollection) - err = core.UnmarshalModel(m, "endpoints", &obj.Endpoints, UnmarshalEndpoint) - if err != nil { - err = core.SDKErrorf(err, "", "endpoints-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// DeleteSalMetadataOptions : The DeleteSalMetadata options. +type DeleteSalMetadataOptions struct { + + // Allows users to set headers on API requests. + Headers map[string]string } -// EngineDetailsBody : Node details. -type EngineDetailsBody struct { - // api key to work with the saas IAE instance. - ApiKey *string `json:"api_key,omitempty"` +// NewDeleteSalMetadataOptions : Instantiate DeleteSalMetadataOptions +func (*WatsonxDataV3) NewDeleteSalMetadataOptions() *DeleteSalMetadataOptions { + return &DeleteSalMetadataOptions{} +} - // External engine connection string. - ConnectionString *string `json:"connection_string,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *DeleteSalMetadataOptions) SetHeaders(param map[string]string) *DeleteSalMetadataOptions { + options.Headers = param + return options +} - // coordinator/worker property settings. - Coordinator *NodeDescriptionBody `json:"coordinator,omitempty"` +// DeleteSchemaOptions : The DeleteSchema options. +type DeleteSchemaOptions struct { + // Engine id of presto/prestissimo/spark/db2/netezza other engine. + EngineID *string `json:"engine_id" validate:"required"` - // Instance to access the instance. - InstanceID *string `json:"instance_id,omitempty"` + // Catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` - // How is the spark instance managed. - ManagedBy *string `json:"managed_by,omitempty"` + // URL encoded Schema name. + SchemaName *string `json:"schema_name" validate:"required,ne="` - // For presto and prestissimo engines, CPD supported sizes are: custom, starter, small, medium, large, xlarge, and - // xxlarge. IBM cloud supported sizes are: custom, starter, small, medium, large, cache_optimized, compute_optimized - // and lite. - SizeConfig *string `json:"size_config,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // coordinator/worker property settings. - Worker *NodeDescriptionBody `json:"worker,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string } -// Constants associated with the EngineDetailsBody.SizeConfig property. -// For presto and prestissimo engines, CPD supported sizes are: custom, starter, small, medium, large, xlarge, and -// xxlarge. IBM cloud supported sizes are: custom, starter, small, medium, large, cache_optimized, compute_optimized and -// lite. -const ( - EngineDetailsBody_SizeConfig_CacheOptimized = "cache_optimized" - EngineDetailsBody_SizeConfig_ComputeOptimized = "compute_optimized" - EngineDetailsBody_SizeConfig_Custom = "custom" - EngineDetailsBody_SizeConfig_Large = "large" - EngineDetailsBody_SizeConfig_Medium = "medium" - EngineDetailsBody_SizeConfig_Small = "small" - EngineDetailsBody_SizeConfig_Starter = "starter" -) - -// UnmarshalEngineDetailsBody unmarshals an instance of EngineDetailsBody from the specified map of raw messages. -func UnmarshalEngineDetailsBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EngineDetailsBody) - err = core.UnmarshalPrimitive(m, "api_key", &obj.ApiKey) - if err != nil { - err = core.SDKErrorf(err, "", "api_key-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) - if err != nil { - err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "coordinator", &obj.Coordinator, UnmarshalNodeDescriptionBody) - if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) - if err != nil { - err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) - if err != nil { - err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "size_config", &obj.SizeConfig) - if err != nil { - err = core.SDKErrorf(err, "", "size_config-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "worker", &obj.Worker, UnmarshalNodeDescriptionBody) - if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) - return +// NewDeleteSchemaOptions : Instantiate DeleteSchemaOptions +func (*WatsonxDataV3) NewDeleteSchemaOptions(engineID string, catalogName string, schemaName string) *DeleteSchemaOptions { + return &DeleteSchemaOptions{ + EngineID: core.StringPtr(engineID), + CatalogName: core.StringPtr(catalogName), + SchemaName: core.StringPtr(schemaName), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// EnginePropertiesCatalog : Catalog settings. -type EnginePropertiesCatalog struct { - // Coordinator/ worker properties. - Coordinator map[string]string `json:"coordinator,omitempty"` - - // Coordinator/ worker properties. - Worker map[string]string `json:"worker,omitempty"` +// SetEngineID : Allow user to set EngineID +func (_options *DeleteSchemaOptions) SetEngineID(engineID string) *DeleteSchemaOptions { + _options.EngineID = core.StringPtr(engineID) + return _options } -// UnmarshalEnginePropertiesCatalog unmarshals an instance of EnginePropertiesCatalog from the specified map of raw messages. -func UnmarshalEnginePropertiesCatalog(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EnginePropertiesCatalog) - err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) - if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) - if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetCatalogName : Allow user to set CatalogName +func (_options *DeleteSchemaOptions) SetCatalogName(catalogName string) *DeleteSchemaOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options } -// asPatch returns a generic map representation of the EnginePropertiesCatalog -func (enginePropertiesCatalog *EnginePropertiesCatalog) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(enginePropertiesCatalog.Coordinator) { - _patch["coordinator"] = enginePropertiesCatalog.Coordinator - } - if !core.IsNil(enginePropertiesCatalog.Worker) { - _patch["worker"] = enginePropertiesCatalog.Worker - } +// SetSchemaName : Allow user to set SchemaName +func (_options *DeleteSchemaOptions) SetSchemaName(schemaName string) *DeleteSchemaOptions { + _options.SchemaName = core.StringPtr(schemaName) + return _options +} - return +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeleteSchemaOptions) SetAuthInstanceID(authInstanceID string) *DeleteSchemaOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options } -// EnginePropertiesLogConfiguration : Log Configuration settings. -type EnginePropertiesLogConfiguration struct { - // Coordinator/ worker properties. - Coordinator map[string]string `json:"coordinator,omitempty"` - - // Coordinator/ worker properties. - Worker map[string]string `json:"worker,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *DeleteSchemaOptions) SetHeaders(param map[string]string) *DeleteSchemaOptions { + options.Headers = param + return options } -// UnmarshalEnginePropertiesLogConfiguration unmarshals an instance of EnginePropertiesLogConfiguration from the specified map of raw messages. -func UnmarshalEnginePropertiesLogConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EnginePropertiesLogConfiguration) - err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) - if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) - if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// DeleteSemanticSearchQueriesByIdOptions : The DeleteSemanticSearchQueriesByID options. +type DeleteSemanticSearchQueriesByIdOptions struct { + // id of the semanric search query record. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string } -// asPatch returns a generic map representation of the EnginePropertiesLogConfiguration -func (enginePropertiesLogConfiguration *EnginePropertiesLogConfiguration) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(enginePropertiesLogConfiguration.Coordinator) { - _patch["coordinator"] = enginePropertiesLogConfiguration.Coordinator - } - if !core.IsNil(enginePropertiesLogConfiguration.Worker) { - _patch["worker"] = enginePropertiesLogConfiguration.Worker +// NewDeleteSemanticSearchQueriesByIdOptions : Instantiate DeleteSemanticSearchQueriesByIdOptions +func (*WatsonxDataV3) NewDeleteSemanticSearchQueriesByIdOptions(id string) *DeleteSemanticSearchQueriesByIdOptions { + return &DeleteSemanticSearchQueriesByIdOptions{ + ID: core.StringPtr(id), } +} - return +// SetID : Allow user to set ID +func (_options *DeleteSemanticSearchQueriesByIdOptions) SetID(id string) *DeleteSemanticSearchQueriesByIdOptions { + _options.ID = core.StringPtr(id) + return _options } -// EnginePropertiesOaiGen1Configuration : Configuration settings. -type EnginePropertiesOaiGen1Configuration struct { - // Coordinator/ worker properties. - Coordinator map[string]string `json:"coordinator,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeleteSemanticSearchQueriesByIdOptions) SetAuthInstanceID(authInstanceID string) *DeleteSemanticSearchQueriesByIdOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // Coordinator/ worker properties. - Worker map[string]string `json:"worker,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *DeleteSemanticSearchQueriesByIdOptions) SetHeaders(param map[string]string) *DeleteSemanticSearchQueriesByIdOptions { + options.Headers = param + return options } -// UnmarshalEnginePropertiesOaiGen1Configuration unmarshals an instance of EnginePropertiesOaiGen1Configuration from the specified map of raw messages. -func UnmarshalEnginePropertiesOaiGen1Configuration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EnginePropertiesOaiGen1Configuration) - err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) - if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) - if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// DeleteSemanticSearchQueriesOptions : The DeleteSemanticSearchQueries options. +type DeleteSemanticSearchQueriesOptions struct { + // max number to queries to be deleted (most recent to least), if no number provided all queries history will be clear. + BatchSize *int64 `json:"batch_size,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string } -// asPatch returns a generic map representation of the EnginePropertiesOaiGen1Configuration -func (enginePropertiesOaiGen1Configuration *EnginePropertiesOaiGen1Configuration) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(enginePropertiesOaiGen1Configuration.Coordinator) { - _patch["coordinator"] = enginePropertiesOaiGen1Configuration.Coordinator - } - if !core.IsNil(enginePropertiesOaiGen1Configuration.Worker) { - _patch["worker"] = enginePropertiesOaiGen1Configuration.Worker - } +// NewDeleteSemanticSearchQueriesOptions : Instantiate DeleteSemanticSearchQueriesOptions +func (*WatsonxDataV3) NewDeleteSemanticSearchQueriesOptions() *DeleteSemanticSearchQueriesOptions { + return &DeleteSemanticSearchQueriesOptions{} +} - return +// SetBatchSize : Allow user to set BatchSize +func (_options *DeleteSemanticSearchQueriesOptions) SetBatchSize(batchSize int64) *DeleteSemanticSearchQueriesOptions { + _options.BatchSize = core.Int64Ptr(batchSize) + return _options } -// EnginePropertiesOaiGen1Jvm : JVM settings. -type EnginePropertiesOaiGen1Jvm struct { - // Coordinator/ worker properties. - Coordinator map[string]string `json:"coordinator,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeleteSemanticSearchQueriesOptions) SetAuthInstanceID(authInstanceID string) *DeleteSemanticSearchQueriesOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // Coordinator/ worker properties. - Worker map[string]string `json:"worker,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *DeleteSemanticSearchQueriesOptions) SetHeaders(param map[string]string) *DeleteSemanticSearchQueriesOptions { + options.Headers = param + return options } -// UnmarshalEnginePropertiesOaiGen1Jvm unmarshals an instance of EnginePropertiesOaiGen1Jvm from the specified map of raw messages. -func UnmarshalEnginePropertiesOaiGen1Jvm(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EnginePropertiesOaiGen1Jvm) - err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) - if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) - if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// DeleteSparkEngineApplicationOptions : The DeleteSparkEngineApplication options. +type DeleteSparkEngineApplicationOptions struct { + // engine id. + EngineID *string `json:"engine_id" validate:"required,ne="` + + // Application id. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string } -// asPatch returns a generic map representation of the EnginePropertiesOaiGen1Jvm -func (enginePropertiesOaiGen1Jvm *EnginePropertiesOaiGen1Jvm) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(enginePropertiesOaiGen1Jvm.Coordinator) { - _patch["coordinator"] = enginePropertiesOaiGen1Jvm.Coordinator - } - if !core.IsNil(enginePropertiesOaiGen1Jvm.Worker) { - _patch["worker"] = enginePropertiesOaiGen1Jvm.Worker +// NewDeleteSparkEngineApplicationOptions : Instantiate DeleteSparkEngineApplicationOptions +func (*WatsonxDataV3) NewDeleteSparkEngineApplicationOptions(engineID string, id string) *DeleteSparkEngineApplicationOptions { + return &DeleteSparkEngineApplicationOptions{ + EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), } +} - return +// SetEngineID : Allow user to set EngineID +func (_options *DeleteSparkEngineApplicationOptions) SetEngineID(engineID string) *DeleteSparkEngineApplicationOptions { + _options.EngineID = core.StringPtr(engineID) + return _options } -// EnginePropertiesOaiGenConfiguration : Configuration settings for the engine properties. -type EnginePropertiesOaiGenConfiguration struct { - // coordinator/worker property settings. - Coordinator *PrestissimoNodeDescriptionBody `json:"coordinator,omitempty"` +// SetID : Allow user to set ID +func (_options *DeleteSparkEngineApplicationOptions) SetID(id string) *DeleteSparkEngineApplicationOptions { + _options.ID = core.StringPtr(id) + return _options +} - // coordinator/worker property settings. - Worker *PrestissimoNodeDescriptionBody `json:"worker,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeleteSparkEngineApplicationOptions) SetAuthInstanceID(authInstanceID string) *DeleteSparkEngineApplicationOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options } -// UnmarshalEnginePropertiesOaiGenConfiguration unmarshals an instance of EnginePropertiesOaiGenConfiguration from the specified map of raw messages. -func UnmarshalEnginePropertiesOaiGenConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EnginePropertiesOaiGenConfiguration) - err = core.UnmarshalModel(m, "coordinator", &obj.Coordinator, UnmarshalPrestissimoNodeDescriptionBody) - if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "worker", &obj.Worker, UnmarshalPrestissimoNodeDescriptionBody) - if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetHeaders : Allow user to set Headers +func (options *DeleteSparkEngineApplicationOptions) SetHeaders(param map[string]string) *DeleteSparkEngineApplicationOptions { + options.Headers = param + return options } -// asPatch returns a generic map representation of the EnginePropertiesOaiGenConfiguration -func (enginePropertiesOaiGenConfiguration *EnginePropertiesOaiGenConfiguration) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(enginePropertiesOaiGenConfiguration.Coordinator) { - _patch["coordinator"] = enginePropertiesOaiGenConfiguration.Coordinator.asPatch() - } - if !core.IsNil(enginePropertiesOaiGenConfiguration.Worker) { - _patch["worker"] = enginePropertiesOaiGenConfiguration.Worker.asPatch() - } +// DeleteSparkEngineCatalogsOptions : The DeleteSparkEngineCatalogs options. +type DeleteSparkEngineCatalogsOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - return -} + // Catalog id(s) to be stopped, comma separated. + CatalogNames *string `json:"catalog_names" validate:"required"` -// EngineServiceDetailsCollection : engine service detail collection. -type EngineServiceDetailsCollection struct { - // Engine service details. - Details []Details `json:"details,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // Engine service type. - Type *string `json:"type,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalEngineServiceDetailsCollection unmarshals an instance of EngineServiceDetailsCollection from the specified map of raw messages. -func UnmarshalEngineServiceDetailsCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EngineServiceDetailsCollection) - err = core.UnmarshalModel(m, "details", &obj.Details, UnmarshalDetails) - if err != nil { - err = core.SDKErrorf(err, "", "details-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) - if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return +// NewDeleteSparkEngineCatalogsOptions : Instantiate DeleteSparkEngineCatalogsOptions +func (*WatsonxDataV3) NewDeleteSparkEngineCatalogsOptions(id string, catalogNames string) *DeleteSparkEngineCatalogsOptions { + return &DeleteSparkEngineCatalogsOptions{ + ID: core.StringPtr(id), + CatalogNames: core.StringPtr(catalogNames), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// EnginesServicesDetails : Engine service details. -type EnginesServicesDetails struct { - EnginesServices []ConnectionPropertiesDetails `json:"engines_services,omitempty"` +// SetID : Allow user to set ID +func (_options *DeleteSparkEngineCatalogsOptions) SetID(id string) *DeleteSparkEngineCatalogsOptions { + _options.ID = core.StringPtr(id) + return _options } -// UnmarshalEnginesServicesDetails unmarshals an instance of EnginesServicesDetails from the specified map of raw messages. -func UnmarshalEnginesServicesDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EnginesServicesDetails) - err = core.UnmarshalModel(m, "engines_services", &obj.EnginesServices, UnmarshalConnectionPropertiesDetails) - if err != nil { - err = core.SDKErrorf(err, "", "engines_services-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetCatalogNames : Allow user to set CatalogNames +func (_options *DeleteSparkEngineCatalogsOptions) SetCatalogNames(catalogNames string) *DeleteSparkEngineCatalogsOptions { + _options.CatalogNames = core.StringPtr(catalogNames) + return _options } -// EnrichmentAsset : Encrichment asset. -type EnrichmentAsset struct { - // schema name. - AssetAttributes []string `json:"asset_attributes,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeleteSparkEngineCatalogsOptions) SetAuthInstanceID(authInstanceID string) *DeleteSparkEngineCatalogsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // data asset id. - AssetID *string `json:"asset_id,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *DeleteSparkEngineCatalogsOptions) SetHeaders(param map[string]string) *DeleteSparkEngineCatalogsOptions { + options.Headers = param + return options +} - // asset name. - AssetName *string `json:"asset_name,omitempty"` +// DeleteSparkEngineHistoryServerOptions : The DeleteSparkEngineHistoryServer options. +type DeleteSparkEngineHistoryServerOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // resource name. - ResourceKey *string `json:"resource_key,omitempty"` + // watsonx.data instance ID. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // schema. - SchemaName *string `json:"schema_name,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalEnrichmentAsset unmarshals an instance of EnrichmentAsset from the specified map of raw messages. -func UnmarshalEnrichmentAsset(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EnrichmentAsset) - err = core.UnmarshalPrimitive(m, "asset_attributes", &obj.AssetAttributes) - if err != nil { - err = core.SDKErrorf(err, "", "asset_attributes-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "asset_id", &obj.AssetID) - if err != nil { - err = core.SDKErrorf(err, "", "asset_id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "asset_name", &obj.AssetName) - if err != nil { - err = core.SDKErrorf(err, "", "asset_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "resource_key", &obj.ResourceKey) - if err != nil { - err = core.SDKErrorf(err, "", "resource_key-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "schema_name", &obj.SchemaName) - if err != nil { - err = core.SDKErrorf(err, "", "schema_name-error", common.GetComponentInfo()) - return +// NewDeleteSparkEngineHistoryServerOptions : Instantiate DeleteSparkEngineHistoryServerOptions +func (*WatsonxDataV3) NewDeleteSparkEngineHistoryServerOptions(id string) *DeleteSparkEngineHistoryServerOptions { + return &DeleteSparkEngineHistoryServerOptions{ + ID: core.StringPtr(id), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// EnrichmentObj : Encrichment api object. -type EnrichmentObj struct { - // catalog name. - Catalog *string `json:"catalog" validate:"required"` - - // operation type. - Operation *string `json:"operation" validate:"required"` - - // schema name. - Schema *string `json:"schema" validate:"required"` +// SetID : Allow user to set ID +func (_options *DeleteSparkEngineHistoryServerOptions) SetID(id string) *DeleteSparkEngineHistoryServerOptions { + _options.ID = core.StringPtr(id) + return _options +} - // schema name. - Tables []string `json:"tables,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeleteSparkEngineHistoryServerOptions) SetAuthInstanceID(authInstanceID string) *DeleteSparkEngineHistoryServerOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options } -// NewEnrichmentObj : Instantiate EnrichmentObj (Generic Model Constructor) -func (*WatsonxDataV2) NewEnrichmentObj(catalog string, operation string, schema string) (_model *EnrichmentObj, err error) { - _model = &EnrichmentObj{ - Catalog: core.StringPtr(catalog), - Operation: core.StringPtr(operation), - Schema: core.StringPtr(schema), - } - err = core.ValidateStruct(_model, "required parameters") - if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) - } - return +// SetHeaders : Allow user to set Headers +func (options *DeleteSparkEngineHistoryServerOptions) SetHeaders(param map[string]string) *DeleteSparkEngineHistoryServerOptions { + options.Headers = param + return options } -// UnmarshalEnrichmentObj unmarshals an instance of EnrichmentObj from the specified map of raw messages. -func UnmarshalEnrichmentObj(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(EnrichmentObj) - err = core.UnmarshalPrimitive(m, "catalog", &obj.Catalog) - if err != nil { - err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "operation", &obj.Operation) - if err != nil { - err = core.SDKErrorf(err, "", "operation-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "schema", &obj.Schema) - if err != nil { - err = core.SDKErrorf(err, "", "schema-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "tables", &obj.Tables) - if err != nil { - err = core.SDKErrorf(err, "", "tables-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ErrorObj : integration error object. -type ErrorObj struct { - // error code. - Code *string `json:"code,omitempty"` - - // error message. - Message *string `json:"message,omitempty"` -} - -// UnmarshalErrorObj unmarshals an instance of ErrorObj from the specified map of raw messages. -func UnmarshalErrorObj(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ErrorObj) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) - if err != nil { - err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ExecuteQueryCreatedBody : success response. -type ExecuteQueryCreatedBody struct { - // ResultExecuteQuery OK. - Response *ResultExecuteQuery `json:"response,omitempty"` -} - -// UnmarshalExecuteQueryCreatedBody unmarshals an instance of ExecuteQueryCreatedBody from the specified map of raw messages. -func UnmarshalExecuteQueryCreatedBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ExecuteQueryCreatedBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalResultExecuteQuery) - if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ExternalDetails : Details for the external component. -type ExternalDetails struct { - // Port. - Port *int64 `json:"port,omitempty"` - - // External Host name. - Hostname *string `json:"hostname,omitempty"` -} - -// UnmarshalExternalDetails unmarshals an instance of ExternalDetails from the specified map of raw messages. -func UnmarshalExternalDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ExternalDetails) - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) - if err != nil { - err = core.SDKErrorf(err, "", "hostname-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// GetAllColumnsOptions : The GetAllColumns options. -type GetAllColumnsOptions struct { - // Table name. - TableName *string `json:"table_name,omitempty"` - - // Catalog name. - CatalogName *string `json:"catalog_name,omitempty"` - - // Schema name. - SchemaName *string `json:"schema_name,omitempty"` +// DeleteSparkEngineOptions : The DeleteSparkEngine options. +type DeleteSparkEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetAllColumnsOptions : Instantiate GetAllColumnsOptions -func (*WatsonxDataV2) NewGetAllColumnsOptions() *GetAllColumnsOptions { - return &GetAllColumnsOptions{} -} - -// SetTableName : Allow user to set TableName -func (_options *GetAllColumnsOptions) SetTableName(tableName string) *GetAllColumnsOptions { - _options.TableName = core.StringPtr(tableName) - return _options -} - -// SetCatalogName : Allow user to set CatalogName -func (_options *GetAllColumnsOptions) SetCatalogName(catalogName string) *GetAllColumnsOptions { - _options.CatalogName = core.StringPtr(catalogName) - return _options +// NewDeleteSparkEngineOptions : Instantiate DeleteSparkEngineOptions +func (*WatsonxDataV3) NewDeleteSparkEngineOptions(id string) *DeleteSparkEngineOptions { + return &DeleteSparkEngineOptions{ + ID: core.StringPtr(id), + } } -// SetSchemaName : Allow user to set SchemaName -func (_options *GetAllColumnsOptions) SetSchemaName(schemaName string) *GetAllColumnsOptions { - _options.SchemaName = core.StringPtr(schemaName) +// SetID : Allow user to set ID +func (_options *DeleteSparkEngineOptions) SetID(id string) *DeleteSparkEngineOptions { + _options.ID = core.StringPtr(id) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetAllColumnsOptions) SetAuthInstanceID(authInstanceID string) *GetAllColumnsOptions { +func (_options *DeleteSparkEngineOptions) SetAuthInstanceID(authInstanceID string) *DeleteSparkEngineOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetAllColumnsOptions) SetHeaders(param map[string]string) *GetAllColumnsOptions { +func (options *DeleteSparkEngineOptions) SetHeaders(param map[string]string) *DeleteSparkEngineOptions { options.Headers = param return options } -// GetBucketObjectPropertiesOptions : The GetBucketObjectProperties options. -type GetBucketObjectPropertiesOptions struct { - // bucket id. - BucketID *string `json:"bucket_id" validate:"required,ne="` - - // bucket object size. - Paths []Path `json:"paths,omitempty"` +// DeleteStorageRegistrationOptions : The DeleteStorageRegistration options. +type DeleteStorageRegistrationOptions struct { + // storage id. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Skip MDS call when Unity catalog is added. + SkipMdsCall *bool `json:"skip_mds_call,omitempty"` + // Allows users to set headers on API requests. Headers map[string]string } -// NewGetBucketObjectPropertiesOptions : Instantiate GetBucketObjectPropertiesOptions -func (*WatsonxDataV2) NewGetBucketObjectPropertiesOptions(bucketID string) *GetBucketObjectPropertiesOptions { - return &GetBucketObjectPropertiesOptions{ - BucketID: core.StringPtr(bucketID), +// NewDeleteStorageRegistrationOptions : Instantiate DeleteStorageRegistrationOptions +func (*WatsonxDataV3) NewDeleteStorageRegistrationOptions(id string) *DeleteStorageRegistrationOptions { + return &DeleteStorageRegistrationOptions{ + ID: core.StringPtr(id), } } -// SetBucketID : Allow user to set BucketID -func (_options *GetBucketObjectPropertiesOptions) SetBucketID(bucketID string) *GetBucketObjectPropertiesOptions { - _options.BucketID = core.StringPtr(bucketID) +// SetID : Allow user to set ID +func (_options *DeleteStorageRegistrationOptions) SetID(id string) *DeleteStorageRegistrationOptions { + _options.ID = core.StringPtr(id) return _options } -// SetPaths : Allow user to set Paths -func (_options *GetBucketObjectPropertiesOptions) SetPaths(paths []Path) *GetBucketObjectPropertiesOptions { - _options.Paths = paths +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *DeleteStorageRegistrationOptions) SetAuthInstanceID(authInstanceID string) *DeleteStorageRegistrationOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetBucketObjectPropertiesOptions) SetAuthInstanceID(authInstanceID string) *GetBucketObjectPropertiesOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) +// SetSkipMdsCall : Allow user to set SkipMdsCall +func (_options *DeleteStorageRegistrationOptions) SetSkipMdsCall(skipMdsCall bool) *DeleteStorageRegistrationOptions { + _options.SkipMdsCall = core.BoolPtr(skipMdsCall) return _options } // SetHeaders : Allow user to set Headers -func (options *GetBucketObjectPropertiesOptions) SetHeaders(param map[string]string) *GetBucketObjectPropertiesOptions { +func (options *DeleteStorageRegistrationOptions) SetHeaders(param map[string]string) *DeleteStorageRegistrationOptions { options.Headers = param return options } -// GetBucketRegistrationOptions : The GetBucketRegistration options. -type GetBucketRegistrationOptions struct { - // bucket id. - BucketID *string `json:"bucket_id" validate:"required,ne="` +// DeleteTableOptions : The DeleteTable options. +type DeleteTableOptions struct { + // catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` + + // URL encoded schema name. + SchemaName *string `json:"schema_name" validate:"required,ne="` + + // URL encoded table name. + TableName *string `json:"table_name" validate:"required,ne="` + + // Engine id of presto/prestissimo/spark/db2/netezza other engine. + EngineID *string `json:"engine_id" validate:"required"` + + // URL encoded table type (view,base table). + Type *string `json:"type,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetBucketRegistrationOptions : Instantiate GetBucketRegistrationOptions -func (*WatsonxDataV2) NewGetBucketRegistrationOptions(bucketID string) *GetBucketRegistrationOptions { - return &GetBucketRegistrationOptions{ - BucketID: core.StringPtr(bucketID), +// NewDeleteTableOptions : Instantiate DeleteTableOptions +func (*WatsonxDataV3) NewDeleteTableOptions(catalogName string, schemaName string, tableName string, engineID string) *DeleteTableOptions { + return &DeleteTableOptions{ + CatalogName: core.StringPtr(catalogName), + SchemaName: core.StringPtr(schemaName), + TableName: core.StringPtr(tableName), + EngineID: core.StringPtr(engineID), } } -// SetBucketID : Allow user to set BucketID -func (_options *GetBucketRegistrationOptions) SetBucketID(bucketID string) *GetBucketRegistrationOptions { - _options.BucketID = core.StringPtr(bucketID) +// SetCatalogName : Allow user to set CatalogName +func (_options *DeleteTableOptions) SetCatalogName(catalogName string) *DeleteTableOptions { + _options.CatalogName = core.StringPtr(catalogName) return _options } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetBucketRegistrationOptions) SetAuthInstanceID(authInstanceID string) *GetBucketRegistrationOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) +// SetSchemaName : Allow user to set SchemaName +func (_options *DeleteTableOptions) SetSchemaName(schemaName string) *DeleteTableOptions { + _options.SchemaName = core.StringPtr(schemaName) return _options } -// SetHeaders : Allow user to set Headers -func (options *GetBucketRegistrationOptions) SetHeaders(param map[string]string) *GetBucketRegistrationOptions { - options.Headers = param - return options -} - -// GetCatalogOptions : The GetCatalog options. -type GetCatalogOptions struct { - // catalog ID. - CatalogID *string `json:"catalog_id" validate:"required,ne="` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string +// SetTableName : Allow user to set TableName +func (_options *DeleteTableOptions) SetTableName(tableName string) *DeleteTableOptions { + _options.TableName = core.StringPtr(tableName) + return _options } -// NewGetCatalogOptions : Instantiate GetCatalogOptions -func (*WatsonxDataV2) NewGetCatalogOptions(catalogID string) *GetCatalogOptions { - return &GetCatalogOptions{ - CatalogID: core.StringPtr(catalogID), - } +// SetEngineID : Allow user to set EngineID +func (_options *DeleteTableOptions) SetEngineID(engineID string) *DeleteTableOptions { + _options.EngineID = core.StringPtr(engineID) + return _options } -// SetCatalogID : Allow user to set CatalogID -func (_options *GetCatalogOptions) SetCatalogID(catalogID string) *GetCatalogOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetType : Allow user to set Type +func (_options *DeleteTableOptions) SetType(typeVar string) *DeleteTableOptions { + _options.Type = core.StringPtr(typeVar) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetCatalogOptions) SetAuthInstanceID(authInstanceID string) *GetCatalogOptions { +func (_options *DeleteTableOptions) SetAuthInstanceID(authInstanceID string) *DeleteTableOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetCatalogOptions) SetHeaders(param map[string]string) *GetCatalogOptions { +func (options *DeleteTableOptions) SetHeaders(param map[string]string) *DeleteTableOptions { options.Headers = param return options } -// GetDatabaseOptions : The GetDatabase options. -type GetDatabaseOptions struct { - // database id. - DatabaseID *string `json:"database_id" validate:"required,ne="` +// Driver : Driver struct +type Driver struct { + // Connection type. + ConnectionType *string `json:"connection_type,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Driver name. + DriverID *string `json:"driver_id,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // Driver name. + DriverName *string `json:"driver_name,omitempty"` + + // Driver version. + DriverVersion *string `json:"driver_version,omitempty"` } -// NewGetDatabaseOptions : Instantiate GetDatabaseOptions -func (*WatsonxDataV2) NewGetDatabaseOptions(databaseID string) *GetDatabaseOptions { - return &GetDatabaseOptions{ - DatabaseID: core.StringPtr(databaseID), +// UnmarshalDriver unmarshals an instance of Driver from the specified map of raw messages. +func UnmarshalDriver(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Driver) + err = core.UnmarshalPrimitive(m, "connection_type", &obj.ConnectionType) + if err != nil { + err = core.SDKErrorf(err, "", "connection_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "driver_id", &obj.DriverID) + if err != nil { + err = core.SDKErrorf(err, "", "driver_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "driver_name", &obj.DriverName) + if err != nil { + err = core.SDKErrorf(err, "", "driver_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "driver_version", &obj.DriverVersion) + if err != nil { + err = core.SDKErrorf(err, "", "driver_version-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetDatabaseID : Allow user to set DatabaseID -func (_options *GetDatabaseOptions) SetDatabaseID(databaseID string) *GetDatabaseOptions { - _options.DatabaseID = core.StringPtr(databaseID) - return _options -} +// EngineDetails : Engine configuration details. +type EngineDetails struct { + // Presto engine configurations. + Coordinator *CoordinatorNodeDescriptionBody `json:"coordinator" validate:"required"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetDatabaseOptions) SetAuthInstanceID(authInstanceID string) *GetDatabaseOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} + // CPD supported sizes are: custom, starter, small, medium, large, xlarge, and xxlarge. IBM cloud supported sizes are: + // custom, starter, small, medium, large, cache_optimized, compute_optimized and lite. + SizeConfig *string `json:"size_config" validate:"required"` -// SetHeaders : Allow user to set Headers -func (options *GetDatabaseOptions) SetHeaders(param map[string]string) *GetDatabaseOptions { - options.Headers = param - return options -} + // Presto engine configurations. + Worker *WorkerNodeDescriptionBody `json:"worker" validate:"required"` -// GetEndpointsOptions : The GetEndpoints options. -type GetEndpointsOptions struct { - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Enable autoscaling for the engine. + AutoscalingEnabled *bool `json:"autoscaling_enabled,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // Autoscaling configuration for the engine. + AutoscalingConfig *AutoscalingConfig `json:"autoscaling_config,omitempty"` } -// NewGetEndpointsOptions : Instantiate GetEndpointsOptions -func (*WatsonxDataV2) NewGetEndpointsOptions() *GetEndpointsOptions { - return &GetEndpointsOptions{} +// NewEngineDetails : Instantiate EngineDetails (Generic Model Constructor) +func (*WatsonxDataV3) NewEngineDetails(coordinator *CoordinatorNodeDescriptionBody, sizeConfig string, worker *WorkerNodeDescriptionBody) (_model *EngineDetails, err error) { + _model = &EngineDetails{ + Coordinator: coordinator, + SizeConfig: core.StringPtr(sizeConfig), + Worker: worker, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetEndpointsOptions) SetAuthInstanceID(authInstanceID string) *GetEndpointsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options +// UnmarshalEngineDetails unmarshals an instance of EngineDetails from the specified map of raw messages. +func UnmarshalEngineDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EngineDetails) + err = core.UnmarshalModel(m, "coordinator", &obj.Coordinator, UnmarshalCoordinatorNodeDescriptionBody) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "size_config", &obj.SizeConfig) + if err != nil { + err = core.SDKErrorf(err, "", "size_config-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "worker", &obj.Worker, UnmarshalWorkerNodeDescriptionBody) + if err != nil { + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "autoscaling_enabled", &obj.AutoscalingEnabled) + if err != nil { + err = core.SDKErrorf(err, "", "autoscaling_enabled-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "autoscaling_config", &obj.AutoscalingConfig, UnmarshalAutoscalingConfig) + if err != nil { + err = core.SDKErrorf(err, "", "autoscaling_config-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetHeaders : Allow user to set Headers -func (options *GetEndpointsOptions) SetHeaders(param map[string]string) *GetEndpointsOptions { - options.Headers = param - return options -} +// EngineProperties : Engine properties. +type EngineProperties struct { + // Engine Catalog properties. + Catalog map[string]EnginePropertiesCatalogAdditionalProperties `json:"catalog,omitempty"` -// GetIngestionJobOptions : The GetIngestionJob options. -type GetIngestionJobOptions struct { - // ingestion job id. - JobID *string `json:"job_id" validate:"required,ne="` + // Engine configuration properties. + Configuration *EnginePropertiesConfiguration `json:"configuration,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId" validate:"required"` + // Event listener engine properties. + EventListener map[string]string `json:"event_listener,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string -} + // Global engine properties. + Global map[string]string `json:"global,omitempty"` -// NewGetIngestionJobOptions : Instantiate GetIngestionJobOptions -func (*WatsonxDataV2) NewGetIngestionJobOptions(jobID string, authInstanceID string) *GetIngestionJobOptions { - return &GetIngestionJobOptions{ - JobID: core.StringPtr(jobID), - AuthInstanceID: core.StringPtr(authInstanceID), - } -} + // JMX engine properties. + JmxExporterConfig map[string]string `json:"jmx_exporter_config,omitempty"` -// SetJobID : Allow user to set JobID -func (_options *GetIngestionJobOptions) SetJobID(jobID string) *GetIngestionJobOptions { - _options.JobID = core.StringPtr(jobID) - return _options -} + // Engine JVM properties. + Jvm *EnginePropertiesJvm `json:"jvm,omitempty"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetIngestionJobOptions) SetAuthInstanceID(authInstanceID string) *GetIngestionJobOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options + // Engine Logconfig properties. + LogConfig *EnginePropertiesLogConfig `json:"log_config,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *GetIngestionJobOptions) SetHeaders(param map[string]string) *GetIngestionJobOptions { - options.Headers = param - return options +// UnmarshalEngineProperties unmarshals an instance of EngineProperties from the specified map of raw messages. +func UnmarshalEngineProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EngineProperties) + err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalEnginePropertiesCatalogAdditionalProperties) + if err != nil { + err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalEnginePropertiesConfiguration) + if err != nil { + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "event_listener", &obj.EventListener) + if err != nil { + err = core.SDKErrorf(err, "", "event_listener-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "global", &obj.Global) + if err != nil { + err = core.SDKErrorf(err, "", "global-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "jmx_exporter_config", &obj.JmxExporterConfig) + if err != nil { + err = core.SDKErrorf(err, "", "jmx_exporter_config-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "jvm", &obj.Jvm, UnmarshalEnginePropertiesJvm) + if err != nil { + err = core.SDKErrorf(err, "", "jvm-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "log_config", &obj.LogConfig, UnmarshalEnginePropertiesLogConfig) + if err != nil { + err = core.SDKErrorf(err, "", "log_config-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// GetIntegrationsOptions : The GetIntegrations options. -type GetIntegrationsOptions struct { - // integration_id. - IntegrationID *string `json:"integration_id" validate:"required,ne="` +// asPatch returns a generic map representation of the EngineProperties +func (engineProperties *EngineProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(engineProperties.Catalog) { + catalogPatchMap := map[string]map[string]interface{}{} + for k, v := range engineProperties.Catalog { + catalogPatchMap[k] = v.asPatch() + } + _patch["catalog"] = catalogPatchMap + } + if !core.IsNil(engineProperties.Configuration) { + _patch["configuration"] = engineProperties.Configuration.asPatch() + } + if !core.IsNil(engineProperties.EventListener) { + _patch["event_listener"] = engineProperties.EventListener + } + if !core.IsNil(engineProperties.Global) { + _patch["global"] = engineProperties.Global + } + if !core.IsNil(engineProperties.JmxExporterConfig) { + _patch["jmx_exporter_config"] = engineProperties.JmxExporterConfig + } + if !core.IsNil(engineProperties.Jvm) { + _patch["jvm"] = engineProperties.Jvm.asPatch() + } + if !core.IsNil(engineProperties.LogConfig) { + _patch["log_config"] = engineProperties.LogConfig.asPatch() + } - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + return +} - // API Authentication service token. - Secret *string `json:"Secret,omitempty"` +// EnginePropertiesCatalogAdditionalProperties : Engine Catalog properties. +type EnginePropertiesCatalogAdditionalProperties struct { + // Engine Catalog coordinator properties. + Coordinator map[string]interface{} `json:"coordinator,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // Engine Catalog worker properties. + Worker map[string]interface{} `json:"worker,omitempty"` } -// NewGetIntegrationsOptions : Instantiate GetIntegrationsOptions -func (*WatsonxDataV2) NewGetIntegrationsOptions(integrationID string) *GetIntegrationsOptions { - return &GetIntegrationsOptions{ - IntegrationID: core.StringPtr(integrationID), +// UnmarshalEnginePropertiesCatalogAdditionalProperties unmarshals an instance of EnginePropertiesCatalogAdditionalProperties from the specified map of raw messages. +func UnmarshalEnginePropertiesCatalogAdditionalProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EnginePropertiesCatalogAdditionalProperties) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + if err != nil { + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetIntegrationID : Allow user to set IntegrationID -func (_options *GetIntegrationsOptions) SetIntegrationID(integrationID string) *GetIntegrationsOptions { - _options.IntegrationID = core.StringPtr(integrationID) - return _options -} +// asPatch returns a generic map representation of the EnginePropertiesCatalogAdditionalProperties +func (enginePropertiesCatalogAdditionalProperties *EnginePropertiesCatalogAdditionalProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(enginePropertiesCatalogAdditionalProperties.Coordinator) { + _patch["coordinator"] = enginePropertiesCatalogAdditionalProperties.Coordinator + } + if !core.IsNil(enginePropertiesCatalogAdditionalProperties.Worker) { + _patch["worker"] = enginePropertiesCatalogAdditionalProperties.Worker + } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetIntegrationsOptions) SetAuthInstanceID(authInstanceID string) *GetIntegrationsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options + return } -// SetSecret : Allow user to set Secret -func (_options *GetIntegrationsOptions) SetSecret(secret string) *GetIntegrationsOptions { - _options.Secret = core.StringPtr(secret) - return _options -} +// EnginePropertiesConfiguration : Engine configuration properties. +type EnginePropertiesConfiguration struct { + // Engine configuration coordinator properties. + Coordinator map[string]string `json:"coordinator,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *GetIntegrationsOptions) SetHeaders(param map[string]string) *GetIntegrationsOptions { - options.Headers = param - return options + // Engine configuration worker properties. + Worker map[string]string `json:"worker,omitempty"` } -// GetMilvusServiceOptions : The GetMilvusService options. -type GetMilvusServiceOptions struct { - // service id. - ServiceID *string `json:"service_id" validate:"required,ne="` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string +// UnmarshalEnginePropertiesConfiguration unmarshals an instance of EnginePropertiesConfiguration from the specified map of raw messages. +func UnmarshalEnginePropertiesConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EnginePropertiesConfiguration) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + if err != nil { + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// NewGetMilvusServiceOptions : Instantiate GetMilvusServiceOptions -func (*WatsonxDataV2) NewGetMilvusServiceOptions(serviceID string) *GetMilvusServiceOptions { - return &GetMilvusServiceOptions{ - ServiceID: core.StringPtr(serviceID), +// asPatch returns a generic map representation of the EnginePropertiesConfiguration +func (enginePropertiesConfiguration *EnginePropertiesConfiguration) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(enginePropertiesConfiguration.Coordinator) { + _patch["coordinator"] = enginePropertiesConfiguration.Coordinator + } + if !core.IsNil(enginePropertiesConfiguration.Worker) { + _patch["worker"] = enginePropertiesConfiguration.Worker } -} -// SetServiceID : Allow user to set ServiceID -func (_options *GetMilvusServiceOptions) SetServiceID(serviceID string) *GetMilvusServiceOptions { - _options.ServiceID = core.StringPtr(serviceID) - return _options + return } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetMilvusServiceOptions) SetAuthInstanceID(authInstanceID string) *GetMilvusServiceOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options +// EnginePropertiesJvm : Engine JVM properties. +type EnginePropertiesJvm struct { + // Engine JVM coordinator properties. + Coordinator map[string]string `json:"coordinator,omitempty"` + + // Engine JVM worker properties. + Worker map[string]string `json:"worker,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *GetMilvusServiceOptions) SetHeaders(param map[string]string) *GetMilvusServiceOptions { - options.Headers = param - return options +// UnmarshalEnginePropertiesJvm unmarshals an instance of EnginePropertiesJvm from the specified map of raw messages. +func UnmarshalEnginePropertiesJvm(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EnginePropertiesJvm) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + if err != nil { + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// GetPrestissimoEngineCatalogOptions : The GetPrestissimoEngineCatalog options. -type GetPrestissimoEngineCatalogOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// asPatch returns a generic map representation of the EnginePropertiesJvm +func (enginePropertiesJvm *EnginePropertiesJvm) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(enginePropertiesJvm.Coordinator) { + _patch["coordinator"] = enginePropertiesJvm.Coordinator + } + if !core.IsNil(enginePropertiesJvm.Worker) { + _patch["worker"] = enginePropertiesJvm.Worker + } - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` + return +} - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` +// EnginePropertiesLogConfig : Engine Logconfig properties. +type EnginePropertiesLogConfig struct { + // Engine Logconfig coordinator properties. + Coordinator map[string]string `json:"coordinator,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // Engine Logconfig worker properties. + Worker map[string]string `json:"worker,omitempty"` } -// NewGetPrestissimoEngineCatalogOptions : Instantiate GetPrestissimoEngineCatalogOptions -func (*WatsonxDataV2) NewGetPrestissimoEngineCatalogOptions(engineID string, catalogID string) *GetPrestissimoEngineCatalogOptions { - return &GetPrestissimoEngineCatalogOptions{ - EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), +// UnmarshalEnginePropertiesLogConfig unmarshals an instance of EnginePropertiesLogConfig from the specified map of raw messages. +func UnmarshalEnginePropertiesLogConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EnginePropertiesLogConfig) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + return } + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + if err != nil { + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetEngineID : Allow user to set EngineID -func (_options *GetPrestissimoEngineCatalogOptions) SetEngineID(engineID string) *GetPrestissimoEngineCatalogOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetCatalogID : Allow user to set CatalogID -func (_options *GetPrestissimoEngineCatalogOptions) SetCatalogID(catalogID string) *GetPrestissimoEngineCatalogOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options -} +// asPatch returns a generic map representation of the EnginePropertiesLogConfig +func (enginePropertiesLogConfig *EnginePropertiesLogConfig) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(enginePropertiesLogConfig.Coordinator) { + _patch["coordinator"] = enginePropertiesLogConfig.Coordinator + } + if !core.IsNil(enginePropertiesLogConfig.Worker) { + _patch["worker"] = enginePropertiesLogConfig.Worker + } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetPrestissimoEngineCatalogOptions) SetAuthInstanceID(authInstanceID string) *GetPrestissimoEngineCatalogOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options + return } -// SetHeaders : Allow user to set Headers -func (options *GetPrestissimoEngineCatalogOptions) SetHeaders(param map[string]string) *GetPrestissimoEngineCatalogOptions { - options.Headers = param - return options -} +// EnrichmentObj : Item of request payload of SAL Encrichment job detail, notifiying schema changes to IKC for metadata enrich process. +type EnrichmentObj struct { + // watsonx.data catalog name of where is the schema. + Catalog *string `json:"catalog" validate:"required"` -// GetPrestissimoEngineOptions : The GetPrestissimoEngine options. -type GetPrestissimoEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + // schema change operation type. + Operation *string `json:"operation" validate:"required"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // watsonx.data schema name. + Schema *string `json:"schema" validate:"required"` - // Allows users to set headers on API requests. - Headers map[string]string + // list of the changed table names in the schema. + Tables []string `json:"tables" validate:"required"` } -// NewGetPrestissimoEngineOptions : Instantiate GetPrestissimoEngineOptions -func (*WatsonxDataV2) NewGetPrestissimoEngineOptions(engineID string) *GetPrestissimoEngineOptions { - return &GetPrestissimoEngineOptions{ - EngineID: core.StringPtr(engineID), +// Constants associated with the EnrichmentObj.Operation property. +// schema change operation type. +const ( + EnrichmentObj_Operation_Create = "create" + EnrichmentObj_Operation_Update = "update" +) + +// NewEnrichmentObj : Instantiate EnrichmentObj (Generic Model Constructor) +func (*WatsonxDataV3) NewEnrichmentObj(catalog string, operation string, schema string, tables []string) (_model *EnrichmentObj, err error) { + _model = &EnrichmentObj{ + Catalog: core.StringPtr(catalog), + Operation: core.StringPtr(operation), + Schema: core.StringPtr(schema), + Tables: tables, } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return } -// SetEngineID : Allow user to set EngineID -func (_options *GetPrestissimoEngineOptions) SetEngineID(engineID string) *GetPrestissimoEngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options +// UnmarshalEnrichmentObj unmarshals an instance of EnrichmentObj from the specified map of raw messages. +func UnmarshalEnrichmentObj(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EnrichmentObj) + err = core.UnmarshalPrimitive(m, "catalog", &obj.Catalog) + if err != nil { + err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "operation", &obj.Operation) + if err != nil { + err = core.SDKErrorf(err, "", "operation-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "schema", &obj.Schema) + if err != nil { + err = core.SDKErrorf(err, "", "schema-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tables", &obj.Tables) + if err != nil { + err = core.SDKErrorf(err, "", "tables-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetPrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *GetPrestissimoEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options +// ErrorObj : integration error object. +type ErrorObj struct { + // error code. + Code *string `json:"code,omitempty"` + + // error message. + Message *string `json:"message,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *GetPrestissimoEngineOptions) SetHeaders(param map[string]string) *GetPrestissimoEngineOptions { - options.Headers = param - return options +// UnmarshalErrorObj unmarshals an instance of ErrorObj from the specified map of raw messages. +func UnmarshalErrorObj(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ErrorObj) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// GetPrestoEngineCatalogOptions : The GetPrestoEngineCatalog options. -type GetPrestoEngineCatalogOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// ExecuteConfig : Ingestion engine configuration. +type ExecuteConfig struct { + // Driver memory configuration (in GB) for Spark engine. + DriverMemory *string `json:"driver_memory,omitempty"` - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` + // Driver core(s) configuration for Spark engine. + DriverCores *int64 `json:"driver_cores,omitempty"` + + // Executor memory configuration (in GB) for Spark engine. + ExecutorMemory *string `json:"executor_memory,omitempty"` + + // Executor core(s) configuration for Spark engine. + ExecutorCores *int64 `json:"executor_cores,omitempty"` + + // Number of executors to assign for Spark engine. + NumExecutors *int64 `json:"num_executors,omitempty"` +} + +// UnmarshalExecuteConfig unmarshals an instance of ExecuteConfig from the specified map of raw messages. +func UnmarshalExecuteConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ExecuteConfig) + err = core.UnmarshalPrimitive(m, "driver_memory", &obj.DriverMemory) + if err != nil { + err = core.SDKErrorf(err, "", "driver_memory-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "driver_cores", &obj.DriverCores) + if err != nil { + err = core.SDKErrorf(err, "", "driver_cores-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "executor_memory", &obj.ExecutorMemory) + if err != nil { + err = core.SDKErrorf(err, "", "executor_memory-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "executor_cores", &obj.ExecutorCores) + if err != nil { + err = core.SDKErrorf(err, "", "executor_cores-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "num_executors", &obj.NumExecutors) + if err != nil { + err = core.SDKErrorf(err, "", "num_executors-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FileFormatProperties : Options used to read CSV or Text file. +type FileFormatProperties struct { + // Encoding format of the CSV or Text file (e.g., UTF-8). + Encoding *string `json:"encoding,omitempty"` + + // Character used to escape special characters in the CSV or Text file. + EscapeCharacter *string `json:"escape_character,omitempty"` + + // Character used to delimit fields in the CSV or Text file. + FieldDelimiter *string `json:"field_delimiter,omitempty"` + + // Indicates if the CSV or Text file has a header row. + Header *bool `json:"header,omitempty"` - // CRN. + // Characters used to delimit lines in the CSV or Text file. + LineDelimiter *string `json:"line_delimiter,omitempty"` +} + +// UnmarshalFileFormatProperties unmarshals an instance of FileFormatProperties from the specified map of raw messages. +func UnmarshalFileFormatProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FileFormatProperties) + err = core.UnmarshalPrimitive(m, "encoding", &obj.Encoding) + if err != nil { + err = core.SDKErrorf(err, "", "encoding-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "escape_character", &obj.EscapeCharacter) + if err != nil { + err = core.SDKErrorf(err, "", "escape_character-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "field_delimiter", &obj.FieldDelimiter) + if err != nil { + err = core.SDKErrorf(err, "", "field_delimiter-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "header", &obj.Header) + if err != nil { + err = core.SDKErrorf(err, "", "header-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "line_delimiter", &obj.LineDelimiter) + if err != nil { + err = core.SDKErrorf(err, "", "line_delimiter-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions : The FilterResourceAccessPoliciesOnUsersAndUsergroups options. +type FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions struct { + // Array of access policies. Each access policy contains metadata, permission,resource, state and subject. + AccessPoliciesSearch []AccessPoliciesSearch `json:"access_policies_search" validate:"required"` + + // Unique identifier assigned to a specific watsonx.data instance. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetPrestoEngineCatalogOptions : Instantiate GetPrestoEngineCatalogOptions -func (*WatsonxDataV2) NewGetPrestoEngineCatalogOptions(engineID string, catalogID string) *GetPrestoEngineCatalogOptions { - return &GetPrestoEngineCatalogOptions{ - EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), +// NewFilterResourceAccessPoliciesOnUsersAndUsergroupsOptions : Instantiate FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions +func (*WatsonxDataV3) NewFilterResourceAccessPoliciesOnUsersAndUsergroupsOptions(accessPoliciesSearch []AccessPoliciesSearch) *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions { + return &FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions{ + AccessPoliciesSearch: accessPoliciesSearch, } } -// SetEngineID : Allow user to set EngineID -func (_options *GetPrestoEngineCatalogOptions) SetEngineID(engineID string) *GetPrestoEngineCatalogOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetCatalogID : Allow user to set CatalogID -func (_options *GetPrestoEngineCatalogOptions) SetCatalogID(catalogID string) *GetPrestoEngineCatalogOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetAccessPoliciesSearch : Allow user to set AccessPoliciesSearch +func (_options *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) SetAccessPoliciesSearch(accessPoliciesSearch []AccessPoliciesSearch) *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions { + _options.AccessPoliciesSearch = accessPoliciesSearch return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetPrestoEngineCatalogOptions) SetAuthInstanceID(authInstanceID string) *GetPrestoEngineCatalogOptions { +func (_options *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) SetAuthInstanceID(authInstanceID string) *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetPrestoEngineCatalogOptions) SetHeaders(param map[string]string) *GetPrestoEngineCatalogOptions { +func (options *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) SetHeaders(param map[string]string) *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions { options.Headers = param return options } -// GetPrestoEngineOptions : The GetPrestoEngine options. -type GetPrestoEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// GetCatalogEngineAssociationOptions : The GetCatalogEngineAssociation options. +type GetCatalogEngineAssociationOptions struct { + // catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetPrestoEngineOptions : Instantiate GetPrestoEngineOptions -func (*WatsonxDataV2) NewGetPrestoEngineOptions(engineID string) *GetPrestoEngineOptions { - return &GetPrestoEngineOptions{ - EngineID: core.StringPtr(engineID), +// NewGetCatalogEngineAssociationOptions : Instantiate GetCatalogEngineAssociationOptions +func (*WatsonxDataV3) NewGetCatalogEngineAssociationOptions(catalogName string) *GetCatalogEngineAssociationOptions { + return &GetCatalogEngineAssociationOptions{ + CatalogName: core.StringPtr(catalogName), } } -// SetEngineID : Allow user to set EngineID -func (_options *GetPrestoEngineOptions) SetEngineID(engineID string) *GetPrestoEngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetCatalogName : Allow user to set CatalogName +func (_options *GetCatalogEngineAssociationOptions) SetCatalogName(catalogName string) *GetCatalogEngineAssociationOptions { + _options.CatalogName = core.StringPtr(catalogName) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetPrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *GetPrestoEngineOptions { +func (_options *GetCatalogEngineAssociationOptions) SetAuthInstanceID(authInstanceID string) *GetCatalogEngineAssociationOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetPrestoEngineOptions) SetHeaders(param map[string]string) *GetPrestoEngineOptions { +func (options *GetCatalogEngineAssociationOptions) SetHeaders(param map[string]string) *GetCatalogEngineAssociationOptions { options.Headers = param return options } -// GetSalIntegrationEnrichmentAssetsOptions : The GetSalIntegrationEnrichmentAssets options. -type GetSalIntegrationEnrichmentAssetsOptions struct { - // enrichment project id. - ProjectID *string `json:"project_id,omitempty"` +// GetCatalogOptions : The GetCatalog options. +type GetCatalogOptions struct { + // catalog name. + Name *string `json:"name" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSalIntegrationEnrichmentAssetsOptions : Instantiate GetSalIntegrationEnrichmentAssetsOptions -func (*WatsonxDataV2) NewGetSalIntegrationEnrichmentAssetsOptions() *GetSalIntegrationEnrichmentAssetsOptions { - return &GetSalIntegrationEnrichmentAssetsOptions{} +// NewGetCatalogOptions : Instantiate GetCatalogOptions +func (*WatsonxDataV3) NewGetCatalogOptions(name string) *GetCatalogOptions { + return &GetCatalogOptions{ + Name: core.StringPtr(name), + } } -// SetProjectID : Allow user to set ProjectID -func (_options *GetSalIntegrationEnrichmentAssetsOptions) SetProjectID(projectID string) *GetSalIntegrationEnrichmentAssetsOptions { - _options.ProjectID = core.StringPtr(projectID) +// SetName : Allow user to set Name +func (_options *GetCatalogOptions) SetName(name string) *GetCatalogOptions { + _options.Name = core.StringPtr(name) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSalIntegrationEnrichmentAssetsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationEnrichmentAssetsOptions { +func (_options *GetCatalogOptions) SetAuthInstanceID(authInstanceID string) *GetCatalogOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetSalIntegrationEnrichmentAssetsOptions) SetHeaders(param map[string]string) *GetSalIntegrationEnrichmentAssetsOptions { +func (options *GetCatalogOptions) SetHeaders(param map[string]string) *GetCatalogOptions { options.Headers = param return options } -// GetSalIntegrationEnrichmentDataAssetOptions : The GetSalIntegrationEnrichmentDataAsset options. -type GetSalIntegrationEnrichmentDataAssetOptions struct { - // enrichment project id. - ProjectID *string `json:"project_id,omitempty"` +// GetDataPolicyMetadata : Metadata for data policy. It contains policy identifier, creator of the policy, time when thw policy got created, +// time when the policy got updated, last modifier of the policy and the version of data policy. +type GetDataPolicyMetadata struct { + // time when the policy was created. + CreatedAt *string `json:"created_at,omitempty"` - // enrichment data asset id. - AssetID *string `json:"asset_id,omitempty"` + // an identifier for the creator of the policy. + Creator *string `json:"creator,omitempty"` + + // an identifier for the last modifier of the policy. + Modifier *string `json:"modifier,omitempty"` + + // an unique identifier for the policy. + Pid *string `json:"pid,omitempty"` + + // time when the policy was last updated. + UpdatedAt *string `json:"updated_at,omitempty"` + + // data policy version. This version will update on each data policy update. + Version *string `json:"version,omitempty"` +} + +// UnmarshalGetDataPolicyMetadata unmarshals an instance of GetDataPolicyMetadata from the specified map of raw messages. +func UnmarshalGetDataPolicyMetadata(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(GetDataPolicyMetadata) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "creator", &obj.Creator) + if err != nil { + err = core.SDKErrorf(err, "", "creator-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "modifier", &obj.Modifier) + if err != nil { + err = core.SDKErrorf(err, "", "modifier-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "pid", &obj.Pid) + if err != nil { + err = core.SDKErrorf(err, "", "pid-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "updated_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// GetDataPolicyOptions : The GetDataPolicy options. +type GetDataPolicyOptions struct { + // Policy name which is passing as path param to get the data policy details. + Name *string `json:"name" validate:"required,ne="` - // CRN. + // Unique identifier assigned to a specific watsonx.data instance. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSalIntegrationEnrichmentDataAssetOptions : Instantiate GetSalIntegrationEnrichmentDataAssetOptions -func (*WatsonxDataV2) NewGetSalIntegrationEnrichmentDataAssetOptions() *GetSalIntegrationEnrichmentDataAssetOptions { - return &GetSalIntegrationEnrichmentDataAssetOptions{} -} - -// SetProjectID : Allow user to set ProjectID -func (_options *GetSalIntegrationEnrichmentDataAssetOptions) SetProjectID(projectID string) *GetSalIntegrationEnrichmentDataAssetOptions { - _options.ProjectID = core.StringPtr(projectID) - return _options +// NewGetDataPolicyOptions : Instantiate GetDataPolicyOptions +func (*WatsonxDataV3) NewGetDataPolicyOptions(name string) *GetDataPolicyOptions { + return &GetDataPolicyOptions{ + Name: core.StringPtr(name), + } } -// SetAssetID : Allow user to set AssetID -func (_options *GetSalIntegrationEnrichmentDataAssetOptions) SetAssetID(assetID string) *GetSalIntegrationEnrichmentDataAssetOptions { - _options.AssetID = core.StringPtr(assetID) +// SetName : Allow user to set Name +func (_options *GetDataPolicyOptions) SetName(name string) *GetDataPolicyOptions { + _options.Name = core.StringPtr(name) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSalIntegrationEnrichmentDataAssetOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationEnrichmentDataAssetOptions { +func (_options *GetDataPolicyOptions) SetAuthInstanceID(authInstanceID string) *GetDataPolicyOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetSalIntegrationEnrichmentDataAssetOptions) SetHeaders(param map[string]string) *GetSalIntegrationEnrichmentDataAssetOptions { +func (options *GetDataPolicyOptions) SetHeaders(param map[string]string) *GetDataPolicyOptions { options.Headers = param return options } -// GetSalIntegrationEnrichmentGlobalSettingsOptions : The GetSalIntegrationEnrichmentGlobalSettings options. -type GetSalIntegrationEnrichmentGlobalSettingsOptions struct { - // CRN. +// GetDatabaseOptions : The GetDatabase options. +type GetDatabaseOptions struct { + // database id. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSalIntegrationEnrichmentGlobalSettingsOptions : Instantiate GetSalIntegrationEnrichmentGlobalSettingsOptions -func (*WatsonxDataV2) NewGetSalIntegrationEnrichmentGlobalSettingsOptions() *GetSalIntegrationEnrichmentGlobalSettingsOptions { - return &GetSalIntegrationEnrichmentGlobalSettingsOptions{} +// NewGetDatabaseOptions : Instantiate GetDatabaseOptions +func (*WatsonxDataV3) NewGetDatabaseOptions(id string) *GetDatabaseOptions { + return &GetDatabaseOptions{ + ID: core.StringPtr(id), + } } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSalIntegrationEnrichmentGlobalSettingsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationEnrichmentGlobalSettingsOptions { +// SetID : Allow user to set ID +func (_options *GetDatabaseOptions) SetID(id string) *GetDatabaseOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *GetDatabaseOptions) SetAuthInstanceID(authInstanceID string) *GetDatabaseOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetSalIntegrationEnrichmentGlobalSettingsOptions) SetHeaders(param map[string]string) *GetSalIntegrationEnrichmentGlobalSettingsOptions { +func (options *GetDatabaseOptions) SetHeaders(param map[string]string) *GetDatabaseOptions { options.Headers = param return options } -// GetSalIntegrationEnrichmentJobRunLogsOptions : The GetSalIntegrationEnrichmentJobRunLogs options. -type GetSalIntegrationEnrichmentJobRunLogsOptions struct { - // enrichment job id. - JobID *string `json:"job_id,omitempty"` - - // enrichment job run id. - JobRunID *string `json:"job_run_id,omitempty"` - - // enrichment project id. - ProjectID *string `json:"project_id,omitempty"` +// GetIngestionJobOptions : The GetIngestionJob options. +type GetIngestionJobOptions struct { + // Lakehouse Instance ID. + AuthInstanceID *string `json:"AuthInstanceId" validate:"required"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Ingestion Job ID. + ID *string `json:"id" validate:"required,ne="` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSalIntegrationEnrichmentJobRunLogsOptions : Instantiate GetSalIntegrationEnrichmentJobRunLogsOptions -func (*WatsonxDataV2) NewGetSalIntegrationEnrichmentJobRunLogsOptions() *GetSalIntegrationEnrichmentJobRunLogsOptions { - return &GetSalIntegrationEnrichmentJobRunLogsOptions{} -} - -// SetJobID : Allow user to set JobID -func (_options *GetSalIntegrationEnrichmentJobRunLogsOptions) SetJobID(jobID string) *GetSalIntegrationEnrichmentJobRunLogsOptions { - _options.JobID = core.StringPtr(jobID) - return _options -} - -// SetJobRunID : Allow user to set JobRunID -func (_options *GetSalIntegrationEnrichmentJobRunLogsOptions) SetJobRunID(jobRunID string) *GetSalIntegrationEnrichmentJobRunLogsOptions { - _options.JobRunID = core.StringPtr(jobRunID) - return _options +// NewGetIngestionJobOptions : Instantiate GetIngestionJobOptions +func (*WatsonxDataV3) NewGetIngestionJobOptions(authInstanceID string, id string) *GetIngestionJobOptions { + return &GetIngestionJobOptions{ + AuthInstanceID: core.StringPtr(authInstanceID), + ID: core.StringPtr(id), + } } -// SetProjectID : Allow user to set ProjectID -func (_options *GetSalIntegrationEnrichmentJobRunLogsOptions) SetProjectID(projectID string) *GetSalIntegrationEnrichmentJobRunLogsOptions { - _options.ProjectID = core.StringPtr(projectID) +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *GetIngestionJobOptions) SetAuthInstanceID(authInstanceID string) *GetIngestionJobOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSalIntegrationEnrichmentJobRunLogsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationEnrichmentJobRunLogsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) +// SetID : Allow user to set ID +func (_options *GetIngestionJobOptions) SetID(id string) *GetIngestionJobOptions { + _options.ID = core.StringPtr(id) return _options } // SetHeaders : Allow user to set Headers -func (options *GetSalIntegrationEnrichmentJobRunLogsOptions) SetHeaders(param map[string]string) *GetSalIntegrationEnrichmentJobRunLogsOptions { +func (options *GetIngestionJobOptions) SetHeaders(param map[string]string) *GetIngestionJobOptions { options.Headers = param return options } -// GetSalIntegrationEnrichmentJobRunsOptions : The GetSalIntegrationEnrichmentJobRuns options. -type GetSalIntegrationEnrichmentJobRunsOptions struct { - // enrichment job id. - JobID *string `json:"job_id,omitempty"` - - // enrichment project id. - ProjectID *string `json:"project_id,omitempty"` +// GetIntegrationsOptions : The GetIntegrations options. +type GetIntegrationsOptions struct { + // Unique id to identify the integration. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSalIntegrationEnrichmentJobRunsOptions : Instantiate GetSalIntegrationEnrichmentJobRunsOptions -func (*WatsonxDataV2) NewGetSalIntegrationEnrichmentJobRunsOptions() *GetSalIntegrationEnrichmentJobRunsOptions { - return &GetSalIntegrationEnrichmentJobRunsOptions{} -} - -// SetJobID : Allow user to set JobID -func (_options *GetSalIntegrationEnrichmentJobRunsOptions) SetJobID(jobID string) *GetSalIntegrationEnrichmentJobRunsOptions { - _options.JobID = core.StringPtr(jobID) - return _options +// NewGetIntegrationsOptions : Instantiate GetIntegrationsOptions +func (*WatsonxDataV3) NewGetIntegrationsOptions(id string) *GetIntegrationsOptions { + return &GetIntegrationsOptions{ + ID: core.StringPtr(id), + } } -// SetProjectID : Allow user to set ProjectID -func (_options *GetSalIntegrationEnrichmentJobRunsOptions) SetProjectID(projectID string) *GetSalIntegrationEnrichmentJobRunsOptions { - _options.ProjectID = core.StringPtr(projectID) +// SetID : Allow user to set ID +func (_options *GetIntegrationsOptions) SetID(id string) *GetIntegrationsOptions { + _options.ID = core.StringPtr(id) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSalIntegrationEnrichmentJobRunsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationEnrichmentJobRunsOptions { +func (_options *GetIntegrationsOptions) SetAuthInstanceID(authInstanceID string) *GetIntegrationsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetSalIntegrationEnrichmentJobRunsOptions) SetHeaders(param map[string]string) *GetSalIntegrationEnrichmentJobRunsOptions { +func (options *GetIntegrationsOptions) SetHeaders(param map[string]string) *GetIntegrationsOptions { options.Headers = param return options } -// GetSalIntegrationEnrichmentJobsOptions : The GetSalIntegrationEnrichmentJobs options. -type GetSalIntegrationEnrichmentJobsOptions struct { - // ikc project id. - WkcProjectID *string `json:"wkc_project_id,omitempty"` +// GetMilvusServiceOptions : The GetMilvusService options. +type GetMilvusServiceOptions struct { + // id. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSalIntegrationEnrichmentJobsOptions : Instantiate GetSalIntegrationEnrichmentJobsOptions -func (*WatsonxDataV2) NewGetSalIntegrationEnrichmentJobsOptions() *GetSalIntegrationEnrichmentJobsOptions { - return &GetSalIntegrationEnrichmentJobsOptions{} +// NewGetMilvusServiceOptions : Instantiate GetMilvusServiceOptions +func (*WatsonxDataV3) NewGetMilvusServiceOptions(id string) *GetMilvusServiceOptions { + return &GetMilvusServiceOptions{ + ID: core.StringPtr(id), + } } -// SetWkcProjectID : Allow user to set WkcProjectID -func (_options *GetSalIntegrationEnrichmentJobsOptions) SetWkcProjectID(wkcProjectID string) *GetSalIntegrationEnrichmentJobsOptions { - _options.WkcProjectID = core.StringPtr(wkcProjectID) +// SetID : Allow user to set ID +func (_options *GetMilvusServiceOptions) SetID(id string) *GetMilvusServiceOptions { + _options.ID = core.StringPtr(id) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSalIntegrationEnrichmentJobsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationEnrichmentJobsOptions { +func (_options *GetMilvusServiceOptions) SetAuthInstanceID(authInstanceID string) *GetMilvusServiceOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetSalIntegrationEnrichmentJobsOptions) SetHeaders(param map[string]string) *GetSalIntegrationEnrichmentJobsOptions { +func (options *GetMilvusServiceOptions) SetHeaders(param map[string]string) *GetMilvusServiceOptions { options.Headers = param return options } -// GetSalIntegrationEnrichmentSettingsOptions : The GetSalIntegrationEnrichmentSettings options. -type GetSalIntegrationEnrichmentSettingsOptions struct { - // wkc project id. - ProjectID *string `json:"project_id,omitempty"` +// GetPrestissimoEngineCatalogOptions : The GetPrestissimoEngineCatalog options. +type GetPrestissimoEngineCatalogOptions struct { + // engine id. + EngineID *string `json:"engine_id" validate:"required,ne="` + + // catalog id. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSalIntegrationEnrichmentSettingsOptions : Instantiate GetSalIntegrationEnrichmentSettingsOptions -func (*WatsonxDataV2) NewGetSalIntegrationEnrichmentSettingsOptions() *GetSalIntegrationEnrichmentSettingsOptions { - return &GetSalIntegrationEnrichmentSettingsOptions{} +// NewGetPrestissimoEngineCatalogOptions : Instantiate GetPrestissimoEngineCatalogOptions +func (*WatsonxDataV3) NewGetPrestissimoEngineCatalogOptions(engineID string, id string) *GetPrestissimoEngineCatalogOptions { + return &GetPrestissimoEngineCatalogOptions{ + EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), + } +} + +// SetEngineID : Allow user to set EngineID +func (_options *GetPrestissimoEngineCatalogOptions) SetEngineID(engineID string) *GetPrestissimoEngineCatalogOptions { + _options.EngineID = core.StringPtr(engineID) + return _options } -// SetProjectID : Allow user to set ProjectID -func (_options *GetSalIntegrationEnrichmentSettingsOptions) SetProjectID(projectID string) *GetSalIntegrationEnrichmentSettingsOptions { - _options.ProjectID = core.StringPtr(projectID) +// SetID : Allow user to set ID +func (_options *GetPrestissimoEngineCatalogOptions) SetID(id string) *GetPrestissimoEngineCatalogOptions { + _options.ID = core.StringPtr(id) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSalIntegrationEnrichmentSettingsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationEnrichmentSettingsOptions { +func (_options *GetPrestissimoEngineCatalogOptions) SetAuthInstanceID(authInstanceID string) *GetPrestissimoEngineCatalogOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetSalIntegrationEnrichmentSettingsOptions) SetHeaders(param map[string]string) *GetSalIntegrationEnrichmentSettingsOptions { +func (options *GetPrestissimoEngineCatalogOptions) SetHeaders(param map[string]string) *GetPrestissimoEngineCatalogOptions { options.Headers = param return options } -// GetSalIntegrationGlossaryTermsOptions : The GetSalIntegrationGlossaryTerms options. -type GetSalIntegrationGlossaryTermsOptions struct { - // CRN. +// GetPrestissimoEngineOptions : The GetPrestissimoEngine options. +type GetPrestissimoEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSalIntegrationGlossaryTermsOptions : Instantiate GetSalIntegrationGlossaryTermsOptions -func (*WatsonxDataV2) NewGetSalIntegrationGlossaryTermsOptions() *GetSalIntegrationGlossaryTermsOptions { - return &GetSalIntegrationGlossaryTermsOptions{} +// NewGetPrestissimoEngineOptions : Instantiate GetPrestissimoEngineOptions +func (*WatsonxDataV3) NewGetPrestissimoEngineOptions(id string) *GetPrestissimoEngineOptions { + return &GetPrestissimoEngineOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetPrestissimoEngineOptions) SetID(id string) *GetPrestissimoEngineOptions { + _options.ID = core.StringPtr(id) + return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSalIntegrationGlossaryTermsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationGlossaryTermsOptions { +func (_options *GetPrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *GetPrestissimoEngineOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetSalIntegrationGlossaryTermsOptions) SetHeaders(param map[string]string) *GetSalIntegrationGlossaryTermsOptions { +func (options *GetPrestissimoEngineOptions) SetHeaders(param map[string]string) *GetPrestissimoEngineOptions { options.Headers = param return options } -// GetSalIntegrationMappingsOptions : The GetSalIntegrationMappings options. -type GetSalIntegrationMappingsOptions struct { - // catalog name. - CatalogName *string `json:"catalog_name" validate:"required"` +// GetPrestoEngineCatalogOptions : The GetPrestoEngineCatalog options. +type GetPrestoEngineCatalogOptions struct { + // engine id. + EngineID *string `json:"engine_id" validate:"required,ne="` - // schema name. - SchemaName *string `json:"schema_name" validate:"required"` + // catalog id. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSalIntegrationMappingsOptions : Instantiate GetSalIntegrationMappingsOptions -func (*WatsonxDataV2) NewGetSalIntegrationMappingsOptions(catalogName string, schemaName string) *GetSalIntegrationMappingsOptions { - return &GetSalIntegrationMappingsOptions{ - CatalogName: core.StringPtr(catalogName), - SchemaName: core.StringPtr(schemaName), +// NewGetPrestoEngineCatalogOptions : Instantiate GetPrestoEngineCatalogOptions +func (*WatsonxDataV3) NewGetPrestoEngineCatalogOptions(engineID string, id string) *GetPrestoEngineCatalogOptions { + return &GetPrestoEngineCatalogOptions{ + EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), } } -// SetCatalogName : Allow user to set CatalogName -func (_options *GetSalIntegrationMappingsOptions) SetCatalogName(catalogName string) *GetSalIntegrationMappingsOptions { - _options.CatalogName = core.StringPtr(catalogName) +// SetEngineID : Allow user to set EngineID +func (_options *GetPrestoEngineCatalogOptions) SetEngineID(engineID string) *GetPrestoEngineCatalogOptions { + _options.EngineID = core.StringPtr(engineID) return _options } -// SetSchemaName : Allow user to set SchemaName -func (_options *GetSalIntegrationMappingsOptions) SetSchemaName(schemaName string) *GetSalIntegrationMappingsOptions { - _options.SchemaName = core.StringPtr(schemaName) +// SetID : Allow user to set ID +func (_options *GetPrestoEngineCatalogOptions) SetID(id string) *GetPrestoEngineCatalogOptions { + _options.ID = core.StringPtr(id) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSalIntegrationMappingsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationMappingsOptions { +func (_options *GetPrestoEngineCatalogOptions) SetAuthInstanceID(authInstanceID string) *GetPrestoEngineCatalogOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetSalIntegrationMappingsOptions) SetHeaders(param map[string]string) *GetSalIntegrationMappingsOptions { +func (options *GetPrestoEngineCatalogOptions) SetHeaders(param map[string]string) *GetPrestoEngineCatalogOptions { options.Headers = param return options } -// GetSalIntegrationOptions : The GetSalIntegration options. -type GetSalIntegrationOptions struct { - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` +// GetPrestoEngineConfigOptions : The GetPrestoEngineConfig options. +type GetPrestoEngineConfigOptions struct { + // Engine ID. + EngineID *string `json:"engine_id" validate:"required,ne="` + + // Authentication Instance ID (CRN). + AuthInstanceID *string `json:"AuthInstanceId" validate:"required"` + + // Comma-separated list of sections to retrieve + // (catalog,configuration,event_listener,global,jmx_exporter_config,jvm,log_config). + Sections *string `json:"sections,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSalIntegrationOptions : Instantiate GetSalIntegrationOptions -func (*WatsonxDataV2) NewGetSalIntegrationOptions() *GetSalIntegrationOptions { - return &GetSalIntegrationOptions{} +// NewGetPrestoEngineConfigOptions : Instantiate GetPrestoEngineConfigOptions +func (*WatsonxDataV3) NewGetPrestoEngineConfigOptions(engineID string, authInstanceID string) *GetPrestoEngineConfigOptions { + return &GetPrestoEngineConfigOptions{ + EngineID: core.StringPtr(engineID), + AuthInstanceID: core.StringPtr(authInstanceID), + } +} + +// SetEngineID : Allow user to set EngineID +func (_options *GetPrestoEngineConfigOptions) SetEngineID(engineID string) *GetPrestoEngineConfigOptions { + _options.EngineID = core.StringPtr(engineID) + return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSalIntegrationOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationOptions { +func (_options *GetPrestoEngineConfigOptions) SetAuthInstanceID(authInstanceID string) *GetPrestoEngineConfigOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } +// SetSections : Allow user to set Sections +func (_options *GetPrestoEngineConfigOptions) SetSections(sections string) *GetPrestoEngineConfigOptions { + _options.Sections = core.StringPtr(sections) + return _options +} + // SetHeaders : Allow user to set Headers -func (options *GetSalIntegrationOptions) SetHeaders(param map[string]string) *GetSalIntegrationOptions { +func (options *GetPrestoEngineConfigOptions) SetHeaders(param map[string]string) *GetPrestoEngineConfigOptions { options.Headers = param return options } -// GetSalIntegrationUploadGlossaryStatusOptions : The GetSalIntegrationUploadGlossaryStatus options. -type GetSalIntegrationUploadGlossaryStatusOptions struct { - // upload process id. - ProcessID *string `json:"process_id,omitempty"` +// GetPrestoEngineOptions : The GetPrestoEngine options. +type GetPrestoEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSalIntegrationUploadGlossaryStatusOptions : Instantiate GetSalIntegrationUploadGlossaryStatusOptions -func (*WatsonxDataV2) NewGetSalIntegrationUploadGlossaryStatusOptions() *GetSalIntegrationUploadGlossaryStatusOptions { - return &GetSalIntegrationUploadGlossaryStatusOptions{} +// NewGetPrestoEngineOptions : Instantiate GetPrestoEngineOptions +func (*WatsonxDataV3) NewGetPrestoEngineOptions(id string) *GetPrestoEngineOptions { + return &GetPrestoEngineOptions{ + ID: core.StringPtr(id), + } } -// SetProcessID : Allow user to set ProcessID -func (_options *GetSalIntegrationUploadGlossaryStatusOptions) SetProcessID(processID string) *GetSalIntegrationUploadGlossaryStatusOptions { - _options.ProcessID = core.StringPtr(processID) +// SetID : Allow user to set ID +func (_options *GetPrestoEngineOptions) SetID(id string) *GetPrestoEngineOptions { + _options.ID = core.StringPtr(id) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSalIntegrationUploadGlossaryStatusOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationUploadGlossaryStatusOptions { +func (_options *GetPrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *GetPrestoEngineOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetSalIntegrationUploadGlossaryStatusOptions) SetHeaders(param map[string]string) *GetSalIntegrationUploadGlossaryStatusOptions { +func (options *GetPrestoEngineOptions) SetHeaders(param map[string]string) *GetPrestoEngineOptions { options.Headers = param return options } -// GetSchemaDetailsOptions : The GetSchemaDetails options. -type GetSchemaDetailsOptions struct { - // Schema name. - SchemaName *string `json:"schema_name" validate:"required,ne="` +// GetSalIntegrationEnrichmentAssetsByIdOptions : The GetSalIntegrationEnrichmentAssetsByID options. +type GetSalIntegrationEnrichmentAssetsByIdOptions struct { + // enrichment project id in IBM Knowledge Catalog. + ProjectID *string `json:"project_id" validate:"required"` - // Catalog name. - CatalogName *string `json:"catalog_name,omitempty"` + // enrichment data asset id in IBM Knowledge Catalog. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetSchemaDetailsOptions : Instantiate GetSchemaDetailsOptions -func (*WatsonxDataV2) NewGetSchemaDetailsOptions(schemaName string) *GetSchemaDetailsOptions { - return &GetSchemaDetailsOptions{ - SchemaName: core.StringPtr(schemaName), +// NewGetSalIntegrationEnrichmentAssetsByIdOptions : Instantiate GetSalIntegrationEnrichmentAssetsByIdOptions +func (*WatsonxDataV3) NewGetSalIntegrationEnrichmentAssetsByIdOptions(projectID string, id string) *GetSalIntegrationEnrichmentAssetsByIdOptions { + return &GetSalIntegrationEnrichmentAssetsByIdOptions{ + ProjectID: core.StringPtr(projectID), + ID: core.StringPtr(id), } } -// SetSchemaName : Allow user to set SchemaName -func (_options *GetSchemaDetailsOptions) SetSchemaName(schemaName string) *GetSchemaDetailsOptions { - _options.SchemaName = core.StringPtr(schemaName) +// SetProjectID : Allow user to set ProjectID +func (_options *GetSalIntegrationEnrichmentAssetsByIdOptions) SetProjectID(projectID string) *GetSalIntegrationEnrichmentAssetsByIdOptions { + _options.ProjectID = core.StringPtr(projectID) return _options } -// SetCatalogName : Allow user to set CatalogName -func (_options *GetSchemaDetailsOptions) SetCatalogName(catalogName string) *GetSchemaDetailsOptions { - _options.CatalogName = core.StringPtr(catalogName) +// SetID : Allow user to set ID +func (_options *GetSalIntegrationEnrichmentAssetsByIdOptions) SetID(id string) *GetSalIntegrationEnrichmentAssetsByIdOptions { + _options.ID = core.StringPtr(id) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetSchemaDetailsOptions) SetAuthInstanceID(authInstanceID string) *GetSchemaDetailsOptions { +func (_options *GetSalIntegrationEnrichmentAssetsByIdOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationEnrichmentAssetsByIdOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetSchemaDetailsOptions) SetHeaders(param map[string]string) *GetSchemaDetailsOptions { +func (options *GetSalIntegrationEnrichmentAssetsByIdOptions) SetHeaders(param map[string]string) *GetSalIntegrationEnrichmentAssetsByIdOptions { options.Headers = param return options } -// GetServiceDetailOptions : The GetServiceDetail options. -type GetServiceDetailOptions struct { - // Target type (e.g., 'cpd', 'generic'). - Target *string `json:"target" validate:"required"` - - // Type of engine or service (e.g., 'milvus', 'presto'). - EngineOrServiceType *string `json:"engine_or_service_type" validate:"required,ne="` - - // Service ID. - ID *string `json:"id" validate:"required,ne="` - - // Database name in milvus. - Database *string `json:"database,omitempty"` - - // Internal host. - InternalHost *bool `json:"internal_host,omitempty"` - - // CRN. +// GetSalIntegrationEnrichmentGlobalSettingsOptions : The GetSalIntegrationEnrichmentGlobalSettings options. +type GetSalIntegrationEnrichmentGlobalSettingsOptions struct { + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetServiceDetailOptions : Instantiate GetServiceDetailOptions -func (*WatsonxDataV2) NewGetServiceDetailOptions(target string, engineOrServiceType string, id string) *GetServiceDetailOptions { - return &GetServiceDetailOptions{ - Target: core.StringPtr(target), - EngineOrServiceType: core.StringPtr(engineOrServiceType), - ID: core.StringPtr(id), - } -} - -// SetTarget : Allow user to set Target -func (_options *GetServiceDetailOptions) SetTarget(target string) *GetServiceDetailOptions { - _options.Target = core.StringPtr(target) - return _options -} - -// SetEngineOrServiceType : Allow user to set EngineOrServiceType -func (_options *GetServiceDetailOptions) SetEngineOrServiceType(engineOrServiceType string) *GetServiceDetailOptions { - _options.EngineOrServiceType = core.StringPtr(engineOrServiceType) - return _options -} - -// SetID : Allow user to set ID -func (_options *GetServiceDetailOptions) SetID(id string) *GetServiceDetailOptions { - _options.ID = core.StringPtr(id) - return _options -} - -// SetDatabase : Allow user to set Database -func (_options *GetServiceDetailOptions) SetDatabase(database string) *GetServiceDetailOptions { - _options.Database = core.StringPtr(database) - return _options -} - -// SetInternalHost : Allow user to set InternalHost -func (_options *GetServiceDetailOptions) SetInternalHost(internalHost bool) *GetServiceDetailOptions { - _options.InternalHost = core.BoolPtr(internalHost) - return _options +// NewGetSalIntegrationEnrichmentGlobalSettingsOptions : Instantiate GetSalIntegrationEnrichmentGlobalSettingsOptions +func (*WatsonxDataV3) NewGetSalIntegrationEnrichmentGlobalSettingsOptions() *GetSalIntegrationEnrichmentGlobalSettingsOptions { + return &GetSalIntegrationEnrichmentGlobalSettingsOptions{} } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetServiceDetailOptions) SetAuthInstanceID(authInstanceID string) *GetServiceDetailOptions { +func (_options *GetSalIntegrationEnrichmentGlobalSettingsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationEnrichmentGlobalSettingsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetServiceDetailOptions) SetHeaders(param map[string]string) *GetServiceDetailOptions { +func (options *GetSalIntegrationEnrichmentGlobalSettingsOptions) SetHeaders(param map[string]string) *GetSalIntegrationEnrichmentGlobalSettingsOptions { options.Headers = param return options } -// GetServicesDetailsOptions : The GetServicesDetails options. -type GetServicesDetailsOptions struct { - // Target type (e.g., 'cpd', 'generic'). - Target *string `json:"target" validate:"required"` +// GetSalIntegrationEnrichmentJobRunLogsOptions : The GetSalIntegrationEnrichmentJobRunLogs options. +type GetSalIntegrationEnrichmentJobRunLogsOptions struct { + // IBM Knowledge Catalog enrichment job id. + JobID *string `json:"job_id" validate:"required,ne="` - // Type of engine or service (e.g., 'milvus', 'presto'). - EngineOrServiceType *string `json:"engine_or_service_type" validate:"required,ne="` + // IBM Knowledge Catalog enrichment job run id. + RunID *string `json:"run_id" validate:"required,ne="` - // Internal host. - InternalHost *bool `json:"internal_host,omitempty"` + // IBM Knowledge Catalog project id. + ProjectID *string `json:"project_id" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetServicesDetailsOptions : Instantiate GetServicesDetailsOptions -func (*WatsonxDataV2) NewGetServicesDetailsOptions(target string, engineOrServiceType string) *GetServicesDetailsOptions { - return &GetServicesDetailsOptions{ - Target: core.StringPtr(target), - EngineOrServiceType: core.StringPtr(engineOrServiceType), +// NewGetSalIntegrationEnrichmentJobRunLogsOptions : Instantiate GetSalIntegrationEnrichmentJobRunLogsOptions +func (*WatsonxDataV3) NewGetSalIntegrationEnrichmentJobRunLogsOptions(jobID string, runID string, projectID string) *GetSalIntegrationEnrichmentJobRunLogsOptions { + return &GetSalIntegrationEnrichmentJobRunLogsOptions{ + JobID: core.StringPtr(jobID), + RunID: core.StringPtr(runID), + ProjectID: core.StringPtr(projectID), } } -// SetTarget : Allow user to set Target -func (_options *GetServicesDetailsOptions) SetTarget(target string) *GetServicesDetailsOptions { - _options.Target = core.StringPtr(target) +// SetJobID : Allow user to set JobID +func (_options *GetSalIntegrationEnrichmentJobRunLogsOptions) SetJobID(jobID string) *GetSalIntegrationEnrichmentJobRunLogsOptions { + _options.JobID = core.StringPtr(jobID) return _options } -// SetEngineOrServiceType : Allow user to set EngineOrServiceType -func (_options *GetServicesDetailsOptions) SetEngineOrServiceType(engineOrServiceType string) *GetServicesDetailsOptions { - _options.EngineOrServiceType = core.StringPtr(engineOrServiceType) +// SetRunID : Allow user to set RunID +func (_options *GetSalIntegrationEnrichmentJobRunLogsOptions) SetRunID(runID string) *GetSalIntegrationEnrichmentJobRunLogsOptions { + _options.RunID = core.StringPtr(runID) return _options } -// SetInternalHost : Allow user to set InternalHost -func (_options *GetServicesDetailsOptions) SetInternalHost(internalHost bool) *GetServicesDetailsOptions { - _options.InternalHost = core.BoolPtr(internalHost) +// SetProjectID : Allow user to set ProjectID +func (_options *GetSalIntegrationEnrichmentJobRunLogsOptions) SetProjectID(projectID string) *GetSalIntegrationEnrichmentJobRunLogsOptions { + _options.ProjectID = core.StringPtr(projectID) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetServicesDetailsOptions) SetAuthInstanceID(authInstanceID string) *GetServicesDetailsOptions { +func (_options *GetSalIntegrationEnrichmentJobRunLogsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationEnrichmentJobRunLogsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSalIntegrationEnrichmentJobRunLogsOptions) SetHeaders(param map[string]string) *GetSalIntegrationEnrichmentJobRunLogsOptions { + options.Headers = param + return options +} + +// GetSalIntegrationEnrichmentProjectSettingsOptions : The GetSalIntegrationEnrichmentProjectSettings options. +type GetSalIntegrationEnrichmentProjectSettingsOptions struct { + // IBM Knowledge Catalog project id. + ProjectID *string `json:"project_id" validate:"required"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetSalIntegrationEnrichmentProjectSettingsOptions : Instantiate GetSalIntegrationEnrichmentProjectSettingsOptions +func (*WatsonxDataV3) NewGetSalIntegrationEnrichmentProjectSettingsOptions(projectID string) *GetSalIntegrationEnrichmentProjectSettingsOptions { + return &GetSalIntegrationEnrichmentProjectSettingsOptions{ + ProjectID: core.StringPtr(projectID), + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *GetSalIntegrationEnrichmentProjectSettingsOptions) SetProjectID(projectID string) *GetSalIntegrationEnrichmentProjectSettingsOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *GetSalIntegrationEnrichmentProjectSettingsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationEnrichmentProjectSettingsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSalIntegrationEnrichmentProjectSettingsOptions) SetHeaders(param map[string]string) *GetSalIntegrationEnrichmentProjectSettingsOptions { + options.Headers = param + return options +} + +// GetSalIntegrationGlossaryTermsOptions : The GetSalIntegrationGlossaryTerms options. +type GetSalIntegrationGlossaryTermsOptions struct { + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetSalIntegrationGlossaryTermsOptions : Instantiate GetSalIntegrationGlossaryTermsOptions +func (*WatsonxDataV3) NewGetSalIntegrationGlossaryTermsOptions() *GetSalIntegrationGlossaryTermsOptions { + return &GetSalIntegrationGlossaryTermsOptions{} +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *GetSalIntegrationGlossaryTermsOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationGlossaryTermsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSalIntegrationGlossaryTermsOptions) SetHeaders(param map[string]string) *GetSalIntegrationGlossaryTermsOptions { + options.Headers = param + return options +} + +// GetSalIntegrationOptions : The GetSalIntegration options. +type GetSalIntegrationOptions struct { + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetSalIntegrationOptions : Instantiate GetSalIntegrationOptions +func (*WatsonxDataV3) NewGetSalIntegrationOptions() *GetSalIntegrationOptions { + return &GetSalIntegrationOptions{} +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *GetSalIntegrationOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSalIntegrationOptions) SetHeaders(param map[string]string) *GetSalIntegrationOptions { + options.Headers = param + return options +} + +// GetSalIntegrationUploadGlossaryStatusOptions : The GetSalIntegrationUploadGlossaryStatus options. +type GetSalIntegrationUploadGlossaryStatusOptions struct { + // upload process id. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetSalIntegrationUploadGlossaryStatusOptions : Instantiate GetSalIntegrationUploadGlossaryStatusOptions +func (*WatsonxDataV3) NewGetSalIntegrationUploadGlossaryStatusOptions(id string) *GetSalIntegrationUploadGlossaryStatusOptions { + return &GetSalIntegrationUploadGlossaryStatusOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSalIntegrationUploadGlossaryStatusOptions) SetID(id string) *GetSalIntegrationUploadGlossaryStatusOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *GetSalIntegrationUploadGlossaryStatusOptions) SetAuthInstanceID(authInstanceID string) *GetSalIntegrationUploadGlossaryStatusOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetServicesDetailsOptions) SetHeaders(param map[string]string) *GetServicesDetailsOptions { +func (options *GetSalIntegrationUploadGlossaryStatusOptions) SetHeaders(param map[string]string) *GetSalIntegrationUploadGlossaryStatusOptions { options.Headers = param return options } @@ -19197,9 +20982,9 @@ type GetSparkEngineApplicationStatusOptions struct { EngineID *string `json:"engine_id" validate:"required,ne="` // Application id. - ApplicationID *string `json:"application_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -19207,10 +20992,10 @@ type GetSparkEngineApplicationStatusOptions struct { } // NewGetSparkEngineApplicationStatusOptions : Instantiate GetSparkEngineApplicationStatusOptions -func (*WatsonxDataV2) NewGetSparkEngineApplicationStatusOptions(engineID string, applicationID string) *GetSparkEngineApplicationStatusOptions { +func (*WatsonxDataV3) NewGetSparkEngineApplicationStatusOptions(engineID string, id string) *GetSparkEngineApplicationStatusOptions { return &GetSparkEngineApplicationStatusOptions{ EngineID: core.StringPtr(engineID), - ApplicationID: core.StringPtr(applicationID), + ID: core.StringPtr(id), } } @@ -19220,9 +21005,9 @@ func (_options *GetSparkEngineApplicationStatusOptions) SetEngineID(engineID str return _options } -// SetApplicationID : Allow user to set ApplicationID -func (_options *GetSparkEngineApplicationStatusOptions) SetApplicationID(applicationID string) *GetSparkEngineApplicationStatusOptions { - _options.ApplicationID = core.StringPtr(applicationID) +// SetID : Allow user to set ID +func (_options *GetSparkEngineApplicationStatusOptions) SetID(id string) *GetSparkEngineApplicationStatusOptions { + _options.ID = core.StringPtr(id) return _options } @@ -19238,15 +21023,62 @@ func (options *GetSparkEngineApplicationStatusOptions) SetHeaders(param map[stri return options } +// GetSparkEngineApplicationUiOptions : The GetSparkEngineApplicationUi options. +type GetSparkEngineApplicationUiOptions struct { + // engine id. + EngineID *string `json:"engine_id" validate:"required,ne="` + + // Application id. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetSparkEngineApplicationUiOptions : Instantiate GetSparkEngineApplicationUiOptions +func (*WatsonxDataV3) NewGetSparkEngineApplicationUiOptions(engineID string, id string) *GetSparkEngineApplicationUiOptions { + return &GetSparkEngineApplicationUiOptions{ + EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), + } +} + +// SetEngineID : Allow user to set EngineID +func (_options *GetSparkEngineApplicationUiOptions) SetEngineID(engineID string) *GetSparkEngineApplicationUiOptions { + _options.EngineID = core.StringPtr(engineID) + return _options +} + +// SetID : Allow user to set ID +func (_options *GetSparkEngineApplicationUiOptions) SetID(id string) *GetSparkEngineApplicationUiOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *GetSparkEngineApplicationUiOptions) SetAuthInstanceID(authInstanceID string) *GetSparkEngineApplicationUiOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSparkEngineApplicationUiOptions) SetHeaders(param map[string]string) *GetSparkEngineApplicationUiOptions { + options.Headers = param + return options +} + // GetSparkEngineCatalogOptions : The GetSparkEngineCatalog options. type GetSparkEngineCatalogOptions struct { // engine id. EngineID *string `json:"engine_id" validate:"required,ne="` // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -19254,10 +21086,10 @@ type GetSparkEngineCatalogOptions struct { } // NewGetSparkEngineCatalogOptions : Instantiate GetSparkEngineCatalogOptions -func (*WatsonxDataV2) NewGetSparkEngineCatalogOptions(engineID string, catalogID string) *GetSparkEngineCatalogOptions { +func (*WatsonxDataV3) NewGetSparkEngineCatalogOptions(engineID string, id string) *GetSparkEngineCatalogOptions { return &GetSparkEngineCatalogOptions{ EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), + ID: core.StringPtr(id), } } @@ -19267,9 +21099,9 @@ func (_options *GetSparkEngineCatalogOptions) SetEngineID(engineID string) *GetS return _options } -// SetCatalogID : Allow user to set CatalogID -func (_options *GetSparkEngineCatalogOptions) SetCatalogID(catalogID string) *GetSparkEngineCatalogOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetID : Allow user to set ID +func (_options *GetSparkEngineCatalogOptions) SetID(id string) *GetSparkEngineCatalogOptions { + _options.ID = core.StringPtr(id) return _options } @@ -19288,9 +21120,9 @@ func (options *GetSparkEngineCatalogOptions) SetHeaders(param map[string]string) // GetSparkEngineHistoryServerOptions : The GetSparkEngineHistoryServer options. type GetSparkEngineHistoryServerOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -19298,15 +21130,15 @@ type GetSparkEngineHistoryServerOptions struct { } // NewGetSparkEngineHistoryServerOptions : Instantiate GetSparkEngineHistoryServerOptions -func (*WatsonxDataV2) NewGetSparkEngineHistoryServerOptions(engineID string) *GetSparkEngineHistoryServerOptions { +func (*WatsonxDataV3) NewGetSparkEngineHistoryServerOptions(id string) *GetSparkEngineHistoryServerOptions { return &GetSparkEngineHistoryServerOptions{ - EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), } } -// SetEngineID : Allow user to set EngineID -func (_options *GetSparkEngineHistoryServerOptions) SetEngineID(engineID string) *GetSparkEngineHistoryServerOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *GetSparkEngineHistoryServerOptions) SetID(id string) *GetSparkEngineHistoryServerOptions { + _options.ID = core.StringPtr(id) return _options } @@ -19322,12 +21154,49 @@ func (options *GetSparkEngineHistoryServerOptions) SetHeaders(param map[string]s return options } +// GetSparkEngineHistoryServerUiOptions : The GetSparkEngineHistoryServerUi options. +type GetSparkEngineHistoryServerUiOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetSparkEngineHistoryServerUiOptions : Instantiate GetSparkEngineHistoryServerUiOptions +func (*WatsonxDataV3) NewGetSparkEngineHistoryServerUiOptions(id string) *GetSparkEngineHistoryServerUiOptions { + return &GetSparkEngineHistoryServerUiOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetSparkEngineHistoryServerUiOptions) SetID(id string) *GetSparkEngineHistoryServerUiOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *GetSparkEngineHistoryServerUiOptions) SetAuthInstanceID(authInstanceID string) *GetSparkEngineHistoryServerUiOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSparkEngineHistoryServerUiOptions) SetHeaders(param map[string]string) *GetSparkEngineHistoryServerUiOptions { + options.Headers = param + return options +} + // GetSparkEngineOptions : The GetSparkEngine options. type GetSparkEngineOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -19335,15 +21204,15 @@ type GetSparkEngineOptions struct { } // NewGetSparkEngineOptions : Instantiate GetSparkEngineOptions -func (*WatsonxDataV2) NewGetSparkEngineOptions(engineID string) *GetSparkEngineOptions { +func (*WatsonxDataV3) NewGetSparkEngineOptions(id string) *GetSparkEngineOptions { return &GetSparkEngineOptions{ - EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), } } -// SetEngineID : Allow user to set EngineID -func (_options *GetSparkEngineOptions) SetEngineID(engineID string) *GetSparkEngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *GetSparkEngineOptions) SetID(id string) *GetSparkEngineOptions { + _options.ID = core.StringPtr(id) return _options } @@ -19359,110 +21228,147 @@ func (options *GetSparkEngineOptions) SetHeaders(param map[string]string) *GetSp return options } -// GetTableDetailsOptions : The GetTableDetails options. -type GetTableDetailsOptions struct { - // Table name. - TableName *string `json:"table_name" validate:"required,ne="` - - // Catalog name. - CatalogName *string `json:"catalog_name,omitempty"` +// GetStorageObjectPropertiesOptions : The GetStorageObjectProperties options. +type GetStorageObjectPropertiesOptions struct { + // storage id. + StorageID *string `json:"storage_id" validate:"required,ne="` - // Schema name. - SchemaName *string `json:"schema_name,omitempty"` + // storage object size. + Paths []Path `json:"paths,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewGetTableDetailsOptions : Instantiate GetTableDetailsOptions -func (*WatsonxDataV2) NewGetTableDetailsOptions(tableName string) *GetTableDetailsOptions { - return &GetTableDetailsOptions{ - TableName: core.StringPtr(tableName), +// NewGetStorageObjectPropertiesOptions : Instantiate GetStorageObjectPropertiesOptions +func (*WatsonxDataV3) NewGetStorageObjectPropertiesOptions(storageID string) *GetStorageObjectPropertiesOptions { + return &GetStorageObjectPropertiesOptions{ + StorageID: core.StringPtr(storageID), } } -// SetTableName : Allow user to set TableName -func (_options *GetTableDetailsOptions) SetTableName(tableName string) *GetTableDetailsOptions { - _options.TableName = core.StringPtr(tableName) - return _options -} - -// SetCatalogName : Allow user to set CatalogName -func (_options *GetTableDetailsOptions) SetCatalogName(catalogName string) *GetTableDetailsOptions { - _options.CatalogName = core.StringPtr(catalogName) +// SetStorageID : Allow user to set StorageID +func (_options *GetStorageObjectPropertiesOptions) SetStorageID(storageID string) *GetStorageObjectPropertiesOptions { + _options.StorageID = core.StringPtr(storageID) return _options } -// SetSchemaName : Allow user to set SchemaName -func (_options *GetTableDetailsOptions) SetSchemaName(schemaName string) *GetTableDetailsOptions { - _options.SchemaName = core.StringPtr(schemaName) +// SetPaths : Allow user to set Paths +func (_options *GetStorageObjectPropertiesOptions) SetPaths(paths []Path) *GetStorageObjectPropertiesOptions { + _options.Paths = paths return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *GetTableDetailsOptions) SetAuthInstanceID(authInstanceID string) *GetTableDetailsOptions { +func (_options *GetStorageObjectPropertiesOptions) SetAuthInstanceID(authInstanceID string) *GetStorageObjectPropertiesOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *GetTableDetailsOptions) SetHeaders(param map[string]string) *GetTableDetailsOptions { +func (options *GetStorageObjectPropertiesOptions) SetHeaders(param map[string]string) *GetStorageObjectPropertiesOptions { options.Headers = param return options } -// GetTableOptions : The GetTable options. -type GetTableOptions struct { - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` - - // URL encoded schema name. - SchemaID *string `json:"schema_id" validate:"required,ne="` - - // URL encoded table name. - TableID *string `json:"table_id" validate:"required,ne="` - - // engine id. - EngineID *string `json:"engine_id" validate:"required"` - - // URL encoded table type. - Type *string `json:"type,omitempty"` +// GetStorageRegistrationOptions : The GetStorageRegistration options. +type GetStorageRegistrationOptions struct { + // storage id. + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Skip MDS call when Unity catalog is added. + SkipMdsCall *bool `json:"skip_mds_call,omitempty"` + // Allows users to set headers on API requests. Headers map[string]string } -// NewGetTableOptions : Instantiate GetTableOptions -func (*WatsonxDataV2) NewGetTableOptions(catalogID string, schemaID string, tableID string, engineID string) *GetTableOptions { - return &GetTableOptions{ - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - TableID: core.StringPtr(tableID), - EngineID: core.StringPtr(engineID), +// NewGetStorageRegistrationOptions : Instantiate GetStorageRegistrationOptions +func (*WatsonxDataV3) NewGetStorageRegistrationOptions(id string) *GetStorageRegistrationOptions { + return &GetStorageRegistrationOptions{ + ID: core.StringPtr(id), } } -// SetCatalogID : Allow user to set CatalogID -func (_options *GetTableOptions) SetCatalogID(catalogID string) *GetTableOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetID : Allow user to set ID +func (_options *GetStorageRegistrationOptions) SetID(id string) *GetStorageRegistrationOptions { + _options.ID = core.StringPtr(id) return _options } -// SetSchemaID : Allow user to set SchemaID -func (_options *GetTableOptions) SetSchemaID(schemaID string) *GetTableOptions { - _options.SchemaID = core.StringPtr(schemaID) - return _options +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *GetStorageRegistrationOptions) SetAuthInstanceID(authInstanceID string) *GetStorageRegistrationOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options } -// SetTableID : Allow user to set TableID -func (_options *GetTableOptions) SetTableID(tableID string) *GetTableOptions { - _options.TableID = core.StringPtr(tableID) +// SetSkipMdsCall : Allow user to set SkipMdsCall +func (_options *GetStorageRegistrationOptions) SetSkipMdsCall(skipMdsCall bool) *GetStorageRegistrationOptions { + _options.SkipMdsCall = core.BoolPtr(skipMdsCall) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetStorageRegistrationOptions) SetHeaders(param map[string]string) *GetStorageRegistrationOptions { + options.Headers = param + return options +} + +// GetTableOptions : The GetTable options. +type GetTableOptions struct { + // catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` + + // URL encoded schema name. + SchemaName *string `json:"schema_name" validate:"required,ne="` + + // URL encoded table name. + TableName *string `json:"table_name" validate:"required,ne="` + + // Engine id of presto/prestissimo/spark/db2/netezza other engine. + EngineID *string `json:"engine_id" validate:"required"` + + // URL encoded table type (view,base table). + Type *string `json:"type,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewGetTableOptions : Instantiate GetTableOptions +func (*WatsonxDataV3) NewGetTableOptions(catalogName string, schemaName string, tableName string, engineID string) *GetTableOptions { + return &GetTableOptions{ + CatalogName: core.StringPtr(catalogName), + SchemaName: core.StringPtr(schemaName), + TableName: core.StringPtr(tableName), + EngineID: core.StringPtr(engineID), + } +} + +// SetCatalogName : Allow user to set CatalogName +func (_options *GetTableOptions) SetCatalogName(catalogName string) *GetTableOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options +} + +// SetSchemaName : Allow user to set SchemaName +func (_options *GetTableOptions) SetSchemaName(schemaName string) *GetTableOptions { + _options.SchemaName = core.StringPtr(schemaName) + return _options +} + +// SetTableName : Allow user to set TableName +func (_options *GetTableOptions) SetTableName(tableName string) *GetTableOptions { + _options.TableName = core.StringPtr(tableName) return _options } @@ -19519,29 +21425,26 @@ func UnmarshalGlossaryObject(m map[string]json.RawMessage, result interface{}) ( // HdfsStorageRegistration : HDFS storage registration. type HdfsStorageRegistration struct { // Actions. - Actions []string `json:"actions,omitempty"` - - // bucket catalog. - AssociatedCatalog *BucketCatalog `json:"associated_catalog" validate:"required"` - - // HDFS storage display name. - BucketDisplayName *string `json:"bucket_display_name,omitempty"` + Actions []string `json:"actions" validate:"required"` - // HDFS Storage ID auto generated during registration. - BucketID *string `json:"bucket_id,omitempty"` + // storage catalog. + AssociatedCatalog *StorageCatalog `json:"associated_catalog" validate:"required"` - // HDFS type. - BucketType *string `json:"bucket_type" validate:"required"` + // Creation date. + CreatedAt *string `json:"created_at" validate:"required"` // Username who created the HDFS storage. CreatedBy *string `json:"created_by" validate:"required"` - // Creation date. - CreatedOn *string `json:"created_on" validate:"required"` - // HDFS description. Description *string `json:"description" validate:"required"` + // HDFS storage display name. + DisplayName *string `json:"display_name,omitempty"` + + // HDFS Storage ID auto generated during registration. + ID *string `json:"id,omitempty"` + // managed by. ManagedBy *string `json:"managed_by" validate:"required"` @@ -19549,14 +21452,11 @@ type HdfsStorageRegistration struct { State *string `json:"state" validate:"required"` // tags. - Tags []string `json:"tags,omitempty"` -} + Tags []string `json:"tags" validate:"required"` -// Constants associated with the HdfsStorageRegistration.BucketType property. -// HDFS type. -const ( - HdfsStorageRegistration_BucketType_Hdfs = "hdfs" -) + // HDFS type. + Type *string `json:"type" validate:"required"` +} // Constants associated with the HdfsStorageRegistration.ManagedBy property. // managed by. @@ -19571,6 +21471,12 @@ const ( HdfsStorageRegistration_State_Inactive = "inactive" ) +// Constants associated with the HdfsStorageRegistration.Type property. +// HDFS type. +const ( + HdfsStorageRegistration_Type_Hdfs = "hdfs" +) + // UnmarshalHdfsStorageRegistration unmarshals an instance of HdfsStorageRegistration from the specified map of raw messages. func UnmarshalHdfsStorageRegistration(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(HdfsStorageRegistration) @@ -19579,39 +21485,34 @@ func UnmarshalHdfsStorageRegistration(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "associated_catalog", &obj.AssociatedCatalog, UnmarshalBucketCatalog) + err = core.UnmarshalModel(m, "associated_catalog", &obj.AssociatedCatalog, UnmarshalStorageCatalog) if err != nil { err = core.SDKErrorf(err, "", "associated_catalog-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "bucket_display_name", &obj.BucketDisplayName) - if err != nil { - err = core.SDKErrorf(err, "", "bucket_display_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "bucket_id", &obj.BucketID) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { - err = core.SDKErrorf(err, "", "bucket_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "bucket_type", &obj.BucketType) + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) if err != nil { - err = core.SDKErrorf(err, "", "bucket_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { - err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) @@ -19629,517 +21530,485 @@ func UnmarshalHdfsStorageRegistration(m map[string]json.RawMessage, result inter err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// IngestionJob : Ingestion job. -type IngestionJob struct { - // Create new target table (if True); Insert into pre-existing target table (if False). - CreateIfNotExist *bool `json:"create_if_not_exist,omitempty"` +// IcebergSourceTable : Iceberg source table information. +type IcebergSourceTable struct { + // Iceberg schema name. + SchemaName *string `json:"schema_name,omitempty"` - // Ingestion CSV properties. - CsvProperty *IngestionJobCsvProperty `json:"csv_property,omitempty"` + // Iceberg table name. + TableName *string `json:"table_name,omitempty"` - // Error messages of failed ingestion job. - Details *string `json:"details,omitempty"` + // Iceberg catalog name. + CatalogName *string `json:"catalog_name,omitempty"` - // Unix timestamp of ingestion job completing. - EndTimestamp *string `json:"end_timestamp,omitempty"` + // Iceberg warehouse name. + WarehouseName *string `json:"warehouse_name,omitempty"` - // ID of the spark engine to be used for ingestion. + // Iceberg snapshot ID. + SnapshotID *int64 `json:"snapshot_id,omitempty"` +} + +// UnmarshalIcebergSourceTable unmarshals an instance of IcebergSourceTable from the specified map of raw messages. +func UnmarshalIcebergSourceTable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IcebergSourceTable) + err = core.UnmarshalPrimitive(m, "schema_name", &obj.SchemaName) + if err != nil { + err = core.SDKErrorf(err, "", "schema_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "table_name", &obj.TableName) + if err != nil { + err = core.SDKErrorf(err, "", "table_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "warehouse_name", &obj.WarehouseName) + if err != nil { + err = core.SDKErrorf(err, "", "warehouse_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "snapshot_id", &obj.SnapshotID) + if err != nil { + err = core.SDKErrorf(err, "", "snapshot_id-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IngestionEngine : Spark Engine Detail. +type IngestionEngine struct { + // Engine programmatic name. EngineID *string `json:"engine_id,omitempty"` - // Name of the spark engine to be used for ingestion. - EngineName *string `json:"engine_name,omitempty"` + // Engine display name. + Name *string `json:"name,omitempty"` + + // Engine endpoint. + Endpoint *string `json:"endpoint,omitempty"` + + // Origin - created or registered. + Origin *string `json:"origin,omitempty"` // Ingestion engine configuration. - ExecuteConfig *IngestionJobExecuteConfig `json:"execute_config,omitempty"` + ExecuteConfig *ExecuteConfig `json:"execute_config,omitempty"` + + // Storage connection details. + BucketDetails *BucketDetails `json:"bucket_details,omitempty"` + + // Engine log path. + LogPath *string `json:"log_path,omitempty"` +} + +// UnmarshalIngestionEngine unmarshals an instance of IngestionEngine from the specified map of raw messages. +func UnmarshalIngestionEngine(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IngestionEngine) + err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) + if err != nil { + err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) + if err != nil { + err = core.SDKErrorf(err, "", "endpoint-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "execute_config", &obj.ExecuteConfig, UnmarshalExecuteConfig) + if err != nil { + err = core.SDKErrorf(err, "", "execute_config-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "bucket_details", &obj.BucketDetails, UnmarshalBucketDetails) + if err != nil { + err = core.SDKErrorf(err, "", "bucket_details-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "log_path", &obj.LogPath) + if err != nil { + err = core.SDKErrorf(err, "", "log_path-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} +// IngestionJob : Ingestion job. +type IngestionJob struct { // Instance ID of the lakehouse where ingestion job is executed. InstanceID *string `json:"instance_id,omitempty"` // Job ID of the ingestion job. JobID *string `json:"job_id,omitempty"` - // partition by expression of the target table. - PartitionBy *string `json:"partition_by,omitempty"` - - // Schema definition of the source table. - Schema *string `json:"schema,omitempty"` - - // Source data location of the ingestion job. - SourceDataFiles *string `json:"source_data_files,omitempty"` + // Application ID of the ingestion job. + ApplicationID *string `json:"application_id,omitempty"` - // Source file types (parquet or csv). - SourceFileType *string `json:"source_file_type,omitempty"` + // Ingestion job user. + Username *string `json:"username,omitempty"` // Unix timestamp of ingestion job starting. - StartTimestamp *string `json:"start_timestamp,omitempty"` + StartTimestamp *strfmt.DateTime `json:"start_timestamp,omitempty"` + + // Unix timestamp of ingestion job completing. + EndTimestamp *strfmt.DateTime `json:"end_timestamp,omitempty"` // Current state of ingestion job. Status *string `json:"status,omitempty"` + // Source data location of the ingestion job. + SourceDataFiles *string `json:"source_data_files,omitempty"` + // Target table name in format catalog.schema.table. TargetTable *string `json:"target_table,omitempty"` - // Ingestion job user. - Username *string `json:"username,omitempty"` + // Error messages of failed ingestion job. + Details *string `json:"details,omitempty"` - // Validate CSV header if the target table exist. - ValidateCsvHeader *bool `json:"validate_csv_header,omitempty"` -} + // Engine application logs. + EngineLogs *string `json:"engine_logs,omitempty"` -// Constants associated with the IngestionJob.SourceFileType property. -// Source file types (parquet or csv). -const ( - IngestionJob_SourceFileType_Csv = "csv" - IngestionJob_SourceFileType_Parquet = "parquet" -) + // ID of the spark engine to be used for ingestion. + EngineID *string `json:"engine_id,omitempty"` + + // Name of the spark engine to be used for ingestion. + EngineName *string `json:"engine_name,omitempty"` + + // Comma delimited list of columns to partition by. + PartitionBy *string `json:"partition_by,omitempty"` + + // Determine if target schema was created in this ingestion job. + IsNewSchema *bool `json:"is_new_schema,omitempty"` + + // Determine if target table was created in this ingestion job. + IsNewTable *bool `json:"is_new_table,omitempty"` +} // UnmarshalIngestionJob unmarshals an instance of IngestionJob from the specified map of raw messages. func UnmarshalIngestionJob(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(IngestionJob) - err = core.UnmarshalPrimitive(m, "create_if_not_exist", &obj.CreateIfNotExist) + err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) if err != nil { - err = core.SDKErrorf(err, "", "create_if_not_exist-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "csv_property", &obj.CsvProperty, UnmarshalIngestionJobCsvProperty) + err = core.UnmarshalPrimitive(m, "job_id", &obj.JobID) if err != nil { - err = core.SDKErrorf(err, "", "csv_property-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "job_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "details", &obj.Details) + err = core.UnmarshalPrimitive(m, "application_id", &obj.ApplicationID) if err != nil { - err = core.SDKErrorf(err, "", "details-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "application_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "end_timestamp", &obj.EndTimestamp) + err = core.UnmarshalPrimitive(m, "username", &obj.Username) if err != nil { - err = core.SDKErrorf(err, "", "end_timestamp-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) + err = core.UnmarshalPrimitive(m, "start_timestamp", &obj.StartTimestamp) if err != nil { - err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "start_timestamp-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_name", &obj.EngineName) + err = core.UnmarshalPrimitive(m, "end_timestamp", &obj.EndTimestamp) if err != nil { - err = core.SDKErrorf(err, "", "engine_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "end_timestamp-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "execute_config", &obj.ExecuteConfig, UnmarshalIngestionJobExecuteConfig) + err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { - err = core.SDKErrorf(err, "", "execute_config-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) + err = core.UnmarshalPrimitive(m, "source_data_files", &obj.SourceDataFiles) if err != nil { - err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "source_data_files-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "job_id", &obj.JobID) + err = core.UnmarshalPrimitive(m, "target_table", &obj.TargetTable) if err != nil { - err = core.SDKErrorf(err, "", "job_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "target_table-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "partition_by", &obj.PartitionBy) + err = core.UnmarshalPrimitive(m, "details", &obj.Details) if err != nil { - err = core.SDKErrorf(err, "", "partition_by-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "details-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "schema", &obj.Schema) + err = core.UnmarshalPrimitive(m, "engine_logs", &obj.EngineLogs) if err != nil { - err = core.SDKErrorf(err, "", "schema-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "engine_logs-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "source_data_files", &obj.SourceDataFiles) - if err != nil { - err = core.SDKErrorf(err, "", "source_data_files-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "source_file_type", &obj.SourceFileType) - if err != nil { - err = core.SDKErrorf(err, "", "source_file_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "start_timestamp", &obj.StartTimestamp) + err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) if err != nil { - err = core.SDKErrorf(err, "", "start_timestamp-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "engine_name", &obj.EngineName) if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "engine_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "target_table", &obj.TargetTable) + err = core.UnmarshalPrimitive(m, "partition_by", &obj.PartitionBy) if err != nil { - err = core.SDKErrorf(err, "", "target_table-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "partition_by-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "username", &obj.Username) + err = core.UnmarshalPrimitive(m, "is_new_schema", &obj.IsNewSchema) if err != nil { - err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "is_new_schema-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "validate_csv_header", &obj.ValidateCsvHeader) + err = core.UnmarshalPrimitive(m, "is_new_table", &obj.IsNewTable) if err != nil { - err = core.SDKErrorf(err, "", "validate_csv_header-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "is_new_table-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// IngestionJobCollection : List ingestion jobs. +// IngestionJobCollection : Paged result for Ingestion Jobs. type IngestionJobCollection struct { - // Ingestion jobs. - IngestionJobs []IngestionJob `json:"ingestion_jobs,omitempty"` + // Pagination Limit. + Limit *int64 `json:"limit" validate:"required"` + + // Pagination Offset. + Offset *int64 `json:"offset" validate:"required"` + + // Pagination Result Total Count. + TotalCount *int64 `json:"total_count" validate:"required"` - // A page in a pagination collection. - First *IngestionJobCollectionPage `json:"first,omitempty"` + // List ingestion jobs. + Jobs []IngestionJob `json:"jobs" validate:"required"` - // A page in a pagination collection. - Next *IngestionJobCollectionPage `json:"next,omitempty"` + // Pagination next/previous page links. + First *PagedResultsLink `json:"first,omitempty"` + + // Pagination next/previous page links. + Last *PagedResultsLink `json:"last,omitempty"` + + // Pagination next/previous page links. + Next *PagedResultsLink `json:"next,omitempty"` } // UnmarshalIngestionJobCollection unmarshals an instance of IngestionJobCollection from the specified map of raw messages. func UnmarshalIngestionJobCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(IngestionJobCollection) - err = core.UnmarshalModel(m, "ingestion_jobs", &obj.IngestionJobs, UnmarshalIngestionJob) - if err != nil { - err = core.SDKErrorf(err, "", "ingestion_jobs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIngestionJobCollectionPage) - if err != nil { - err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIngestionJobCollectionPage) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// Retrieve the value to be passed to a request to access the next page of results -func (resp *IngestionJobCollection) GetNextStart() (*string, error) { - if core.IsNil(resp.Next) { - return nil, nil - } - start, err := core.GetQueryParam(resp.Next.Href, "start") - if err != nil { - err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) - return nil, err - } else if start == nil { - return nil, nil - } - return start, nil -} - -// IngestionJobCollectionPage : A page in a pagination collection. -type IngestionJobCollectionPage struct { - // Link to the a page in the collection. - Href *string `json:"href,omitempty"` -} - -// UnmarshalIngestionJobCollectionPage unmarshals an instance of IngestionJobCollectionPage from the specified map of raw messages. -func UnmarshalIngestionJobCollectionPage(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IngestionJobCollectionPage) - err = core.UnmarshalPrimitive(m, "href", &obj.Href) + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) if err != nil { - err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "offset-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// IngestionJobCsvProperty : Ingestion CSV properties. -type IngestionJobCsvProperty struct { - // Encoding used in CSV file. - Encoding *string `json:"encoding,omitempty"` - - // Escape character of CSV file. - EscapeCharacter *string `json:"escape_character,omitempty"` - - // Field delimiter of CSV file. - FieldDelimiter *string `json:"field_delimiter,omitempty"` - - // Identify if header exists in CSV file. - Header *bool `json:"header,omitempty"` - - // Line delimiter of CSV file. - LineDelimiter *string `json:"line_delimiter,omitempty"` -} - -// UnmarshalIngestionJobCsvProperty unmarshals an instance of IngestionJobCsvProperty from the specified map of raw messages. -func UnmarshalIngestionJobCsvProperty(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IngestionJobCsvProperty) - err = core.UnmarshalPrimitive(m, "encoding", &obj.Encoding) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { - err = core.SDKErrorf(err, "", "encoding-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "escape_character", &obj.EscapeCharacter) + err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalIngestionJob) if err != nil { - err = core.SDKErrorf(err, "", "escape_character-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "jobs-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "field_delimiter", &obj.FieldDelimiter) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPagedResultsLink) if err != nil { - err = core.SDKErrorf(err, "", "field_delimiter-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "header", &obj.Header) + err = core.UnmarshalModel(m, "last", &obj.Last, UnmarshalPagedResultsLink) if err != nil { - err = core.SDKErrorf(err, "", "header-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "last-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "line_delimiter", &obj.LineDelimiter) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPagedResultsLink) if err != nil { - err = core.SDKErrorf(err, "", "line_delimiter-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// IngestionJobExecuteConfig : Ingestion engine configuration. -type IngestionJobExecuteConfig struct { - // Driver core(s) configuration for Spark engine. - DriverCores *int64 `json:"driver_cores,omitempty"` - - // Driver memory configuration (in GB) for Spark engine. - DriverMemory *string `json:"driver_memory,omitempty"` - - // Executor core(s) configuration for Spark engine. - ExecutorCores *int64 `json:"executor_cores,omitempty"` - - // Executor memory configuration (in GB) for Spark engine. - ExecutorMemory *string `json:"executor_memory,omitempty"` - - // Number of executors to assign for Spark engine. - NumExecutors *int64 `json:"num_executors,omitempty"` -} - -// UnmarshalIngestionJobExecuteConfig unmarshals an instance of IngestionJobExecuteConfig from the specified map of raw messages. -func UnmarshalIngestionJobExecuteConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IngestionJobExecuteConfig) - err = core.UnmarshalPrimitive(m, "driver_cores", &obj.DriverCores) - if err != nil { - err = core.SDKErrorf(err, "", "driver_cores-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "driver_memory", &obj.DriverMemory) - if err != nil { - err = core.SDKErrorf(err, "", "driver_memory-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "executor_cores", &obj.ExecutorCores) - if err != nil { - err = core.SDKErrorf(err, "", "executor_cores-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "executor_memory", &obj.ExecutorMemory) - if err != nil { - err = core.SDKErrorf(err, "", "executor_memory-error", common.GetComponentInfo()) - return +// Retrieve the value to be passed to a request to access the next page of results +func (resp *IngestionJobCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil } - err = core.UnmarshalPrimitive(m, "num_executors", &obj.NumExecutors) + start, err := core.GetQueryParam(resp.Next.Href, "start") if err != nil { - err = core.SDKErrorf(err, "", "num_executors-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return + return start, nil } -// IngestionJobPrototypeCsvProperty : Ingestion CSV properties. -type IngestionJobPrototypeCsvProperty struct { - // Encoding used in CSV file. - Encoding *string `json:"encoding,omitempty"` - - // Escape character of CSV file. - EscapeCharacter *string `json:"escape_character,omitempty"` - - // Field delimiter of CSV file. - FieldDelimiter *string `json:"field_delimiter,omitempty"` +// IngestionSchemaResponse : Schema information derived from file. +type IngestionSchemaResponse struct { + // Schema column field ID. + FieldID *int64 `json:"field_id,omitempty"` - // Identify if header exists in CSV file. - Header *bool `json:"header,omitempty"` + // Schema column header name. + HeaderName *string `json:"header_name,omitempty"` - // Line delimiter of CSV file. - LineDelimiter *string `json:"line_delimiter,omitempty"` + // Schema column data type. + Type *string `json:"type,omitempty"` } -// UnmarshalIngestionJobPrototypeCsvProperty unmarshals an instance of IngestionJobPrototypeCsvProperty from the specified map of raw messages. -func UnmarshalIngestionJobPrototypeCsvProperty(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IngestionJobPrototypeCsvProperty) - err = core.UnmarshalPrimitive(m, "encoding", &obj.Encoding) - if err != nil { - err = core.SDKErrorf(err, "", "encoding-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "escape_character", &obj.EscapeCharacter) +// UnmarshalIngestionSchemaResponse unmarshals an instance of IngestionSchemaResponse from the specified map of raw messages. +func UnmarshalIngestionSchemaResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IngestionSchemaResponse) + err = core.UnmarshalPrimitive(m, "field_id", &obj.FieldID) if err != nil { - err = core.SDKErrorf(err, "", "escape_character-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "field_delimiter", &obj.FieldDelimiter) - if err != nil { - err = core.SDKErrorf(err, "", "field_delimiter-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "field_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "header", &obj.Header) + err = core.UnmarshalPrimitive(m, "header_name", &obj.HeaderName) if err != nil { - err = core.SDKErrorf(err, "", "header-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "header_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "line_delimiter", &obj.LineDelimiter) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "line_delimiter-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// IngestionJobPrototypeExecuteConfig : Ingestion engine configuration. -type IngestionJobPrototypeExecuteConfig struct { - // Driver core(s) configuration for Spark engine. - DriverCores *int64 `json:"driver_cores,omitempty"` - - // Driver memory configuration (in GB) for Spark engine. - DriverMemory *string `json:"driver_memory,omitempty"` - - // Executor core(s) configuration for Spark engine. - ExecutorCores *int64 `json:"executor_cores,omitempty"` +// Integration : Response body for the POST/GET/PATCH Request for an integration in watsonx.Data. +type Integration struct { + // Access Token for the integration of type `databand`. The value will be encrypted. + AccessToken *string `json:"access_token,omitempty"` - // Executor memory configuration (in GB) for Spark engine. - ExecutorMemory *string `json:"executor_memory,omitempty"` + // ApiKey for the integration of type `manta` and `ikc`. The value will be encrypted. + Apikey *string `json:"apikey,omitempty"` - // Number of executors to assign for Spark engine. - NumExecutors *int64 `json:"num_executors,omitempty"` -} + // Authentication url for the corresponding `manta` integration in saas (Internal use only). + AuthURL *string `json:"auth_url,omitempty"` -// UnmarshalIngestionJobPrototypeExecuteConfig unmarshals an instance of IngestionJobPrototypeExecuteConfig from the specified map of raw messages. -func UnmarshalIngestionJobPrototypeExecuteConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(IngestionJobPrototypeExecuteConfig) - err = core.UnmarshalPrimitive(m, "driver_cores", &obj.DriverCores) - if err != nil { - err = core.SDKErrorf(err, "", "driver_cores-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "driver_memory", &obj.DriverMemory) - if err != nil { - err = core.SDKErrorf(err, "", "driver_memory-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "executor_cores", &obj.ExecutorCores) - if err != nil { - err = core.SDKErrorf(err, "", "executor_cores-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "executor_memory", &obj.ExecutorMemory) - if err != nil { - err = core.SDKErrorf(err, "", "executor_memory-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "num_executors", &obj.NumExecutors) - if err != nil { - err = core.SDKErrorf(err, "", "num_executors-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // Details of catalogs associated with `ikc`. + Catalogs *Catalogs `json:"catalogs,omitempty"` -// Integration : Integration. -type Integration struct { - // Integration APIKEY. - Apikey *string `json:"apikey,omitempty"` + // Certificate if ssl is enabled for integration type `ikc` (ikc hosted in Cloud Pack for Data) and `ranger`. + Certificate *string `json:"certificate,omitempty"` - // token for databand. - AccessToken *string `json:"access_token,omitempty"` + // Certificate extension of the certificate provided if ssl is enabled for integration type `ikc` (ikc hosted in Cloud + // Pack for Data) and `ranger`. + CertificateExtension *string `json:"certificate_extension,omitempty"` - // Properties. + // Properties for `ikc`. ConfigProperties *string `json:"config_properties,omitempty"` - // auth_url for corresponding manta in saas. - AuthURL *string `json:"auth_url,omitempty"` - - // resouce for ranger. - IntegrationID *string `json:"integration_id,omitempty"` + // Connection mode for manta. + ConnectionMode *string `json:"connection_mode,omitempty"` - // cross account integration enabler/disabler. + // To enable/disable cross account integration for `ikc` in IBM Cloud / MCSP. CrossAccountIntegration *bool `json:"cross_account_integration,omitempty"` - // data policy enabler with wxd for ranger. + // To check if WatsonX.data policies are enabled along with `ranger`. EnableDataPolicyWithinWxd *bool `json:"enable_data_policy_within_wxd,omitempty"` - // Properties. + // Properties for `ikc`. GovernanceProperties *string `json:"governance_properties,omitempty"` - // ikc_user_account_id for ikc. + // Unique id to identify the integration. + ID *string `json:"id,omitempty"` + + // The Account ID where the `ikc` is existing with which cross account integration needs to be enabled, to be used + // compulsorily with `cross_account_integration`. IkcUserAccountID *string `json:"ikc_user_account_id,omitempty"` - // manta_url modifeid from url for manta in saas. + // Manta specific Url derived from the url provided for `manta` integration in Saas. MantaURL *string `json:"manta_url,omitempty"` - // modified time in epoch format. + // Last Modified time for the corresponding integration in epoch format. ModifiedAt *int64 `json:"modified_at,omitempty"` - // modified user name. + // Last Modified user name for the corresponding integration. ModifiedBy *string `json:"modified_by,omitempty"` - // Integration password. + // Password for the integration of type `ranger`. The value will be encrypted. Password *string `json:"password,omitempty"` - // resouce for ranger. + // Displays the policy cache type configuration for integration type `ranger`. + PolicyCacheTimeConfiguration *string `json:"policy_cache_time_configuration,omitempty"` + + // Currently selected resource for `ranger`. Resource *string `json:"resource,omitempty"` - // Integration type. - ServiceType *string `json:"service_type,omitempty"` + // SSL enabled/disabled for `ikc` (ikc hosted in Cloud Pack for Data) and `ranger`. + Ssl *bool `json:"ssl,omitempty"` - // current state. - State *string `json:"state,omitempty"` + // Current state of the integration. + State *string `json:"state" validate:"required"` - // Comma separated list of storage catalogs for which ikc needs to be enabled. - StorageCatalogs []string `json:"storage_catalogs,omitempty"` + // Type of the integration integrated. It will only have the following values: `ranger`, `ikc`, `databand` and + // `manta`. + Type *string `json:"type,omitempty"` - // Integration Connection URL. + // URL of the integration. Applicable for all the 4 types: `ranger`, `ikc`, `databand` and `manta`. URL *string `json:"url,omitempty"` - // Integration Zen API key. - ZenApikey *string `json:"zen_apikey,omitempty"` - - // Username. + // Username of the `ikc`/`manta`/`ranger` integration. Username *string `json:"username,omitempty"` + + // Zen API key for the integration of type `manta` (Internal use only). + ZenApikey *string `json:"zen_apikey,omitempty"` } +// Constants associated with the Integration.State property. +// Current state of the integration. +const ( + Integration_State_Active = "active" + Integration_State_Failed = "failed" + Integration_State_Inactive = "inactive" + Integration_State_Pending = "pending" +) + // UnmarshalIntegration unmarshals an instance of Integration from the specified map of raw messages. func UnmarshalIntegration(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(Integration) - err = core.UnmarshalPrimitive(m, "apikey", &obj.Apikey) - if err != nil { - err = core.SDKErrorf(err, "", "apikey-error", common.GetComponentInfo()) - return - } err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) if err != nil { err = core.SDKErrorf(err, "", "access_token-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "config_properties", &obj.ConfigProperties) + err = core.UnmarshalPrimitive(m, "apikey", &obj.Apikey) if err != nil { - err = core.SDKErrorf(err, "", "config_properties-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "apikey-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "auth_url", &obj.AuthURL) @@ -20147,27 +22016,52 @@ func UnmarshalIntegration(m map[string]json.RawMessage, result interface{}) (err err = core.SDKErrorf(err, "", "auth_url-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "integration_id", &obj.IntegrationID) + err = core.UnmarshalModel(m, "catalogs", &obj.Catalogs, UnmarshalCatalogs) if err != nil { - err = core.SDKErrorf(err, "", "integration_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "catalogs-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "cross_account_integration", &obj.CrossAccountIntegration) + err = core.UnmarshalPrimitive(m, "certificate", &obj.Certificate) if err != nil { - err = core.SDKErrorf(err, "", "cross_account_integration-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "certificate-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "enable_data_policy_within_wxd", &obj.EnableDataPolicyWithinWxd) + err = core.UnmarshalPrimitive(m, "certificate_extension", &obj.CertificateExtension) if err != nil { - err = core.SDKErrorf(err, "", "enable_data_policy_within_wxd-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "certificate_extension-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "governance_properties", &obj.GovernanceProperties) + err = core.UnmarshalPrimitive(m, "config_properties", &obj.ConfigProperties) if err != nil { - err = core.SDKErrorf(err, "", "governance_properties-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "config_properties-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "ikc_user_account_id", &obj.IkcUserAccountID) + err = core.UnmarshalPrimitive(m, "connection_mode", &obj.ConnectionMode) + if err != nil { + err = core.SDKErrorf(err, "", "connection_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "cross_account_integration", &obj.CrossAccountIntegration) + if err != nil { + err = core.SDKErrorf(err, "", "cross_account_integration-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "enable_data_policy_within_wxd", &obj.EnableDataPolicyWithinWxd) + if err != nil { + err = core.SDKErrorf(err, "", "enable_data_policy_within_wxd-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "governance_properties", &obj.GovernanceProperties) + if err != nil { + err = core.SDKErrorf(err, "", "governance_properties-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "ikc_user_account_id", &obj.IkcUserAccountID) if err != nil { err = core.SDKErrorf(err, "", "ikc_user_account_id-error", common.GetComponentInfo()) return @@ -20192,14 +22086,19 @@ func UnmarshalIntegration(m map[string]json.RawMessage, result interface{}) (err err = core.SDKErrorf(err, "", "password-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "policy_cache_time_configuration", &obj.PolicyCacheTimeConfiguration) + if err != nil { + err = core.SDKErrorf(err, "", "policy_cache_time_configuration-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "resource", &obj.Resource) if err != nil { err = core.SDKErrorf(err, "", "resource-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "service_type", &obj.ServiceType) + err = core.UnmarshalPrimitive(m, "ssl", &obj.Ssl) if err != nil { - err = core.SDKErrorf(err, "", "service_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "ssl-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "state", &obj.State) @@ -20207,9 +22106,9 @@ func UnmarshalIntegration(m map[string]json.RawMessage, result interface{}) (err err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "storage_catalogs", &obj.StorageCatalogs) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "storage_catalogs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) @@ -20217,14 +22116,14 @@ func UnmarshalIntegration(m map[string]json.RawMessage, result interface{}) (err err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "zen_apikey", &obj.ZenApikey) + err = core.UnmarshalPrimitive(m, "username", &obj.Username) if err != nil { - err = core.SDKErrorf(err, "", "zen_apikey-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "username", &obj.Username) + err = core.UnmarshalPrimitive(m, "zen_apikey", &obj.ZenApikey) if err != nil { - err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "zen_apikey-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -20234,7 +22133,7 @@ func UnmarshalIntegration(m map[string]json.RawMessage, result interface{}) (err // IntegrationCollection : list all existing integrations. type IntegrationCollection struct { // Database body. - Integrations []Integration `json:"integrations,omitempty"` + Integrations []Integration `json:"integrations" validate:"required"` } // UnmarshalIntegrationCollection unmarshals an instance of IntegrationCollection from the specified map of raw messages. @@ -20249,42 +22148,67 @@ func UnmarshalIntegrationCollection(m map[string]json.RawMessage, result interfa return } -// IntegrationPatch : Update an Integration body. +// IntegrationPatch : Request body of the PATCH Request for modifying an integration in watsonx.Data. type IntegrationPatch struct { - // token for databand. + // Access Token for the integration of type `databand`. AccessToken *string `json:"access_token,omitempty"` - // Integration APIKEY. + // ApiKey for the integration of type `manta` and `ikc`. Apikey *string `json:"apikey,omitempty"` - // cross account integration enabler/disabler. + // Details of catalogs associated with `ikc`. + Catalogs *Catalogs `json:"catalogs,omitempty"` + + // Certificate if ssl is enabled for integration type `ikc` (ikc hosted in Cloud Pack for Data) and `ranger`. + Certificate *string `json:"certificate,omitempty"` + + // Certificate extension of the certificate provided if ssl is enabled for integration type `ikc` (ikc hosted in Cloud + // Pack for Data) and `ranger`. + CertificateExtension *string `json:"certificate_extension,omitempty"` + + // Connection mode for manta. + ConnectionMode *string `json:"connection_mode,omitempty"` + + // To enable/disable cross account integration for `ikc` in IBM Cloud / MCSP. CrossAccountIntegration *bool `json:"cross_account_integration,omitempty"` - // data policy enabler with wxd for ranger. + // To check if WatsonX.data policies are enabled along with `ranger`. EnableDataPolicyWithinWxd *bool `json:"enable_data_policy_within_wxd,omitempty"` - // token for databand. + // The Account ID where the `ikc` is existing with which cross account integration needs to be enabled, to be used + // compulsorily with `cross_account_integration`. IkcUserAccountID *string `json:"ikc_user_account_id,omitempty"` - // Integration password. + // Password for the integration of type `ranger`. Password *string `json:"password,omitempty"` - // resouce for ranger. + // Displays the policy cache type configuration for integration type `ranger`. + PolicyCacheTimeConfiguration *string `json:"policy_cache_time_configuration,omitempty"` + + // Currently selected resource for `ranger`. Resource *string `json:"resource,omitempty"` + // SSL enabled/disabled for `ikc` (ikc hosted in Cloud Pack for Data) and `ranger`. + Ssl *bool `json:"ssl,omitempty"` + // current state. State *string `json:"state,omitempty"` - // Comma separated list of bucket catalogs which have ikc enabled. - StorageCatalogs []string `json:"storage_catalogs,omitempty"` - - // Integration Connection URL. + // URL of the integration to be integrated. Applicable for all the 4 types: `ranger`, `ikc`, `databand` and `manta`. URL *string `json:"url,omitempty"` - // Integration username. + // Username of the `ikc`/`manta`/`ranger` integration to be integrated. Username *string `json:"username,omitempty"` } +// Constants associated with the IntegrationPatch.State property. +// current state. +const ( + IntegrationPatch_State_Active = "active" + IntegrationPatch_State_Failed = "failed" + IntegrationPatch_State_Inactive = "inactive" +) + // UnmarshalIntegrationPatch unmarshals an instance of IntegrationPatch from the specified map of raw messages. func UnmarshalIntegrationPatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(IntegrationPatch) @@ -20298,6 +22222,26 @@ func UnmarshalIntegrationPatch(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "apikey-error", common.GetComponentInfo()) return } + err = core.UnmarshalModel(m, "catalogs", &obj.Catalogs, UnmarshalCatalogs) + if err != nil { + err = core.SDKErrorf(err, "", "catalogs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "certificate", &obj.Certificate) + if err != nil { + err = core.SDKErrorf(err, "", "certificate-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "certificate_extension", &obj.CertificateExtension) + if err != nil { + err = core.SDKErrorf(err, "", "certificate_extension-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "connection_mode", &obj.ConnectionMode) + if err != nil { + err = core.SDKErrorf(err, "", "connection_mode-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "cross_account_integration", &obj.CrossAccountIntegration) if err != nil { err = core.SDKErrorf(err, "", "cross_account_integration-error", common.GetComponentInfo()) @@ -20318,19 +22262,24 @@ func UnmarshalIntegrationPatch(m map[string]json.RawMessage, result interface{}) err = core.SDKErrorf(err, "", "password-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "policy_cache_time_configuration", &obj.PolicyCacheTimeConfiguration) + if err != nil { + err = core.SDKErrorf(err, "", "policy_cache_time_configuration-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "resource", &obj.Resource) if err != nil { err = core.SDKErrorf(err, "", "resource-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "state", &obj.State) + err = core.UnmarshalPrimitive(m, "ssl", &obj.Ssl) if err != nil { - err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "ssl-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "storage_catalogs", &obj.StorageCatalogs) + err = core.UnmarshalPrimitive(m, "state", &obj.State) if err != nil { - err = core.SDKErrorf(err, "", "storage_catalogs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "url", &obj.URL) @@ -20356,6 +22305,18 @@ func (integrationPatch *IntegrationPatch) AsPatch() (_patch map[string]interface if !core.IsNil(integrationPatch.Apikey) { _patch["apikey"] = integrationPatch.Apikey } + if !core.IsNil(integrationPatch.Catalogs) { + _patch["catalogs"] = integrationPatch.Catalogs.asPatch() + } + if !core.IsNil(integrationPatch.Certificate) { + _patch["certificate"] = integrationPatch.Certificate + } + if !core.IsNil(integrationPatch.CertificateExtension) { + _patch["certificate_extension"] = integrationPatch.CertificateExtension + } + if !core.IsNil(integrationPatch.ConnectionMode) { + _patch["connection_mode"] = integrationPatch.ConnectionMode + } if !core.IsNil(integrationPatch.CrossAccountIntegration) { _patch["cross_account_integration"] = integrationPatch.CrossAccountIntegration } @@ -20368,15 +22329,18 @@ func (integrationPatch *IntegrationPatch) AsPatch() (_patch map[string]interface if !core.IsNil(integrationPatch.Password) { _patch["password"] = integrationPatch.Password } + if !core.IsNil(integrationPatch.PolicyCacheTimeConfiguration) { + _patch["policy_cache_time_configuration"] = integrationPatch.PolicyCacheTimeConfiguration + } if !core.IsNil(integrationPatch.Resource) { _patch["resource"] = integrationPatch.Resource } + if !core.IsNil(integrationPatch.Ssl) { + _patch["ssl"] = integrationPatch.Ssl + } if !core.IsNil(integrationPatch.State) { _patch["state"] = integrationPatch.State } - if !core.IsNil(integrationPatch.StorageCatalogs) { - _patch["storage_catalogs"] = integrationPatch.StorageCatalogs - } if !core.IsNil(integrationPatch.URL) { _patch["url"] = integrationPatch.URL } @@ -20387,76 +22351,140 @@ func (integrationPatch *IntegrationPatch) AsPatch() (_patch map[string]interface return } -// InternalDetails : Details for the internal component. -type InternalDetails struct { - // Port. - Port *int64 `json:"port,omitempty"` +// JSONPatchOperation : This model represents an individual patch operation to be performed on a JSON document, as defined by RFC 6902. +type JSONPatchOperation struct { + // The operation to be performed. + Op *string `json:"op" validate:"required"` - // Internal Host name. - Hostname *string `json:"hostname,omitempty"` + // The JSON Pointer that identifies the field that is the target of the operation. + Path *string `json:"path" validate:"required"` + + // The JSON Pointer that identifies the field that is the source of the operation. + From *string `json:"from,omitempty"` + + // The value to be used within the operation. + Value interface{} `json:"value,omitempty"` } -// UnmarshalInternalDetails unmarshals an instance of InternalDetails from the specified map of raw messages. -func UnmarshalInternalDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(InternalDetails) - err = core.UnmarshalPrimitive(m, "port", &obj.Port) +// Constants associated with the JSONPatchOperation.Op property. +// The operation to be performed. +const ( + JSONPatchOperation_Op_Add = "add" + JSONPatchOperation_Op_Copy = "copy" + JSONPatchOperation_Op_Move = "move" + JSONPatchOperation_Op_Remove = "remove" + JSONPatchOperation_Op_Replace = "replace" + JSONPatchOperation_Op_Test = "test" +) + +// NewJSONPatchOperation : Instantiate JSONPatchOperation (Generic Model Constructor) +func (*WatsonxDataV3) NewJSONPatchOperation(op string, path string) (_model *JSONPatchOperation, err error) { + _model = &JSONPatchOperation{ + Op: core.StringPtr(op), + Path: core.StringPtr(path), + } + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalJSONPatchOperation unmarshals an instance of JSONPatchOperation from the specified map of raw messages. +func UnmarshalJSONPatchOperation(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(JSONPatchOperation) + err = core.UnmarshalPrimitive(m, "op", &obj.Op) + if err != nil { + err = core.SDKErrorf(err, "", "op-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + err = core.UnmarshalPrimitive(m, "path", &obj.Path) if err != nil { - err = core.SDKErrorf(err, "", "hostname-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "path-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "from", &obj.From) + if err != nil { + err = core.SDKErrorf(err, "", "from-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// JdbcThriftUrls : JDBC Thrift Urls. -type JdbcThriftUrls struct { - External *string `json:"external,omitempty"` +// JvmProperties : JVM configuration properties for coordinator and worker nodes. +type JvmProperties struct { + // JVM properties for coordinator node. + Coordinator map[string]string `json:"coordinator,omitempty"` - Internal *string `json:"internal,omitempty"` + // JVM properties for worker nodes. + Worker map[string]string `json:"worker,omitempty"` } -// UnmarshalJdbcThriftUrls unmarshals an instance of JdbcThriftUrls from the specified map of raw messages. -func UnmarshalJdbcThriftUrls(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(JdbcThriftUrls) - err = core.UnmarshalPrimitive(m, "external", &obj.External) +// UnmarshalJvmProperties unmarshals an instance of JvmProperties from the specified map of raw messages. +func UnmarshalJvmProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(JvmProperties) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "external-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "internal", &obj.Internal) + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) if err != nil { - err = core.SDKErrorf(err, "", "internal-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } +// asPatch returns a generic map representation of the JvmProperties +func (jvmProperties *JvmProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(jvmProperties.Coordinator) { + _patch["coordinator"] = jvmProperties.Coordinator + } + if !core.IsNil(jvmProperties.Worker) { + _patch["worker"] = jvmProperties.Worker + } + + return +} + // ListAllIntegrationsOptions : The ListAllIntegrations options. type ListAllIntegrationsOptions struct { - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // API Authentication service token. Secret *string `json:"Secret,omitempty"` - // service_type. - ServiceType *string `json:"service_type,omitempty"` + // Filter based on the type of the integration. It can only have the following values: `ranger`, `ikc`, `databand` and + // `manta`. + Type []string `json:"type,omitempty"` - // state. + // Filter based on the state of the integration. It can only have the following values: `active`, `inactive`, and + // `failed`. State []string `json:"state,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } +// Constants associated with the ListAllIntegrationsOptions.State property. +const ( + ListAllIntegrationsOptions_State_Active = "active" + ListAllIntegrationsOptions_State_Failed = "failed" + ListAllIntegrationsOptions_State_Inactive = "inactive" +) + // NewListAllIntegrationsOptions : Instantiate ListAllIntegrationsOptions -func (*WatsonxDataV2) NewListAllIntegrationsOptions() *ListAllIntegrationsOptions { +func (*WatsonxDataV3) NewListAllIntegrationsOptions() *ListAllIntegrationsOptions { return &ListAllIntegrationsOptions{} } @@ -20472,9 +22500,9 @@ func (_options *ListAllIntegrationsOptions) SetSecret(secret string) *ListAllInt return _options } -// SetServiceType : Allow user to set ServiceType -func (_options *ListAllIntegrationsOptions) SetServiceType(serviceType string) *ListAllIntegrationsOptions { - _options.ServiceType = core.StringPtr(serviceType) +// SetType : Allow user to set Type +func (_options *ListAllIntegrationsOptions) SetType(typeVar []string) *ListAllIntegrationsOptions { + _options.Type = typeVar return _options } @@ -20490,266 +22518,245 @@ func (options *ListAllIntegrationsOptions) SetHeaders(param map[string]string) * return options } -// ListAllSchemasOptions : The ListAllSchemas options. -type ListAllSchemasOptions struct { - // Catalog name. - CatalogName *string `json:"catalog_name,omitempty"` - - // CRN. +// ListCatalogsOptions : The ListCatalogs options. +type ListCatalogsOptions struct { + // watsonx.data instance ID for software , CRN for SAAS or CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // API Authentication service token. + Secret *string `json:"Secret,omitempty"` + + // Default catalogs flag for cornerstone feature. + DefaultCatalogs *bool `json:"default_catalogs,omitempty"` + + // Internal view parameter for cornerstone feature. + View *string `json:"view,omitempty"` + // Allows users to set headers on API requests. Headers map[string]string } -// NewListAllSchemasOptions : Instantiate ListAllSchemasOptions -func (*WatsonxDataV2) NewListAllSchemasOptions() *ListAllSchemasOptions { - return &ListAllSchemasOptions{} +// NewListCatalogsOptions : Instantiate ListCatalogsOptions +func (*WatsonxDataV3) NewListCatalogsOptions() *ListCatalogsOptions { + return &ListCatalogsOptions{} } -// SetCatalogName : Allow user to set CatalogName -func (_options *ListAllSchemasOptions) SetCatalogName(catalogName string) *ListAllSchemasOptions { - _options.CatalogName = core.StringPtr(catalogName) +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ListCatalogsOptions) SetAuthInstanceID(authInstanceID string) *ListCatalogsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListAllSchemasOptions) SetAuthInstanceID(authInstanceID string) *ListAllSchemasOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) +// SetSecret : Allow user to set Secret +func (_options *ListCatalogsOptions) SetSecret(secret string) *ListCatalogsOptions { + _options.Secret = core.StringPtr(secret) + return _options +} + +// SetDefaultCatalogs : Allow user to set DefaultCatalogs +func (_options *ListCatalogsOptions) SetDefaultCatalogs(defaultCatalogs bool) *ListCatalogsOptions { + _options.DefaultCatalogs = core.BoolPtr(defaultCatalogs) + return _options +} + +// SetView : Allow user to set View +func (_options *ListCatalogsOptions) SetView(view string) *ListCatalogsOptions { + _options.View = core.StringPtr(view) return _options } // SetHeaders : Allow user to set Headers -func (options *ListAllSchemasOptions) SetHeaders(param map[string]string) *ListAllSchemasOptions { +func (options *ListCatalogsOptions) SetHeaders(param map[string]string) *ListCatalogsOptions { options.Headers = param return options } -// ListAllTablesOptions : The ListAllTables options. -type ListAllTablesOptions struct { - // Catalog name. - CatalogName *string `json:"catalog_name,omitempty"` +// ListColumnsOptions : The ListColumns options. +type ListColumnsOptions struct { + // engine id. + EngineID *string `json:"engine_id" validate:"required"` - // Schema name. - SchemaName *string `json:"schema_name,omitempty"` + // catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` + + // URL encoded schema name. + SchemaName *string `json:"schema_name" validate:"required,ne="` - // CRN. + // URL encoded table name. + TableName *string `json:"table_name" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewListAllTablesOptions : Instantiate ListAllTablesOptions -func (*WatsonxDataV2) NewListAllTablesOptions() *ListAllTablesOptions { - return &ListAllTablesOptions{} +// NewListColumnsOptions : Instantiate ListColumnsOptions +func (*WatsonxDataV3) NewListColumnsOptions(engineID string, catalogName string, schemaName string, tableName string) *ListColumnsOptions { + return &ListColumnsOptions{ + EngineID: core.StringPtr(engineID), + CatalogName: core.StringPtr(catalogName), + SchemaName: core.StringPtr(schemaName), + TableName: core.StringPtr(tableName), + } +} + +// SetEngineID : Allow user to set EngineID +func (_options *ListColumnsOptions) SetEngineID(engineID string) *ListColumnsOptions { + _options.EngineID = core.StringPtr(engineID) + return _options } // SetCatalogName : Allow user to set CatalogName -func (_options *ListAllTablesOptions) SetCatalogName(catalogName string) *ListAllTablesOptions { +func (_options *ListColumnsOptions) SetCatalogName(catalogName string) *ListColumnsOptions { _options.CatalogName = core.StringPtr(catalogName) return _options } // SetSchemaName : Allow user to set SchemaName -func (_options *ListAllTablesOptions) SetSchemaName(schemaName string) *ListAllTablesOptions { +func (_options *ListColumnsOptions) SetSchemaName(schemaName string) *ListColumnsOptions { _options.SchemaName = core.StringPtr(schemaName) return _options } +// SetTableName : Allow user to set TableName +func (_options *ListColumnsOptions) SetTableName(tableName string) *ListColumnsOptions { + _options.TableName = core.StringPtr(tableName) + return _options +} + // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListAllTablesOptions) SetAuthInstanceID(authInstanceID string) *ListAllTablesOptions { +func (_options *ListColumnsOptions) SetAuthInstanceID(authInstanceID string) *ListColumnsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *ListAllTablesOptions) SetHeaders(param map[string]string) *ListAllTablesOptions { +func (options *ListColumnsOptions) SetHeaders(param map[string]string) *ListColumnsOptions { options.Headers = param return options } -// ListBucketObjectsOptions : The ListBucketObjects options. -type ListBucketObjectsOptions struct { - // bucket id. - BucketID *string `json:"bucket_id" validate:"required,ne="` - - // CRN. +// ListDataPoliciesOptions : The ListDataPolicies options. +type ListDataPoliciesOptions struct { + // Unique identifier assigned to a specific watsonx.data instance. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // path. - Path *string `json:"path,omitempty"` + // name of catalog as query param to filter the data polciies. + CatalogName *string `json:"catalog_name,omitempty"` + + // resource identifier as query param to filter the data policies. + ResourceID *string `json:"resource_id,omitempty"` + + // policy status as query param to filter the data policies. + Status *string `json:"status,omitempty"` + + // include_metadata is a boolean query param which can be set as true if metadata policy is needed in response of get + // data policies else set it as false. + IncludeMetadata *bool `json:"include_metadata,omitempty"` + + // include_rules is a boolean query param which can be set as true if rules are needed in response of get data policies + // else set it as false. + IncludeRules *bool `json:"include_rules,omitempty"` + + // Bucket Name is a qualified name of a storage bucket . It is of the format `bucket name`. Specify `bucket_name` along + // with `data_artifact` to fetch policy for a bucket applicable to a data artifact. + BucketName *string `json:"bucket_name,omitempty"` + + // Service Name is a qualified name of a service used . It is of the format `service name`. Specify `service_name` + // along with `data_artifact` to fetch policy for a service applicable to a data artifact. + ServiceName *string `json:"service_name,omitempty"` + + // Data Artifact is a fully qualified table name . It is of the format `schema name:table name`. Specify `catalog_name` + // along with `data_artifact` to fetch policy applicable to a data artifact. + DataArtifact *string `json:"data_artifact,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewListBucketObjectsOptions : Instantiate ListBucketObjectsOptions -func (*WatsonxDataV2) NewListBucketObjectsOptions(bucketID string) *ListBucketObjectsOptions { - return &ListBucketObjectsOptions{ - BucketID: core.StringPtr(bucketID), - } +// NewListDataPoliciesOptions : Instantiate ListDataPoliciesOptions +func (*WatsonxDataV3) NewListDataPoliciesOptions() *ListDataPoliciesOptions { + return &ListDataPoliciesOptions{} } -// SetBucketID : Allow user to set BucketID -func (_options *ListBucketObjectsOptions) SetBucketID(bucketID string) *ListBucketObjectsOptions { - _options.BucketID = core.StringPtr(bucketID) +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ListDataPoliciesOptions) SetAuthInstanceID(authInstanceID string) *ListDataPoliciesOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListBucketObjectsOptions) SetAuthInstanceID(authInstanceID string) *ListBucketObjectsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) +// SetCatalogName : Allow user to set CatalogName +func (_options *ListDataPoliciesOptions) SetCatalogName(catalogName string) *ListDataPoliciesOptions { + _options.CatalogName = core.StringPtr(catalogName) return _options } -// SetPath : Allow user to set Path -func (_options *ListBucketObjectsOptions) SetPath(path string) *ListBucketObjectsOptions { - _options.Path = core.StringPtr(path) +// SetResourceID : Allow user to set ResourceID +func (_options *ListDataPoliciesOptions) SetResourceID(resourceID string) *ListDataPoliciesOptions { + _options.ResourceID = core.StringPtr(resourceID) return _options } -// SetHeaders : Allow user to set Headers -func (options *ListBucketObjectsOptions) SetHeaders(param map[string]string) *ListBucketObjectsOptions { - options.Headers = param - return options +// SetStatus : Allow user to set Status +func (_options *ListDataPoliciesOptions) SetStatus(status string) *ListDataPoliciesOptions { + _options.Status = core.StringPtr(status) + return _options } -// ListBucketRegistrationsOptions : The ListBucketRegistrations options. -type ListBucketRegistrationsOptions struct { - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` +// SetIncludeMetadata : Allow user to set IncludeMetadata +func (_options *ListDataPoliciesOptions) SetIncludeMetadata(includeMetadata bool) *ListDataPoliciesOptions { + _options.IncludeMetadata = core.BoolPtr(includeMetadata) + return _options +} - // Allows users to set headers on API requests. - Headers map[string]string +// SetIncludeRules : Allow user to set IncludeRules +func (_options *ListDataPoliciesOptions) SetIncludeRules(includeRules bool) *ListDataPoliciesOptions { + _options.IncludeRules = core.BoolPtr(includeRules) + return _options +} + +// SetBucketName : Allow user to set BucketName +func (_options *ListDataPoliciesOptions) SetBucketName(bucketName string) *ListDataPoliciesOptions { + _options.BucketName = core.StringPtr(bucketName) + return _options } -// NewListBucketRegistrationsOptions : Instantiate ListBucketRegistrationsOptions -func (*WatsonxDataV2) NewListBucketRegistrationsOptions() *ListBucketRegistrationsOptions { - return &ListBucketRegistrationsOptions{} +// SetServiceName : Allow user to set ServiceName +func (_options *ListDataPoliciesOptions) SetServiceName(serviceName string) *ListDataPoliciesOptions { + _options.ServiceName = core.StringPtr(serviceName) + return _options } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListBucketRegistrationsOptions) SetAuthInstanceID(authInstanceID string) *ListBucketRegistrationsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) +// SetDataArtifact : Allow user to set DataArtifact +func (_options *ListDataPoliciesOptions) SetDataArtifact(dataArtifact string) *ListDataPoliciesOptions { + _options.DataArtifact = core.StringPtr(dataArtifact) return _options } // SetHeaders : Allow user to set Headers -func (options *ListBucketRegistrationsOptions) SetHeaders(param map[string]string) *ListBucketRegistrationsOptions { +func (options *ListDataPoliciesOptions) SetHeaders(param map[string]string) *ListDataPoliciesOptions { options.Headers = param return options } -// ListCatalogsOptions : The ListCatalogs options. -type ListCatalogsOptions struct { - // CRN. +// ListDatabaseRegistrationsOptions : The ListDatabaseRegistrations options. +type ListDatabaseRegistrationsOptions struct { + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewListCatalogsOptions : Instantiate ListCatalogsOptions -func (*WatsonxDataV2) NewListCatalogsOptions() *ListCatalogsOptions { - return &ListCatalogsOptions{} +// NewListDatabaseRegistrationsOptions : Instantiate ListDatabaseRegistrationsOptions +func (*WatsonxDataV3) NewListDatabaseRegistrationsOptions() *ListDatabaseRegistrationsOptions { + return &ListDatabaseRegistrationsOptions{} } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListCatalogsOptions) SetAuthInstanceID(authInstanceID string) *ListCatalogsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListCatalogsOptions) SetHeaders(param map[string]string) *ListCatalogsOptions { - options.Headers = param - return options -} - -// ListColumnsOptions : The ListColumns options. -type ListColumnsOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required"` - - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` - - // URL encoded schema name. - SchemaID *string `json:"schema_id" validate:"required,ne="` - - // URL encoded schema name. - TableID *string `json:"table_id" validate:"required,ne="` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewListColumnsOptions : Instantiate ListColumnsOptions -func (*WatsonxDataV2) NewListColumnsOptions(engineID string, catalogID string, schemaID string, tableID string) *ListColumnsOptions { - return &ListColumnsOptions{ - EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - TableID: core.StringPtr(tableID), - } -} - -// SetEngineID : Allow user to set EngineID -func (_options *ListColumnsOptions) SetEngineID(engineID string) *ListColumnsOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetCatalogID : Allow user to set CatalogID -func (_options *ListColumnsOptions) SetCatalogID(catalogID string) *ListColumnsOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options -} - -// SetSchemaID : Allow user to set SchemaID -func (_options *ListColumnsOptions) SetSchemaID(schemaID string) *ListColumnsOptions { - _options.SchemaID = core.StringPtr(schemaID) - return _options -} - -// SetTableID : Allow user to set TableID -func (_options *ListColumnsOptions) SetTableID(tableID string) *ListColumnsOptions { - _options.TableID = core.StringPtr(tableID) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListColumnsOptions) SetAuthInstanceID(authInstanceID string) *ListColumnsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListColumnsOptions) SetHeaders(param map[string]string) *ListColumnsOptions { - options.Headers = param - return options -} - -// ListDatabaseRegistrationsOptions : The ListDatabaseRegistrations options. -type ListDatabaseRegistrationsOptions struct { - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewListDatabaseRegistrationsOptions : Instantiate ListDatabaseRegistrationsOptions -func (*WatsonxDataV2) NewListDatabaseRegistrationsOptions() *ListDatabaseRegistrationsOptions { - return &ListDatabaseRegistrationsOptions{} -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListDatabaseRegistrationsOptions) SetAuthInstanceID(authInstanceID string) *ListDatabaseRegistrationsOptions { +func (_options *ListDatabaseRegistrationsOptions) SetAuthInstanceID(authInstanceID string) *ListDatabaseRegistrationsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } @@ -20762,7 +22769,7 @@ func (options *ListDatabaseRegistrationsOptions) SetHeaders(param map[string]str // ListDb2EnginesOptions : The ListDb2Engines options. type ListDb2EnginesOptions struct { - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -20770,7 +22777,7 @@ type ListDb2EnginesOptions struct { } // NewListDb2EnginesOptions : Instantiate ListDb2EnginesOptions -func (*WatsonxDataV2) NewListDb2EnginesOptions() *ListDb2EnginesOptions { +func (*WatsonxDataV3) NewListDb2EnginesOptions() *ListDb2EnginesOptions { return &ListDb2EnginesOptions{} } @@ -20786,49 +22793,23 @@ func (options *ListDb2EnginesOptions) SetHeaders(param map[string]string) *ListD return options } -// ListDriverRegistrationOptions : The ListDriverRegistration options. -type ListDriverRegistrationOptions struct { - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewListDriverRegistrationOptions : Instantiate ListDriverRegistrationOptions -func (*WatsonxDataV2) NewListDriverRegistrationOptions() *ListDriverRegistrationOptions { - return &ListDriverRegistrationOptions{} -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListDriverRegistrationOptions) SetAuthInstanceID(authInstanceID string) *ListDriverRegistrationOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListDriverRegistrationOptions) SetHeaders(param map[string]string) *ListDriverRegistrationOptions { - options.Headers = param - return options -} - // ListIngestionJobsOptions : The ListIngestionJobs options. type ListIngestionJobsOptions struct { - // CRN. + // Lakehouse Instance ID. AuthInstanceID *string `json:"AuthInstanceId" validate:"required"` - // Page number of requested ingestion jobs. + // Page offset. Start *string `json:"start,omitempty"` - // Number of requested ingestion jobs. - JobsPerPage *int64 `json:"jobs_per_page,omitempty"` + // Page size. + Limit *int64 `json:"limit,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } // NewListIngestionJobsOptions : Instantiate ListIngestionJobsOptions -func (*WatsonxDataV2) NewListIngestionJobsOptions(authInstanceID string) *ListIngestionJobsOptions { +func (*WatsonxDataV3) NewListIngestionJobsOptions(authInstanceID string) *ListIngestionJobsOptions { return &ListIngestionJobsOptions{ AuthInstanceID: core.StringPtr(authInstanceID), } @@ -20846,9 +22827,9 @@ func (_options *ListIngestionJobsOptions) SetStart(start string) *ListIngestionJ return _options } -// SetJobsPerPage : Allow user to set JobsPerPage -func (_options *ListIngestionJobsOptions) SetJobsPerPage(jobsPerPage int64) *ListIngestionJobsOptions { - _options.JobsPerPage = core.Int64Ptr(jobsPerPage) +// SetLimit : Allow user to set Limit +func (_options *ListIngestionJobsOptions) SetLimit(limit int64) *ListIngestionJobsOptions { + _options.Limit = core.Int64Ptr(limit) return _options } @@ -20858,121 +22839,106 @@ func (options *ListIngestionJobsOptions) SetHeaders(param map[string]string) *Li return options } -// ListInstanceDetailsOptions : The ListInstanceDetails options. -type ListInstanceDetailsOptions struct { - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewListInstanceDetailsOptions : Instantiate ListInstanceDetailsOptions -func (*WatsonxDataV2) NewListInstanceDetailsOptions() *ListInstanceDetailsOptions { - return &ListInstanceDetailsOptions{} -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListInstanceDetailsOptions) SetAuthInstanceID(authInstanceID string) *ListInstanceDetailsOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *ListInstanceDetailsOptions) SetHeaders(param map[string]string) *ListInstanceDetailsOptions { - options.Headers = param - return options -} - -// ListInstanceServiceDetailsOptions : The ListInstanceServiceDetails options. -type ListInstanceServiceDetailsOptions struct { - // Target type (e.g., 'cpd', 'generic'). - Target *string `json:"target" validate:"required"` +// ListMilvusDatabaseCollectionsOptions : The ListMilvusDatabaseCollections options. +type ListMilvusDatabaseCollectionsOptions struct { + // service id. + ServiceID *string `json:"service_id" validate:"required,ne="` - // Internal host. - InternalHost *bool `json:"internal_host,omitempty"` + // database_id. + DatabaseID *string `json:"database_id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewListInstanceServiceDetailsOptions : Instantiate ListInstanceServiceDetailsOptions -func (*WatsonxDataV2) NewListInstanceServiceDetailsOptions(target string) *ListInstanceServiceDetailsOptions { - return &ListInstanceServiceDetailsOptions{ - Target: core.StringPtr(target), +// NewListMilvusDatabaseCollectionsOptions : Instantiate ListMilvusDatabaseCollectionsOptions +func (*WatsonxDataV3) NewListMilvusDatabaseCollectionsOptions(serviceID string, databaseID string) *ListMilvusDatabaseCollectionsOptions { + return &ListMilvusDatabaseCollectionsOptions{ + ServiceID: core.StringPtr(serviceID), + DatabaseID: core.StringPtr(databaseID), } } -// SetTarget : Allow user to set Target -func (_options *ListInstanceServiceDetailsOptions) SetTarget(target string) *ListInstanceServiceDetailsOptions { - _options.Target = core.StringPtr(target) +// SetServiceID : Allow user to set ServiceID +func (_options *ListMilvusDatabaseCollectionsOptions) SetServiceID(serviceID string) *ListMilvusDatabaseCollectionsOptions { + _options.ServiceID = core.StringPtr(serviceID) return _options } -// SetInternalHost : Allow user to set InternalHost -func (_options *ListInstanceServiceDetailsOptions) SetInternalHost(internalHost bool) *ListInstanceServiceDetailsOptions { - _options.InternalHost = core.BoolPtr(internalHost) +// SetDatabaseID : Allow user to set DatabaseID +func (_options *ListMilvusDatabaseCollectionsOptions) SetDatabaseID(databaseID string) *ListMilvusDatabaseCollectionsOptions { + _options.DatabaseID = core.StringPtr(databaseID) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListInstanceServiceDetailsOptions) SetAuthInstanceID(authInstanceID string) *ListInstanceServiceDetailsOptions { +func (_options *ListMilvusDatabaseCollectionsOptions) SetAuthInstanceID(authInstanceID string) *ListMilvusDatabaseCollectionsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *ListInstanceServiceDetailsOptions) SetHeaders(param map[string]string) *ListInstanceServiceDetailsOptions { +func (options *ListMilvusDatabaseCollectionsOptions) SetHeaders(param map[string]string) *ListMilvusDatabaseCollectionsOptions { options.Headers = param return options } -// ListMilvusDatabaseCollectionsOptions : The ListMilvusDatabaseCollections options. -type ListMilvusDatabaseCollectionsOptions struct { +// ListMilvusDatabasePartitionsOptions : The ListMilvusDatabasePartitions options. +type ListMilvusDatabasePartitionsOptions struct { // service id. ServiceID *string `json:"service_id" validate:"required,ne="` // database id. DatabaseID *string `json:"database_id" validate:"required,ne="` - // CRN. + // collection name. + CollectionName *string `json:"collection_name" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewListMilvusDatabaseCollectionsOptions : Instantiate ListMilvusDatabaseCollectionsOptions -func (*WatsonxDataV2) NewListMilvusDatabaseCollectionsOptions(serviceID string, databaseID string) *ListMilvusDatabaseCollectionsOptions { - return &ListMilvusDatabaseCollectionsOptions{ +// NewListMilvusDatabasePartitionsOptions : Instantiate ListMilvusDatabasePartitionsOptions +func (*WatsonxDataV3) NewListMilvusDatabasePartitionsOptions(serviceID string, databaseID string, collectionName string) *ListMilvusDatabasePartitionsOptions { + return &ListMilvusDatabasePartitionsOptions{ ServiceID: core.StringPtr(serviceID), DatabaseID: core.StringPtr(databaseID), + CollectionName: core.StringPtr(collectionName), } } // SetServiceID : Allow user to set ServiceID -func (_options *ListMilvusDatabaseCollectionsOptions) SetServiceID(serviceID string) *ListMilvusDatabaseCollectionsOptions { +func (_options *ListMilvusDatabasePartitionsOptions) SetServiceID(serviceID string) *ListMilvusDatabasePartitionsOptions { _options.ServiceID = core.StringPtr(serviceID) return _options } // SetDatabaseID : Allow user to set DatabaseID -func (_options *ListMilvusDatabaseCollectionsOptions) SetDatabaseID(databaseID string) *ListMilvusDatabaseCollectionsOptions { +func (_options *ListMilvusDatabasePartitionsOptions) SetDatabaseID(databaseID string) *ListMilvusDatabasePartitionsOptions { _options.DatabaseID = core.StringPtr(databaseID) return _options } +// SetCollectionName : Allow user to set CollectionName +func (_options *ListMilvusDatabasePartitionsOptions) SetCollectionName(collectionName string) *ListMilvusDatabasePartitionsOptions { + _options.CollectionName = core.StringPtr(collectionName) + return _options +} + // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListMilvusDatabaseCollectionsOptions) SetAuthInstanceID(authInstanceID string) *ListMilvusDatabaseCollectionsOptions { +func (_options *ListMilvusDatabasePartitionsOptions) SetAuthInstanceID(authInstanceID string) *ListMilvusDatabasePartitionsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *ListMilvusDatabaseCollectionsOptions) SetHeaders(param map[string]string) *ListMilvusDatabaseCollectionsOptions { +func (options *ListMilvusDatabasePartitionsOptions) SetHeaders(param map[string]string) *ListMilvusDatabasePartitionsOptions { options.Headers = param return options } @@ -20982,7 +22948,7 @@ type ListMilvusServiceDatabasesOptions struct { // service id. ServiceID *string `json:"service_id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -20990,7 +22956,7 @@ type ListMilvusServiceDatabasesOptions struct { } // NewListMilvusServiceDatabasesOptions : Instantiate ListMilvusServiceDatabasesOptions -func (*WatsonxDataV2) NewListMilvusServiceDatabasesOptions(serviceID string) *ListMilvusServiceDatabasesOptions { +func (*WatsonxDataV3) NewListMilvusServiceDatabasesOptions(serviceID string) *ListMilvusServiceDatabasesOptions { return &ListMilvusServiceDatabasesOptions{ ServiceID: core.StringPtr(serviceID), } @@ -21016,7 +22982,7 @@ func (options *ListMilvusServiceDatabasesOptions) SetHeaders(param map[string]st // ListMilvusServicesOptions : The ListMilvusServices options. type ListMilvusServicesOptions struct { - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -21024,7 +22990,7 @@ type ListMilvusServicesOptions struct { } // NewListMilvusServicesOptions : Instantiate ListMilvusServicesOptions -func (*WatsonxDataV2) NewListMilvusServicesOptions() *ListMilvusServicesOptions { +func (*WatsonxDataV3) NewListMilvusServicesOptions() *ListMilvusServicesOptions { return &ListMilvusServicesOptions{} } @@ -21042,7 +23008,7 @@ func (options *ListMilvusServicesOptions) SetHeaders(param map[string]string) *L // ListNetezzaEnginesOptions : The ListNetezzaEngines options. type ListNetezzaEnginesOptions struct { - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -21050,7 +23016,7 @@ type ListNetezzaEnginesOptions struct { } // NewListNetezzaEnginesOptions : Instantiate ListNetezzaEnginesOptions -func (*WatsonxDataV2) NewListNetezzaEnginesOptions() *ListNetezzaEnginesOptions { +func (*WatsonxDataV3) NewListNetezzaEnginesOptions() *ListNetezzaEnginesOptions { return &ListNetezzaEnginesOptions{} } @@ -21068,7 +23034,7 @@ func (options *ListNetezzaEnginesOptions) SetHeaders(param map[string]string) *L // ListOtherEnginesOptions : The ListOtherEngines options. type ListOtherEnginesOptions struct { - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -21076,7 +23042,7 @@ type ListOtherEnginesOptions struct { } // NewListOtherEnginesOptions : Instantiate ListOtherEnginesOptions -func (*WatsonxDataV2) NewListOtherEnginesOptions() *ListOtherEnginesOptions { +func (*WatsonxDataV3) NewListOtherEnginesOptions() *ListOtherEnginesOptions { return &ListOtherEnginesOptions{} } @@ -21095,9 +23061,9 @@ func (options *ListOtherEnginesOptions) SetHeaders(param map[string]string) *Lis // ListPrestissimoEngineCatalogsOptions : The ListPrestissimoEngineCatalogs options. type ListPrestissimoEngineCatalogsOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -21105,15 +23071,15 @@ type ListPrestissimoEngineCatalogsOptions struct { } // NewListPrestissimoEngineCatalogsOptions : Instantiate ListPrestissimoEngineCatalogsOptions -func (*WatsonxDataV2) NewListPrestissimoEngineCatalogsOptions(engineID string) *ListPrestissimoEngineCatalogsOptions { +func (*WatsonxDataV3) NewListPrestissimoEngineCatalogsOptions(id string) *ListPrestissimoEngineCatalogsOptions { return &ListPrestissimoEngineCatalogsOptions{ - EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), } } -// SetEngineID : Allow user to set EngineID -func (_options *ListPrestissimoEngineCatalogsOptions) SetEngineID(engineID string) *ListPrestissimoEngineCatalogsOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *ListPrestissimoEngineCatalogsOptions) SetID(id string) *ListPrestissimoEngineCatalogsOptions { + _options.ID = core.StringPtr(id) return _options } @@ -21131,7 +23097,7 @@ func (options *ListPrestissimoEngineCatalogsOptions) SetHeaders(param map[string // ListPrestissimoEnginesOptions : The ListPrestissimoEngines options. type ListPrestissimoEnginesOptions struct { - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -21139,7 +23105,7 @@ type ListPrestissimoEnginesOptions struct { } // NewListPrestissimoEnginesOptions : Instantiate ListPrestissimoEnginesOptions -func (*WatsonxDataV2) NewListPrestissimoEnginesOptions() *ListPrestissimoEnginesOptions { +func (*WatsonxDataV3) NewListPrestissimoEnginesOptions() *ListPrestissimoEnginesOptions { return &ListPrestissimoEnginesOptions{} } @@ -21160,7 +23126,7 @@ type ListPrestoEngineCatalogsOptions struct { // engine id. EngineID *string `json:"engine_id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -21168,7 +23134,7 @@ type ListPrestoEngineCatalogsOptions struct { } // NewListPrestoEngineCatalogsOptions : Instantiate ListPrestoEngineCatalogsOptions -func (*WatsonxDataV2) NewListPrestoEngineCatalogsOptions(engineID string) *ListPrestoEngineCatalogsOptions { +func (*WatsonxDataV3) NewListPrestoEngineCatalogsOptions(engineID string) *ListPrestoEngineCatalogsOptions { return &ListPrestoEngineCatalogsOptions{ EngineID: core.StringPtr(engineID), } @@ -21194,7 +23160,7 @@ func (options *ListPrestoEngineCatalogsOptions) SetHeaders(param map[string]stri // ListPrestoEnginesOptions : The ListPrestoEngines options. type ListPrestoEnginesOptions struct { - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -21202,7 +23168,7 @@ type ListPrestoEnginesOptions struct { } // NewListPrestoEnginesOptions : Instantiate ListPrestoEnginesOptions -func (*WatsonxDataV2) NewListPrestoEnginesOptions() *ListPrestoEnginesOptions { +func (*WatsonxDataV3) NewListPrestoEnginesOptions() *ListPrestoEnginesOptions { return &ListPrestoEnginesOptions{} } @@ -21218,942 +23184,3961 @@ func (options *ListPrestoEnginesOptions) SetHeaders(param map[string]string) *Li return options } -// ListSchemasOKBody : GetSchemas OK. -type ListSchemasOKBody struct { - // Response of success. - Response *SuccessResponse `json:"response" validate:"required"` - - // Schemas. - Schemas []string `json:"schemas" validate:"required"` -} - -// UnmarshalListSchemasOKBody unmarshals an instance of ListSchemasOKBody from the specified map of raw messages. -func UnmarshalListSchemasOKBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ListSchemasOKBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "schemas", &obj.Schemas) - if err != nil { - err = core.SDKErrorf(err, "", "schemas-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} +// ListResourceAccessPoliciesOptions : The ListResourceAccessPolicies options. +type ListResourceAccessPoliciesOptions struct { + // The unique identifier for your watsonx.data instance. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` -// ListSchemasOptions : The ListSchemas options. -type ListSchemasOptions struct { - // Engine name. - EngineID *string `json:"engine_id" validate:"required"` + // Specifies the type of watsonx.data resource for which to retrieve access policies. Valid resource types include: + // 'catalog', 'database', 'storage', 'presto', 'prestissimo', 'spark', 'milvus', and 'datastax'. + ResourceType *string `json:"resource_type,omitempty"` - // Catalog name. - CatalogID *string `json:"catalog_id" validate:"required,ne="` + // An array of resource identifiers to filter access policies. Specify one or more resource IDs (up to 10) to retrieve + // policies for specific resources. Resource IDs are applicable for resource types: 'presto', 'prestissimo', 'spark', + // 'milvus', 'storage', and 'database'. + ResourceID []string `json:"resource_id,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // An array of resource names to filter access policies. Specify one or more resource names (up to 10) to retrieve + // policies for specific catalog resources. This parameter is primarily used when the resource_type is 'catalog'. + ResourceName []string `json:"resource_name,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewListSchemasOptions : Instantiate ListSchemasOptions -func (*WatsonxDataV2) NewListSchemasOptions(engineID string, catalogID string) *ListSchemasOptions { - return &ListSchemasOptions{ - EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), - } +// Constants associated with the ListResourceAccessPoliciesOptions.ResourceType property. +// Specifies the type of watsonx.data resource for which to retrieve access policies. Valid resource types include: +// 'catalog', 'database', 'storage', 'presto', 'prestissimo', 'spark', 'milvus', and 'datastax'. +const ( + ListResourceAccessPoliciesOptions_ResourceType_Catalog = "catalog" + ListResourceAccessPoliciesOptions_ResourceType_Database = "database" + ListResourceAccessPoliciesOptions_ResourceType_Datastax = "datastax" + ListResourceAccessPoliciesOptions_ResourceType_Milvus = "milvus" + ListResourceAccessPoliciesOptions_ResourceType_Prestissimo = "prestissimo" + ListResourceAccessPoliciesOptions_ResourceType_Presto = "presto" + ListResourceAccessPoliciesOptions_ResourceType_Spark = "spark" + ListResourceAccessPoliciesOptions_ResourceType_Storage = "storage" +) + +// NewListResourceAccessPoliciesOptions : Instantiate ListResourceAccessPoliciesOptions +func (*WatsonxDataV3) NewListResourceAccessPoliciesOptions() *ListResourceAccessPoliciesOptions { + return &ListResourceAccessPoliciesOptions{} } -// SetEngineID : Allow user to set EngineID -func (_options *ListSchemasOptions) SetEngineID(engineID string) *ListSchemasOptions { - _options.EngineID = core.StringPtr(engineID) +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ListResourceAccessPoliciesOptions) SetAuthInstanceID(authInstanceID string) *ListResourceAccessPoliciesOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } -// SetCatalogID : Allow user to set CatalogID -func (_options *ListSchemasOptions) SetCatalogID(catalogID string) *ListSchemasOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetResourceType : Allow user to set ResourceType +func (_options *ListResourceAccessPoliciesOptions) SetResourceType(resourceType string) *ListResourceAccessPoliciesOptions { + _options.ResourceType = core.StringPtr(resourceType) return _options } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListSchemasOptions) SetAuthInstanceID(authInstanceID string) *ListSchemasOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) +// SetResourceID : Allow user to set ResourceID +func (_options *ListResourceAccessPoliciesOptions) SetResourceID(resourceID []string) *ListResourceAccessPoliciesOptions { + _options.ResourceID = resourceID + return _options +} + +// SetResourceName : Allow user to set ResourceName +func (_options *ListResourceAccessPoliciesOptions) SetResourceName(resourceName []string) *ListResourceAccessPoliciesOptions { + _options.ResourceName = resourceName return _options } // SetHeaders : Allow user to set Headers -func (options *ListSchemasOptions) SetHeaders(param map[string]string) *ListSchemasOptions { +func (options *ListResourceAccessPoliciesOptions) SetHeaders(param map[string]string) *ListResourceAccessPoliciesOptions { options.Headers = param return options } -// ListSparkEngineApplicationsOptions : The ListSparkEngineApplications options. -type ListSparkEngineApplicationsOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// ListSalIntegrationEnrichmentAssetsOptions : The ListSalIntegrationEnrichmentAssets options. +type ListSalIntegrationEnrichmentAssetsOptions struct { + // project id of enriched schema in IBM Knowledge Catalog. + ProjectID *string `json:"project_id" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // state. - State []string `json:"state,omitempty"` - // Allows users to set headers on API requests. Headers map[string]string } -// NewListSparkEngineApplicationsOptions : Instantiate ListSparkEngineApplicationsOptions -func (*WatsonxDataV2) NewListSparkEngineApplicationsOptions(engineID string) *ListSparkEngineApplicationsOptions { - return &ListSparkEngineApplicationsOptions{ - EngineID: core.StringPtr(engineID), +// NewListSalIntegrationEnrichmentAssetsOptions : Instantiate ListSalIntegrationEnrichmentAssetsOptions +func (*WatsonxDataV3) NewListSalIntegrationEnrichmentAssetsOptions(projectID string) *ListSalIntegrationEnrichmentAssetsOptions { + return &ListSalIntegrationEnrichmentAssetsOptions{ + ProjectID: core.StringPtr(projectID), } } -// SetEngineID : Allow user to set EngineID -func (_options *ListSparkEngineApplicationsOptions) SetEngineID(engineID string) *ListSparkEngineApplicationsOptions { - _options.EngineID = core.StringPtr(engineID) +// SetProjectID : Allow user to set ProjectID +func (_options *ListSalIntegrationEnrichmentAssetsOptions) SetProjectID(projectID string) *ListSalIntegrationEnrichmentAssetsOptions { + _options.ProjectID = core.StringPtr(projectID) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListSparkEngineApplicationsOptions) SetAuthInstanceID(authInstanceID string) *ListSparkEngineApplicationsOptions { +func (_options *ListSalIntegrationEnrichmentAssetsOptions) SetAuthInstanceID(authInstanceID string) *ListSalIntegrationEnrichmentAssetsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } -// SetState : Allow user to set State -func (_options *ListSparkEngineApplicationsOptions) SetState(state []string) *ListSparkEngineApplicationsOptions { - _options.State = state - return _options -} - // SetHeaders : Allow user to set Headers -func (options *ListSparkEngineApplicationsOptions) SetHeaders(param map[string]string) *ListSparkEngineApplicationsOptions { +func (options *ListSalIntegrationEnrichmentAssetsOptions) SetHeaders(param map[string]string) *ListSalIntegrationEnrichmentAssetsOptions { options.Headers = param return options } -// ListSparkEngineCatalogsOptions : The ListSparkEngineCatalogs options. -type ListSparkEngineCatalogsOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// ListSalIntegrationEnrichmentJobRunsOptions : The ListSalIntegrationEnrichmentJobRuns options. +type ListSalIntegrationEnrichmentJobRunsOptions struct { + // enrichment job id, refered as 'asset_id' in '/Sal_integration/enrichment/jobs'. + JobID *string `json:"job_id" validate:"required,ne="` + + // enrichment project id. + ProjectID *string `json:"project_id" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewListSparkEngineCatalogsOptions : Instantiate ListSparkEngineCatalogsOptions -func (*WatsonxDataV2) NewListSparkEngineCatalogsOptions(engineID string) *ListSparkEngineCatalogsOptions { - return &ListSparkEngineCatalogsOptions{ - EngineID: core.StringPtr(engineID), +// NewListSalIntegrationEnrichmentJobRunsOptions : Instantiate ListSalIntegrationEnrichmentJobRunsOptions +func (*WatsonxDataV3) NewListSalIntegrationEnrichmentJobRunsOptions(jobID string, projectID string) *ListSalIntegrationEnrichmentJobRunsOptions { + return &ListSalIntegrationEnrichmentJobRunsOptions{ + JobID: core.StringPtr(jobID), + ProjectID: core.StringPtr(projectID), } } -// SetEngineID : Allow user to set EngineID -func (_options *ListSparkEngineCatalogsOptions) SetEngineID(engineID string) *ListSparkEngineCatalogsOptions { - _options.EngineID = core.StringPtr(engineID) +// SetJobID : Allow user to set JobID +func (_options *ListSalIntegrationEnrichmentJobRunsOptions) SetJobID(jobID string) *ListSalIntegrationEnrichmentJobRunsOptions { + _options.JobID = core.StringPtr(jobID) + return _options +} + +// SetProjectID : Allow user to set ProjectID +func (_options *ListSalIntegrationEnrichmentJobRunsOptions) SetProjectID(projectID string) *ListSalIntegrationEnrichmentJobRunsOptions { + _options.ProjectID = core.StringPtr(projectID) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListSparkEngineCatalogsOptions) SetAuthInstanceID(authInstanceID string) *ListSparkEngineCatalogsOptions { +func (_options *ListSalIntegrationEnrichmentJobRunsOptions) SetAuthInstanceID(authInstanceID string) *ListSalIntegrationEnrichmentJobRunsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *ListSparkEngineCatalogsOptions) SetHeaders(param map[string]string) *ListSparkEngineCatalogsOptions { +func (options *ListSalIntegrationEnrichmentJobRunsOptions) SetHeaders(param map[string]string) *ListSalIntegrationEnrichmentJobRunsOptions { options.Headers = param return options } -// ListSparkEnginesOptions : The ListSparkEngines options. -type ListSparkEnginesOptions struct { - // CRN. +// ListSalIntegrationEnrichmentJobsOptions : The ListSalIntegrationEnrichmentJobs options. +type ListSalIntegrationEnrichmentJobsOptions struct { + // IBM Knowledge Catalog project id. + ProjectID *string `json:"project_id" validate:"required"` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewListSparkEnginesOptions : Instantiate ListSparkEnginesOptions -func (*WatsonxDataV2) NewListSparkEnginesOptions() *ListSparkEnginesOptions { - return &ListSparkEnginesOptions{} +// NewListSalIntegrationEnrichmentJobsOptions : Instantiate ListSalIntegrationEnrichmentJobsOptions +func (*WatsonxDataV3) NewListSalIntegrationEnrichmentJobsOptions(projectID string) *ListSalIntegrationEnrichmentJobsOptions { + return &ListSalIntegrationEnrichmentJobsOptions{ + ProjectID: core.StringPtr(projectID), + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *ListSalIntegrationEnrichmentJobsOptions) SetProjectID(projectID string) *ListSalIntegrationEnrichmentJobsOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListSparkEnginesOptions) SetAuthInstanceID(authInstanceID string) *ListSparkEnginesOptions { +func (_options *ListSalIntegrationEnrichmentJobsOptions) SetAuthInstanceID(authInstanceID string) *ListSalIntegrationEnrichmentJobsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *ListSparkEnginesOptions) SetHeaders(param map[string]string) *ListSparkEnginesOptions { +func (options *ListSalIntegrationEnrichmentJobsOptions) SetHeaders(param map[string]string) *ListSalIntegrationEnrichmentJobsOptions { options.Headers = param return options } -// ListSparkVersionsOKBody : List spark version. -type ListSparkVersionsOKBody struct { - // Response of success. - Response *SuccessResponse `json:"response" validate:"required"` +// ListSalIntegrationEnrichmentMappingsOptions : The ListSalIntegrationEnrichmentMappings options. +type ListSalIntegrationEnrichmentMappingsOptions struct { + // catalog name in Watsonx.data. + CatalogName *string `json:"catalog_name,omitempty"` + + // schema name in Watsonx.data. + SchemaName *string `json:"schema_name,omitempty"` + + // reference as an continue of reading results from earlier query (if the results exceed 100). + Next *string `json:"next,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // Spark versions list. - SparkVersions []DisplayNameInfoResponse `json:"spark_versions" validate:"required"` + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalListSparkVersionsOKBody unmarshals an instance of ListSparkVersionsOKBody from the specified map of raw messages. -func UnmarshalListSparkVersionsOKBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ListSparkVersionsOKBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "spark_versions", &obj.SparkVersions, UnmarshalDisplayNameInfoResponse) - if err != nil { - err = core.SDKErrorf(err, "", "spark_versions-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// NewListSalIntegrationEnrichmentMappingsOptions : Instantiate ListSalIntegrationEnrichmentMappingsOptions +func (*WatsonxDataV3) NewListSalIntegrationEnrichmentMappingsOptions() *ListSalIntegrationEnrichmentMappingsOptions { + return &ListSalIntegrationEnrichmentMappingsOptions{} +} + +// SetCatalogName : Allow user to set CatalogName +func (_options *ListSalIntegrationEnrichmentMappingsOptions) SetCatalogName(catalogName string) *ListSalIntegrationEnrichmentMappingsOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options +} + +// SetSchemaName : Allow user to set SchemaName +func (_options *ListSalIntegrationEnrichmentMappingsOptions) SetSchemaName(schemaName string) *ListSalIntegrationEnrichmentMappingsOptions { + _options.SchemaName = core.StringPtr(schemaName) + return _options +} + +// SetNext : Allow user to set Next +func (_options *ListSalIntegrationEnrichmentMappingsOptions) SetNext(next string) *ListSalIntegrationEnrichmentMappingsOptions { + _options.Next = core.StringPtr(next) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ListSalIntegrationEnrichmentMappingsOptions) SetAuthInstanceID(authInstanceID string) *ListSalIntegrationEnrichmentMappingsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSalIntegrationEnrichmentMappingsOptions) SetHeaders(param map[string]string) *ListSalIntegrationEnrichmentMappingsOptions { + options.Headers = param + return options } -// ListSparkVersionsOptions : The ListSparkVersions options. -type ListSparkVersionsOptions struct { - // CRN. +// ListSchemasOptions : The ListSchemas options. +type ListSchemasOptions struct { + // Engine id. + EngineID *string `json:"engine_id" validate:"required"` + + // Catalog id. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewListSparkVersionsOptions : Instantiate ListSparkVersionsOptions -func (*WatsonxDataV2) NewListSparkVersionsOptions() *ListSparkVersionsOptions { - return &ListSparkVersionsOptions{} +// NewListSchemasOptions : Instantiate ListSchemasOptions +func (*WatsonxDataV3) NewListSchemasOptions(engineID string, id string) *ListSchemasOptions { + return &ListSchemasOptions{ + EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), + } +} + +// SetEngineID : Allow user to set EngineID +func (_options *ListSchemasOptions) SetEngineID(engineID string) *ListSchemasOptions { + _options.EngineID = core.StringPtr(engineID) + return _options +} + +// SetID : Allow user to set ID +func (_options *ListSchemasOptions) SetID(id string) *ListSchemasOptions { + _options.ID = core.StringPtr(id) + return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListSparkVersionsOptions) SetAuthInstanceID(authInstanceID string) *ListSparkVersionsOptions { +func (_options *ListSchemasOptions) SetAuthInstanceID(authInstanceID string) *ListSchemasOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *ListSparkVersionsOptions) SetHeaders(param map[string]string) *ListSparkVersionsOptions { +func (options *ListSchemasOptions) SetHeaders(param map[string]string) *ListSchemasOptions { options.Headers = param return options } -// ListTableSnapshotsOptions : The ListTableSnapshots options. -type ListTableSnapshotsOptions struct { - // Engine name. - EngineID *string `json:"engine_id" validate:"required"` +// ListSemanticSearchQueriesOptions : The ListSemanticSearchQueries options. +type ListSemanticSearchQueriesOptions struct { + // engine id. + EngineID *string `json:"engine_id,omitempty"` - // Catalog ID. - CatalogID *string `json:"catalog_id" validate:"required,ne="` + // enable schemas search. + SchemaSearchEnabled *bool `json:"schema_search_enabled,omitempty"` - // Schema ID. - SchemaID *string `json:"schema_id" validate:"required,ne="` + // enable columns search. + ColumnSearchEnabled *bool `json:"column_search_enabled,omitempty"` - // Table ID. - TableID *string `json:"table_id" validate:"required,ne="` + // max history records limitation. + MaxResultNumber *int64 `json:"max_result_number,omitempty"` - // CRN. + // if the response include actual search result. + RunSearch *bool `json:"run_search,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewListTableSnapshotsOptions : Instantiate ListTableSnapshotsOptions -func (*WatsonxDataV2) NewListTableSnapshotsOptions(engineID string, catalogID string, schemaID string, tableID string) *ListTableSnapshotsOptions { - return &ListTableSnapshotsOptions{ - EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - TableID: core.StringPtr(tableID), - } +// NewListSemanticSearchQueriesOptions : Instantiate ListSemanticSearchQueriesOptions +func (*WatsonxDataV3) NewListSemanticSearchQueriesOptions() *ListSemanticSearchQueriesOptions { + return &ListSemanticSearchQueriesOptions{} } // SetEngineID : Allow user to set EngineID -func (_options *ListTableSnapshotsOptions) SetEngineID(engineID string) *ListTableSnapshotsOptions { +func (_options *ListSemanticSearchQueriesOptions) SetEngineID(engineID string) *ListSemanticSearchQueriesOptions { _options.EngineID = core.StringPtr(engineID) return _options } -// SetCatalogID : Allow user to set CatalogID -func (_options *ListTableSnapshotsOptions) SetCatalogID(catalogID string) *ListTableSnapshotsOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetSchemaSearchEnabled : Allow user to set SchemaSearchEnabled +func (_options *ListSemanticSearchQueriesOptions) SetSchemaSearchEnabled(schemaSearchEnabled bool) *ListSemanticSearchQueriesOptions { + _options.SchemaSearchEnabled = core.BoolPtr(schemaSearchEnabled) return _options } -// SetSchemaID : Allow user to set SchemaID -func (_options *ListTableSnapshotsOptions) SetSchemaID(schemaID string) *ListTableSnapshotsOptions { - _options.SchemaID = core.StringPtr(schemaID) +// SetColumnSearchEnabled : Allow user to set ColumnSearchEnabled +func (_options *ListSemanticSearchQueriesOptions) SetColumnSearchEnabled(columnSearchEnabled bool) *ListSemanticSearchQueriesOptions { + _options.ColumnSearchEnabled = core.BoolPtr(columnSearchEnabled) return _options } -// SetTableID : Allow user to set TableID -func (_options *ListTableSnapshotsOptions) SetTableID(tableID string) *ListTableSnapshotsOptions { - _options.TableID = core.StringPtr(tableID) +// SetMaxResultNumber : Allow user to set MaxResultNumber +func (_options *ListSemanticSearchQueriesOptions) SetMaxResultNumber(maxResultNumber int64) *ListSemanticSearchQueriesOptions { + _options.MaxResultNumber = core.Int64Ptr(maxResultNumber) + return _options +} + +// SetRunSearch : Allow user to set RunSearch +func (_options *ListSemanticSearchQueriesOptions) SetRunSearch(runSearch bool) *ListSemanticSearchQueriesOptions { + _options.RunSearch = core.BoolPtr(runSearch) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListTableSnapshotsOptions) SetAuthInstanceID(authInstanceID string) *ListTableSnapshotsOptions { +func (_options *ListSemanticSearchQueriesOptions) SetAuthInstanceID(authInstanceID string) *ListSemanticSearchQueriesOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *ListTableSnapshotsOptions) SetHeaders(param map[string]string) *ListTableSnapshotsOptions { +func (options *ListSemanticSearchQueriesOptions) SetHeaders(param map[string]string) *ListSemanticSearchQueriesOptions { options.Headers = param return options } -// ListTablesOptions : The ListTables options. -type ListTablesOptions struct { - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` - - // URL encoded schema name. - SchemaID *string `json:"schema_id" validate:"required,ne="` - +// ListSparkEngineApplicationsOptions : The ListSparkEngineApplications options. +type ListSparkEngineApplicationsOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required"` + ID *string `json:"id" validate:"required,ne="` - // CRN. + // watsonx.data instance ID. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // state. + State []string `json:"state,omitempty"` + + // Submission time interval in , format. + SubmissionTimeInterval *string `json:"submission_time_interval,omitempty"` + + // Start time interval in , format. + StartTimeInterval *string `json:"start_time_interval,omitempty"` + + // End time interval in , format. + EndTimeInterval *string `json:"end_time_interval,omitempty"` + + // limit to specify the rows. + Limit *int64 `json:"limit,omitempty"` + + // Token used to fetch the next or the previous page of the applications list. + Start *string `json:"start,omitempty"` + // Allows users to set headers on API requests. Headers map[string]string } -// NewListTablesOptions : Instantiate ListTablesOptions -func (*WatsonxDataV2) NewListTablesOptions(catalogID string, schemaID string, engineID string) *ListTablesOptions { - return &ListTablesOptions{ - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - EngineID: core.StringPtr(engineID), +// NewListSparkEngineApplicationsOptions : Instantiate ListSparkEngineApplicationsOptions +func (*WatsonxDataV3) NewListSparkEngineApplicationsOptions(id string) *ListSparkEngineApplicationsOptions { + return &ListSparkEngineApplicationsOptions{ + ID: core.StringPtr(id), } } -// SetCatalogID : Allow user to set CatalogID -func (_options *ListTablesOptions) SetCatalogID(catalogID string) *ListTablesOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetID : Allow user to set ID +func (_options *ListSparkEngineApplicationsOptions) SetID(id string) *ListSparkEngineApplicationsOptions { + _options.ID = core.StringPtr(id) return _options } -// SetSchemaID : Allow user to set SchemaID -func (_options *ListTablesOptions) SetSchemaID(schemaID string) *ListTablesOptions { - _options.SchemaID = core.StringPtr(schemaID) +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ListSparkEngineApplicationsOptions) SetAuthInstanceID(authInstanceID string) *ListSparkEngineApplicationsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } -// SetEngineID : Allow user to set EngineID -func (_options *ListTablesOptions) SetEngineID(engineID string) *ListTablesOptions { - _options.EngineID = core.StringPtr(engineID) +// SetState : Allow user to set State +func (_options *ListSparkEngineApplicationsOptions) SetState(state []string) *ListSparkEngineApplicationsOptions { + _options.State = state + return _options +} + +// SetSubmissionTimeInterval : Allow user to set SubmissionTimeInterval +func (_options *ListSparkEngineApplicationsOptions) SetSubmissionTimeInterval(submissionTimeInterval string) *ListSparkEngineApplicationsOptions { + _options.SubmissionTimeInterval = core.StringPtr(submissionTimeInterval) + return _options +} + +// SetStartTimeInterval : Allow user to set StartTimeInterval +func (_options *ListSparkEngineApplicationsOptions) SetStartTimeInterval(startTimeInterval string) *ListSparkEngineApplicationsOptions { + _options.StartTimeInterval = core.StringPtr(startTimeInterval) + return _options +} + +// SetEndTimeInterval : Allow user to set EndTimeInterval +func (_options *ListSparkEngineApplicationsOptions) SetEndTimeInterval(endTimeInterval string) *ListSparkEngineApplicationsOptions { + _options.EndTimeInterval = core.StringPtr(endTimeInterval) + return _options +} + +// SetLimit : Allow user to set Limit +func (_options *ListSparkEngineApplicationsOptions) SetLimit(limit int64) *ListSparkEngineApplicationsOptions { + _options.Limit = core.Int64Ptr(limit) + return _options +} + +// SetStart : Allow user to set Start +func (_options *ListSparkEngineApplicationsOptions) SetStart(start string) *ListSparkEngineApplicationsOptions { + _options.Start = core.StringPtr(start) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSparkEngineApplicationsOptions) SetHeaders(param map[string]string) *ListSparkEngineApplicationsOptions { + options.Headers = param + return options +} + +// ListSparkEngineCatalogsOptions : The ListSparkEngineCatalogs options. +type ListSparkEngineCatalogsOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewListSparkEngineCatalogsOptions : Instantiate ListSparkEngineCatalogsOptions +func (*WatsonxDataV3) NewListSparkEngineCatalogsOptions(id string) *ListSparkEngineCatalogsOptions { + return &ListSparkEngineCatalogsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *ListSparkEngineCatalogsOptions) SetID(id string) *ListSparkEngineCatalogsOptions { + _options.ID = core.StringPtr(id) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ListTablesOptions) SetAuthInstanceID(authInstanceID string) *ListTablesOptions { +func (_options *ListSparkEngineCatalogsOptions) SetAuthInstanceID(authInstanceID string) *ListSparkEngineCatalogsOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *ListTablesOptions) SetHeaders(param map[string]string) *ListTablesOptions { +func (options *ListSparkEngineCatalogsOptions) SetHeaders(param map[string]string) *ListSparkEngineCatalogsOptions { options.Headers = param return options } -// LoadTableOptions : The LoadTable options. -type LoadTableOptions struct { - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` +// ListSparkEnginesOptions : The ListSparkEngines options. +type ListSparkEnginesOptions struct { + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // URL encoded schema name. - SchemaID *string `json:"schema_id" validate:"required,ne="` + // Allows users to set headers on API requests. + Headers map[string]string +} - // URL encoded table name. - TableID *string `json:"table_id" validate:"required,ne="` +// NewListSparkEnginesOptions : Instantiate ListSparkEnginesOptions +func (*WatsonxDataV3) NewListSparkEnginesOptions() *ListSparkEnginesOptions { + return &ListSparkEnginesOptions{} +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ListSparkEnginesOptions) SetAuthInstanceID(authInstanceID string) *ListSparkEnginesOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSparkEnginesOptions) SetHeaders(param map[string]string) *ListSparkEnginesOptions { + options.Headers = param + return options +} + +// ListStorageRegistrationsObjectsOptions : The ListStorageRegistrationsObjects options. +type ListStorageRegistrationsObjectsOptions struct { + // storage id. + StorageID *string `json:"storage_id" validate:"required,ne="` - // watsonx.data CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // path. + Path *string `json:"path,omitempty"` + + // data to be paginated or not. + Paginated *bool `json:"paginated,omitempty"` + + // The number of items per page (default is 1000 , max 1000). + PageSize *int64 `json:"page_size,omitempty"` + + // prefix to filter the objects by. + Prefix *string `json:"prefix,omitempty"` + + // StartAfter is where you want Amazon S3 to start listing from. + StartAfter *string `json:"start_after,omitempty"` + // Allows users to set headers on API requests. Headers map[string]string } -// NewLoadTableOptions : Instantiate LoadTableOptions -func (*WatsonxDataV2) NewLoadTableOptions(catalogID string, schemaID string, tableID string) *LoadTableOptions { - return &LoadTableOptions{ - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - TableID: core.StringPtr(tableID), +// NewListStorageRegistrationsObjectsOptions : Instantiate ListStorageRegistrationsObjectsOptions +func (*WatsonxDataV3) NewListStorageRegistrationsObjectsOptions(storageID string) *ListStorageRegistrationsObjectsOptions { + return &ListStorageRegistrationsObjectsOptions{ + StorageID: core.StringPtr(storageID), + } +} + +// SetStorageID : Allow user to set StorageID +func (_options *ListStorageRegistrationsObjectsOptions) SetStorageID(storageID string) *ListStorageRegistrationsObjectsOptions { + _options.StorageID = core.StringPtr(storageID) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ListStorageRegistrationsObjectsOptions) SetAuthInstanceID(authInstanceID string) *ListStorageRegistrationsObjectsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetPath : Allow user to set Path +func (_options *ListStorageRegistrationsObjectsOptions) SetPath(path string) *ListStorageRegistrationsObjectsOptions { + _options.Path = core.StringPtr(path) + return _options +} + +// SetPaginated : Allow user to set Paginated +func (_options *ListStorageRegistrationsObjectsOptions) SetPaginated(paginated bool) *ListStorageRegistrationsObjectsOptions { + _options.Paginated = core.BoolPtr(paginated) + return _options +} + +// SetPageSize : Allow user to set PageSize +func (_options *ListStorageRegistrationsObjectsOptions) SetPageSize(pageSize int64) *ListStorageRegistrationsObjectsOptions { + _options.PageSize = core.Int64Ptr(pageSize) + return _options +} + +// SetPrefix : Allow user to set Prefix +func (_options *ListStorageRegistrationsObjectsOptions) SetPrefix(prefix string) *ListStorageRegistrationsObjectsOptions { + _options.Prefix = core.StringPtr(prefix) + return _options +} + +// SetStartAfter : Allow user to set StartAfter +func (_options *ListStorageRegistrationsObjectsOptions) SetStartAfter(startAfter string) *ListStorageRegistrationsObjectsOptions { + _options.StartAfter = core.StringPtr(startAfter) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListStorageRegistrationsObjectsOptions) SetHeaders(param map[string]string) *ListStorageRegistrationsObjectsOptions { + options.Headers = param + return options +} + +// ListStorageRegistrationsOptions : The ListStorageRegistrations options. +type ListStorageRegistrationsOptions struct { + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewListStorageRegistrationsOptions : Instantiate ListStorageRegistrationsOptions +func (*WatsonxDataV3) NewListStorageRegistrationsOptions() *ListStorageRegistrationsOptions { + return &ListStorageRegistrationsOptions{} +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ListStorageRegistrationsOptions) SetAuthInstanceID(authInstanceID string) *ListStorageRegistrationsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListStorageRegistrationsOptions) SetHeaders(param map[string]string) *ListStorageRegistrationsOptions { + options.Headers = param + return options +} + +// ListTableSnapshotsOptions : The ListTableSnapshots options. +type ListTableSnapshotsOptions struct { + // Catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` + + // Schema name. + SchemaName *string `json:"schema_name" validate:"required,ne="` + + // Table name. + TableName *string `json:"table_name" validate:"required,ne="` + + // Engine name. + EngineID *string `json:"engine_id,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewListTableSnapshotsOptions : Instantiate ListTableSnapshotsOptions +func (*WatsonxDataV3) NewListTableSnapshotsOptions(catalogName string, schemaName string, tableName string) *ListTableSnapshotsOptions { + return &ListTableSnapshotsOptions{ + CatalogName: core.StringPtr(catalogName), + SchemaName: core.StringPtr(schemaName), + TableName: core.StringPtr(tableName), + } +} + +// SetCatalogName : Allow user to set CatalogName +func (_options *ListTableSnapshotsOptions) SetCatalogName(catalogName string) *ListTableSnapshotsOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options +} + +// SetSchemaName : Allow user to set SchemaName +func (_options *ListTableSnapshotsOptions) SetSchemaName(schemaName string) *ListTableSnapshotsOptions { + _options.SchemaName = core.StringPtr(schemaName) + return _options +} + +// SetTableName : Allow user to set TableName +func (_options *ListTableSnapshotsOptions) SetTableName(tableName string) *ListTableSnapshotsOptions { + _options.TableName = core.StringPtr(tableName) + return _options +} + +// SetEngineID : Allow user to set EngineID +func (_options *ListTableSnapshotsOptions) SetEngineID(engineID string) *ListTableSnapshotsOptions { + _options.EngineID = core.StringPtr(engineID) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ListTableSnapshotsOptions) SetAuthInstanceID(authInstanceID string) *ListTableSnapshotsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListTableSnapshotsOptions) SetHeaders(param map[string]string) *ListTableSnapshotsOptions { + options.Headers = param + return options +} + +// ListTablesOptions : The ListTables options. +type ListTablesOptions struct { + // catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` + + // URL encoded schema name. + SchemaName *string `json:"schema_name" validate:"required,ne="` + + // Engine id of presto/prestissimo/spark/db2/netezza other engine. + EngineID *string `json:"engine_id" validate:"required"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewListTablesOptions : Instantiate ListTablesOptions +func (*WatsonxDataV3) NewListTablesOptions(catalogName string, schemaName string, engineID string) *ListTablesOptions { + return &ListTablesOptions{ + CatalogName: core.StringPtr(catalogName), + SchemaName: core.StringPtr(schemaName), + EngineID: core.StringPtr(engineID), + } +} + +// SetCatalogName : Allow user to set CatalogName +func (_options *ListTablesOptions) SetCatalogName(catalogName string) *ListTablesOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options +} + +// SetSchemaName : Allow user to set SchemaName +func (_options *ListTablesOptions) SetSchemaName(schemaName string) *ListTablesOptions { + _options.SchemaName = core.StringPtr(schemaName) + return _options +} + +// SetEngineID : Allow user to set EngineID +func (_options *ListTablesOptions) SetEngineID(engineID string) *ListTablesOptions { + _options.EngineID = core.StringPtr(engineID) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ListTablesOptions) SetAuthInstanceID(authInstanceID string) *ListTablesOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListTablesOptions) SetHeaders(param map[string]string) *ListTablesOptions { + options.Headers = param + return options +} + +// LoadTableOptions : The LoadTable options. +type LoadTableOptions struct { + // catalog id. + CatalogID *string `json:"catalog_id" validate:"required,ne="` + + // URL encoded schema name. + SchemaID *string `json:"schema_id" validate:"required,ne="` + + // URL encoded table name. + TableID *string `json:"table_id" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewLoadTableOptions : Instantiate LoadTableOptions +func (*WatsonxDataV3) NewLoadTableOptions(catalogID string, schemaID string, tableID string) *LoadTableOptions { + return &LoadTableOptions{ + CatalogID: core.StringPtr(catalogID), + SchemaID: core.StringPtr(schemaID), + TableID: core.StringPtr(tableID), + } +} + +// SetCatalogID : Allow user to set CatalogID +func (_options *LoadTableOptions) SetCatalogID(catalogID string) *LoadTableOptions { + _options.CatalogID = core.StringPtr(catalogID) + return _options +} + +// SetSchemaID : Allow user to set SchemaID +func (_options *LoadTableOptions) SetSchemaID(schemaID string) *LoadTableOptions { + _options.SchemaID = core.StringPtr(schemaID) + return _options +} + +// SetTableID : Allow user to set TableID +func (_options *LoadTableOptions) SetTableID(tableID string) *LoadTableOptions { + _options.TableID = core.StringPtr(tableID) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *LoadTableOptions) SetAuthInstanceID(authInstanceID string) *LoadTableOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *LoadTableOptions) SetHeaders(param map[string]string) *LoadTableOptions { + options.Headers = param + return options +} + +// LoadTableResponse : Load table metadata. +type LoadTableResponse struct { + // Metadata location. + MetadataLocation *string `json:"metadata_location,omitempty"` + + // Path to the table. + TablePath *string `json:"table_path,omitempty"` +} + +// UnmarshalLoadTableResponse unmarshals an instance of LoadTableResponse from the specified map of raw messages. +func UnmarshalLoadTableResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadTableResponse) + err = core.UnmarshalPrimitive(m, "metadata_location", &obj.MetadataLocation) + if err != nil { + err = core.SDKErrorf(err, "", "metadata_location-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "table_path", &obj.TablePath) + if err != nil { + err = core.SDKErrorf(err, "", "table_path-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LogConfigProperties : Logging configuration properties for coordinator and worker nodes. +type LogConfigProperties struct { + // Log configuration for coordinator node. + Coordinator map[string]string `json:"coordinator,omitempty"` + + // Log configuration for worker nodes. + Worker map[string]string `json:"worker,omitempty"` +} + +// UnmarshalLogConfigProperties unmarshals an instance of LogConfigProperties from the specified map of raw messages. +func UnmarshalLogConfigProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LogConfigProperties) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + if err != nil { + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the LogConfigProperties +func (logConfigProperties *LogConfigProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(logConfigProperties.Coordinator) { + _patch["coordinator"] = logConfigProperties.Coordinator + } + if !core.IsNil(logConfigProperties.Worker) { + _patch["worker"] = logConfigProperties.Worker + } + + return +} + +// MdsConnectionInfo : MDS Thrift server connection details. +type MdsConnectionInfo struct { + // External MDS rest uri. + ExternalMetastoreRestURI *string `json:"external_metastore_rest_uri,omitempty"` + + // External MDS thrift uri. + ExternalMetastoreThriftURI *string `json:"external_metastore_thrift_uri,omitempty"` + + // MDS thrift server hostname. + Hostname *string `json:"hostname,omitempty"` + + // MDS thrift server port. + Port *string `json:"port,omitempty"` + + // Internal MDS REST uri. + RestURI *string `json:"rest_uri,omitempty"` + + // Internal MDS thrift uri. + ThriftURI *string `json:"thrift_uri,omitempty"` +} + +// UnmarshalMdsConnectionInfo unmarshals an instance of MdsConnectionInfo from the specified map of raw messages. +func UnmarshalMdsConnectionInfo(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MdsConnectionInfo) + err = core.UnmarshalPrimitive(m, "external_metastore_rest_uri", &obj.ExternalMetastoreRestURI) + if err != nil { + err = core.SDKErrorf(err, "", "external_metastore_rest_uri-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "external_metastore_thrift_uri", &obj.ExternalMetastoreThriftURI) + if err != nil { + err = core.SDKErrorf(err, "", "external_metastore_thrift_uri-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + if err != nil { + err = core.SDKErrorf(err, "", "hostname-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "rest_uri", &obj.RestURI) + if err != nil { + err = core.SDKErrorf(err, "", "rest_uri-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "thrift_uri", &obj.ThriftURI) + if err != nil { + err = core.SDKErrorf(err, "", "thrift_uri-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Metadata : metadata of each access policy such as created at, created by, last modified at and last modified by. +type Metadata struct { + // Access policy creation timestamp. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // an identifier for the creator of the policy. + CreatedBy *string `json:"created_by,omitempty"` + + // access policy last udpated timestamp. + LastModifiedAt *strfmt.DateTime `json:"last_modified_at,omitempty"` + + // an identifier for the last modifier of the policy. + LastModifiedBy *string `json:"last_modified_by,omitempty"` +} + +// UnmarshalMetadata unmarshals an instance of Metadata from the specified map of raw messages. +func UnmarshalMetadata(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Metadata) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "last_modified_at", &obj.LastModifiedAt) + if err != nil { + err = core.SDKErrorf(err, "", "last_modified_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "last_modified_by", &obj.LastModifiedBy) + if err != nil { + err = core.SDKErrorf(err, "", "last_modified_by-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// MilvusDBPartition : milvus database collection partition details. +type MilvusDBPartition struct { + // milvus partition id. + ID *int64 `json:"id,omitempty"` + + // milvus partition name. + Name *string `json:"name,omitempty"` +} + +// UnmarshalMilvusDBPartition unmarshals an instance of MilvusDBPartition from the specified map of raw messages. +func UnmarshalMilvusDBPartition(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MilvusDBPartition) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// MilvusDatabaseCollections : List Milvus database collections. +type MilvusDatabaseCollections struct { + // List of Milvus database collections. + Collections []MilvusDbcollection `json:"collections" validate:"required"` +} + +// UnmarshalMilvusDatabaseCollections unmarshals an instance of MilvusDatabaseCollections from the specified map of raw messages. +func UnmarshalMilvusDatabaseCollections(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MilvusDatabaseCollections) + err = core.UnmarshalModel(m, "collections", &obj.Collections, UnmarshalMilvusDbcollection) + if err != nil { + err = core.SDKErrorf(err, "", "collections-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// MilvusDatabasePartitions : List milvus database collection partitions. +type MilvusDatabasePartitions struct { + // List of milvus database collection partitions. + Partitions []MilvusDBPartition `json:"partitions" validate:"required"` +} + +// UnmarshalMilvusDatabasePartitions unmarshals an instance of MilvusDatabasePartitions from the specified map of raw messages. +func UnmarshalMilvusDatabasePartitions(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MilvusDatabasePartitions) + err = core.UnmarshalModel(m, "partitions", &obj.Partitions, UnmarshalMilvusDBPartition) + if err != nil { + err = core.SDKErrorf(err, "", "partitions-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// MilvusDbcollection : Details of the Milvus database collection. +type MilvusDbcollection struct { + // milvus collection id. + ID *int64 `json:"id,omitempty"` + + // Name of the collection. + Name *string `json:"name,omitempty"` + + // list of physical channels. + PhysicalChannels []string `json:"physical_channels" validate:"required"` + + // list of virtual channels. + VirtualChannels []string `json:"virtual_channels" validate:"required"` +} + +// UnmarshalMilvusDbcollection unmarshals an instance of MilvusDbcollection from the specified map of raw messages. +func UnmarshalMilvusDbcollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MilvusDbcollection) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "physical_channels", &obj.PhysicalChannels) + if err != nil { + err = core.SDKErrorf(err, "", "physical_channels-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "virtual_channels", &obj.VirtualChannels) + if err != nil { + err = core.SDKErrorf(err, "", "virtual_channels-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// MilvusService : milvus service details. +type MilvusService struct { + // storage access key. + AccessKey *string `json:"access_key,omitempty"` + + // Actions. + Actions []string `json:"actions" validate:"required"` + + // Created time in epoch format. + CreatedAt *int64 `json:"created_at,omitempty"` + + // Username of the user who created the watsonx.data instance. + CreatedBy *string `json:"created_by,omitempty"` + + // data coordinator cpus, only configurable in cpd. + DcCpu *float64 `json:"dc_cpu,omitempty"` + + // data coordinator memory, only configurable in cpd. + DcMemory *float64 `json:"dc_memory,omitempty"` + + // data coordinator replicas, only configurable in cpd. + DcReplicas *int64 `json:"dc_replicas,omitempty"` + + // Descriptioon of Milvus service added by the user. + Description *string `json:"description,omitempty"` + + // Display name for milvus services. + DisplayName *string `json:"display_name,omitempty"` + + // data worker cpus, only configurable in cpd. + DwCpu *float64 `json:"dw_cpu,omitempty"` + + // data worker memory, only configurable in cpd. + DwMemory *float64 `json:"dw_memory,omitempty"` + + // data worker replicas, only configurable in cpd. + DwReplicas *int64 `json:"dw_replicas,omitempty"` + + // storage endpoint. + Endpoint *string `json:"endpoint,omitempty"` + + // etcd cpus, only configurable in cpd. + EtcdCpu *float64 `json:"etcd_cpu,omitempty"` + + // etcd memory, only configurable in cpd. + EtcdMemory *float64 `json:"etcd_memory,omitempty"` + + // Failure message. + FailureMessage *string `json:"failure_message,omitempty"` + + // milvus grpc_host. + GrpcHost *string `json:"grpc_host,omitempty"` + + // milvus port. + GrpcPort *int64 `json:"grpc_port,omitempty"` + + // milvus display name. + HostName *string `json:"host_name,omitempty"` + + // milvus https_host. + HttpsHost *string `json:"https_host,omitempty"` + + // milvus port. + HttpsPort *int64 `json:"https_port,omitempty"` + + // Engine id. + ID *string `json:"id,omitempty"` + + // Index type of milvus engine. + IndexType *string `json:"index_type" validate:"required"` + + // index worker cpu. + IwCpu *float64 `json:"iw_cpu,omitempty"` + + // index worker memory. + IwMemory *float64 `json:"iw_memory,omitempty"` + + // index worker replicas. + IwReplicas *int64 `json:"iw_replicas,omitempty"` + + // kafka cpus, only configurable in cpd. + KafkaCpu *float64 `json:"kafka_cpu,omitempty"` + + // kafka memory, only configurable in cpd. + KafkaMemory *float64 `json:"kafka_memory,omitempty"` + + // How is the Milvus instance managed. + ManagedBy *string `json:"managed_by,omitempty"` + + // Origin of the milvus service. + Origin *string `json:"origin" validate:"required"` + + // proxy cpus, only configurable in cpd. + ProxyCpu *float64 `json:"proxy_cpu,omitempty"` + + // milvus proxy host. + ProxyHost *string `json:"proxy_host,omitempty"` + + // proxy memory, only configurable in cpd. + ProxyMemory *float64 `json:"proxy_memory,omitempty"` + + // milvus proxy port. + ProxyPort *int64 `json:"proxy_port,omitempty"` + + // proxy replicas, only configurable in cpd. + ProxyReplicas *int64 `json:"proxy_replicas,omitempty"` + + // query coordinator cpus, only configurable in cpd. + QcCpu *float64 `json:"qc_cpu,omitempty"` + + // query coordinator memory, only configurable in cpd. + QcMemory *float64 `json:"qc_memory,omitempty"` + + // query coordinator replicas, only configurable in cpd. + QcReplicas *int64 `json:"qc_replicas,omitempty"` + + // query worker cpu. + QwCpu *float64 `json:"qw_cpu,omitempty"` + + // query worker memory. + QwMemory *float64 `json:"qw_memory,omitempty"` + + // query worker replicas. + QwReplicas *int64 `json:"qw_replicas,omitempty"` + + // root coordinator cpus, only configurable in cpd. + RcCpu *float64 `json:"rc_cpu,omitempty"` + + // root coodinator memory, only configurable in cpd. + RcMemory *float64 `json:"rc_memory,omitempty"` + + // root coordinator replicas, only configurable in cpd. + RcReplicas *int64 `json:"rc_replicas,omitempty"` + + // Root path in storage where milvus vectors will be stored. + RootPath *string `json:"root_path,omitempty"` + + // storage secret access key. + SecretKey *string `json:"secret_key,omitempty"` + + // milvus status. + Status *string `json:"status" validate:"required"` + + // milvus status code. + StatusCode *int64 `json:"status_code" validate:"required"` + + // storage name. + StorageName *string `json:"storage_name,omitempty"` + + // Tags. + Tags []string `json:"tags" validate:"required"` + + // Predefined tshirt size for the milvus service. + TshirtSize *string `json:"tshirt_size" validate:"required"` + + // service type. + Type *string `json:"type,omitempty"` + + // vector. + Vector *int64 `json:"vector,omitempty"` + + // vector dimension. + VectorDimension *int64 `json:"vector_dimension,omitempty"` + + // Milvus version. + Version *string `json:"version,omitempty"` +} + +// Constants associated with the MilvusService.IndexType property. +// Index type of milvus engine. +const ( + MilvusService_IndexType_Hnsw = "hnsw" + MilvusService_IndexType_IvfPq = "ivf_pq" + MilvusService_IndexType_IvfSq8 = "ivf_sq8" +) + +// Constants associated with the MilvusService.Origin property. +// Origin of the milvus service. +const ( + MilvusService_Origin_Native = "native" +) + +// Constants associated with the MilvusService.Status property. +// milvus status. +const ( + MilvusService_Status_Pending = "pending" + MilvusService_Status_Running = "running" + MilvusService_Status_Stopped = "stopped" +) + +// Constants associated with the MilvusService.TshirtSize property. +// Predefined tshirt size for the milvus service. +const ( + MilvusService_TshirtSize_Custom = "custom" + MilvusService_TshirtSize_Large = "large" + MilvusService_TshirtSize_Medium = "medium" + MilvusService_TshirtSize_Small = "small" + MilvusService_TshirtSize_Starter = "starter" +) + +// UnmarshalMilvusService unmarshals an instance of MilvusService from the specified map of raw messages. +func UnmarshalMilvusService(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MilvusService) + err = core.UnmarshalPrimitive(m, "access_key", &obj.AccessKey) + if err != nil { + err = core.SDKErrorf(err, "", "access_key-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) + if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "dc_cpu", &obj.DcCpu) + if err != nil { + err = core.SDKErrorf(err, "", "dc_cpu-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "dc_memory", &obj.DcMemory) + if err != nil { + err = core.SDKErrorf(err, "", "dc_memory-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "dc_replicas", &obj.DcReplicas) + if err != nil { + err = core.SDKErrorf(err, "", "dc_replicas-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "dw_cpu", &obj.DwCpu) + if err != nil { + err = core.SDKErrorf(err, "", "dw_cpu-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "dw_memory", &obj.DwMemory) + if err != nil { + err = core.SDKErrorf(err, "", "dw_memory-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "dw_replicas", &obj.DwReplicas) + if err != nil { + err = core.SDKErrorf(err, "", "dw_replicas-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) + if err != nil { + err = core.SDKErrorf(err, "", "endpoint-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "etcd_cpu", &obj.EtcdCpu) + if err != nil { + err = core.SDKErrorf(err, "", "etcd_cpu-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "etcd_memory", &obj.EtcdMemory) + if err != nil { + err = core.SDKErrorf(err, "", "etcd_memory-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "failure_message", &obj.FailureMessage) + if err != nil { + err = core.SDKErrorf(err, "", "failure_message-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "grpc_host", &obj.GrpcHost) + if err != nil { + err = core.SDKErrorf(err, "", "grpc_host-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "grpc_port", &obj.GrpcPort) + if err != nil { + err = core.SDKErrorf(err, "", "grpc_port-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "host_name", &obj.HostName) + if err != nil { + err = core.SDKErrorf(err, "", "host_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "https_host", &obj.HttpsHost) + if err != nil { + err = core.SDKErrorf(err, "", "https_host-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "https_port", &obj.HttpsPort) + if err != nil { + err = core.SDKErrorf(err, "", "https_port-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "index_type", &obj.IndexType) + if err != nil { + err = core.SDKErrorf(err, "", "index_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "iw_cpu", &obj.IwCpu) + if err != nil { + err = core.SDKErrorf(err, "", "iw_cpu-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "iw_memory", &obj.IwMemory) + if err != nil { + err = core.SDKErrorf(err, "", "iw_memory-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "iw_replicas", &obj.IwReplicas) + if err != nil { + err = core.SDKErrorf(err, "", "iw_replicas-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "kafka_cpu", &obj.KafkaCpu) + if err != nil { + err = core.SDKErrorf(err, "", "kafka_cpu-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "kafka_memory", &obj.KafkaMemory) + if err != nil { + err = core.SDKErrorf(err, "", "kafka_memory-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) + if err != nil { + err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "proxy_cpu", &obj.ProxyCpu) + if err != nil { + err = core.SDKErrorf(err, "", "proxy_cpu-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "proxy_host", &obj.ProxyHost) + if err != nil { + err = core.SDKErrorf(err, "", "proxy_host-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "proxy_memory", &obj.ProxyMemory) + if err != nil { + err = core.SDKErrorf(err, "", "proxy_memory-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "proxy_port", &obj.ProxyPort) + if err != nil { + err = core.SDKErrorf(err, "", "proxy_port-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "proxy_replicas", &obj.ProxyReplicas) + if err != nil { + err = core.SDKErrorf(err, "", "proxy_replicas-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "qc_cpu", &obj.QcCpu) + if err != nil { + err = core.SDKErrorf(err, "", "qc_cpu-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "qc_memory", &obj.QcMemory) + if err != nil { + err = core.SDKErrorf(err, "", "qc_memory-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "qc_replicas", &obj.QcReplicas) + if err != nil { + err = core.SDKErrorf(err, "", "qc_replicas-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "qw_cpu", &obj.QwCpu) + if err != nil { + err = core.SDKErrorf(err, "", "qw_cpu-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "qw_memory", &obj.QwMemory) + if err != nil { + err = core.SDKErrorf(err, "", "qw_memory-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "qw_replicas", &obj.QwReplicas) + if err != nil { + err = core.SDKErrorf(err, "", "qw_replicas-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "rc_cpu", &obj.RcCpu) + if err != nil { + err = core.SDKErrorf(err, "", "rc_cpu-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "rc_memory", &obj.RcMemory) + if err != nil { + err = core.SDKErrorf(err, "", "rc_memory-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "rc_replicas", &obj.RcReplicas) + if err != nil { + err = core.SDKErrorf(err, "", "rc_replicas-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "root_path", &obj.RootPath) + if err != nil { + err = core.SDKErrorf(err, "", "root_path-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "secret_key", &obj.SecretKey) + if err != nil { + err = core.SDKErrorf(err, "", "secret_key-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) + if err != nil { + err = core.SDKErrorf(err, "", "status_code-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "storage_name", &obj.StorageName) + if err != nil { + err = core.SDKErrorf(err, "", "storage_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tshirt_size", &obj.TshirtSize) + if err != nil { + err = core.SDKErrorf(err, "", "tshirt_size-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "vector", &obj.Vector) + if err != nil { + err = core.SDKErrorf(err, "", "vector-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "vector_dimension", &obj.VectorDimension) + if err != nil { + err = core.SDKErrorf(err, "", "vector_dimension-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +func (*WatsonxDataV3) NewMilvusServicePatch(milvusService *MilvusService) (_patch []JSONPatchOperation) { + if (milvusService.AccessKey != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/access_key"), + Value: milvusService.AccessKey, + }) + } + if (milvusService.Actions != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/actions"), + Value: milvusService.Actions, + }) + } + if (milvusService.CreatedAt != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/created_at"), + Value: milvusService.CreatedAt, + }) + } + if (milvusService.CreatedBy != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/created_by"), + Value: milvusService.CreatedBy, + }) + } + if (milvusService.DcCpu != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/dc_cpu"), + Value: milvusService.DcCpu, + }) + } + if (milvusService.DcMemory != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/dc_memory"), + Value: milvusService.DcMemory, + }) + } + if (milvusService.DcReplicas != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/dc_replicas"), + Value: milvusService.DcReplicas, + }) + } + if (milvusService.Description != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/description"), + Value: milvusService.Description, + }) + } + if (milvusService.DisplayName != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/display_name"), + Value: milvusService.DisplayName, + }) + } + if (milvusService.DwCpu != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/dw_cpu"), + Value: milvusService.DwCpu, + }) + } + if (milvusService.DwMemory != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/dw_memory"), + Value: milvusService.DwMemory, + }) + } + if (milvusService.DwReplicas != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/dw_replicas"), + Value: milvusService.DwReplicas, + }) + } + if (milvusService.Endpoint != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/endpoint"), + Value: milvusService.Endpoint, + }) + } + if (milvusService.EtcdCpu != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/etcd_cpu"), + Value: milvusService.EtcdCpu, + }) + } + if (milvusService.EtcdMemory != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/etcd_memory"), + Value: milvusService.EtcdMemory, + }) + } + if (milvusService.FailureMessage != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/failure_message"), + Value: milvusService.FailureMessage, + }) + } + if (milvusService.GrpcHost != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/grpc_host"), + Value: milvusService.GrpcHost, + }) + } + if (milvusService.GrpcPort != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/grpc_port"), + Value: milvusService.GrpcPort, + }) + } + if (milvusService.HostName != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/host_name"), + Value: milvusService.HostName, + }) + } + if (milvusService.HttpsHost != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/https_host"), + Value: milvusService.HttpsHost, + }) + } + if (milvusService.HttpsPort != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/https_port"), + Value: milvusService.HttpsPort, + }) + } + if (milvusService.ID != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/id"), + Value: milvusService.ID, + }) + } + if (milvusService.IndexType != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/index_type"), + Value: milvusService.IndexType, + }) + } + if (milvusService.IwCpu != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/iw_cpu"), + Value: milvusService.IwCpu, + }) + } + if (milvusService.IwMemory != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/iw_memory"), + Value: milvusService.IwMemory, + }) + } + if (milvusService.IwReplicas != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/iw_replicas"), + Value: milvusService.IwReplicas, + }) + } + if (milvusService.KafkaCpu != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/kafka_cpu"), + Value: milvusService.KafkaCpu, + }) + } + if (milvusService.KafkaMemory != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/kafka_memory"), + Value: milvusService.KafkaMemory, + }) + } + if (milvusService.ManagedBy != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/managed_by"), + Value: milvusService.ManagedBy, + }) + } + if (milvusService.Origin != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/origin"), + Value: milvusService.Origin, + }) + } + if (milvusService.ProxyCpu != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/proxy_cpu"), + Value: milvusService.ProxyCpu, + }) + } + if (milvusService.ProxyHost != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/proxy_host"), + Value: milvusService.ProxyHost, + }) + } + if (milvusService.ProxyMemory != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/proxy_memory"), + Value: milvusService.ProxyMemory, + }) + } + if (milvusService.ProxyPort != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/proxy_port"), + Value: milvusService.ProxyPort, + }) + } + if (milvusService.ProxyReplicas != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/proxy_replicas"), + Value: milvusService.ProxyReplicas, + }) + } + if (milvusService.QcCpu != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/qc_cpu"), + Value: milvusService.QcCpu, + }) + } + if (milvusService.QcMemory != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/qc_memory"), + Value: milvusService.QcMemory, + }) + } + if (milvusService.QcReplicas != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/qc_replicas"), + Value: milvusService.QcReplicas, + }) + } + if (milvusService.QwCpu != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/qw_cpu"), + Value: milvusService.QwCpu, + }) + } + if (milvusService.QwMemory != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/qw_memory"), + Value: milvusService.QwMemory, + }) + } + if (milvusService.QwReplicas != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/qw_replicas"), + Value: milvusService.QwReplicas, + }) + } + if (milvusService.RcCpu != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/rc_cpu"), + Value: milvusService.RcCpu, + }) + } + if (milvusService.RcMemory != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/rc_memory"), + Value: milvusService.RcMemory, + }) + } + if (milvusService.RcReplicas != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/rc_replicas"), + Value: milvusService.RcReplicas, + }) + } + if (milvusService.RootPath != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/root_path"), + Value: milvusService.RootPath, + }) + } + if (milvusService.SecretKey != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/secret_key"), + Value: milvusService.SecretKey, + }) + } + if (milvusService.Status != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/status"), + Value: milvusService.Status, + }) + } + if (milvusService.StatusCode != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/status_code"), + Value: milvusService.StatusCode, + }) + } + if (milvusService.StorageName != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/storage_name"), + Value: milvusService.StorageName, + }) + } + if (milvusService.Tags != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/tags"), + Value: milvusService.Tags, + }) + } + if (milvusService.TshirtSize != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/tshirt_size"), + Value: milvusService.TshirtSize, + }) + } + if (milvusService.Type != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/type"), + Value: milvusService.Type, + }) + } + if (milvusService.Vector != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/vector"), + Value: milvusService.Vector, + }) + } + if (milvusService.VectorDimension != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/vector_dimension"), + Value: milvusService.VectorDimension, + }) + } + if (milvusService.Version != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/version"), + Value: milvusService.Version, + }) + } + return +} + +// MilvusServiceCollection : List milvus services. +type MilvusServiceCollection struct { + // List of milvus services. + MilvusServices []MilvusService `json:"milvus_services" validate:"required"` +} + +// UnmarshalMilvusServiceCollection unmarshals an instance of MilvusServiceCollection from the specified map of raw messages. +func UnmarshalMilvusServiceCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MilvusServiceCollection) + err = core.UnmarshalModel(m, "milvus_services", &obj.MilvusServices, UnmarshalMilvusService) + if err != nil { + err = core.SDKErrorf(err, "", "milvus_services-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// MilvusServiceDatabases : List milvus service databases. +type MilvusServiceDatabases struct { + // List of milvus service databases. + Databases []Milvusdb `json:"databases" validate:"required"` +} + +// UnmarshalMilvusServiceDatabases unmarshals an instance of MilvusServiceDatabases from the specified map of raw messages. +func UnmarshalMilvusServiceDatabases(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MilvusServiceDatabases) + err = core.UnmarshalModel(m, "databases", &obj.Databases, UnmarshalMilvusdb) + if err != nil { + err = core.SDKErrorf(err, "", "databases-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// MilvusServicePatch : Milvus service update request. +type MilvusServicePatch struct { + // Modified description. + Description *string `json:"description,omitempty"` + + // Service display name. + DisplayName *string `json:"display_name,omitempty"` + + // Tags. + Tags []string `json:"tags,omitempty"` +} + +// UnmarshalMilvusServicePatch unmarshals an instance of MilvusServicePatch from the specified map of raw messages. +func UnmarshalMilvusServicePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(MilvusServicePatch) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the MilvusServicePatch +func (milvusServicePatch *MilvusServicePatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(milvusServicePatch.Description) { + _patch["description"] = milvusServicePatch.Description + } + if !core.IsNil(milvusServicePatch.DisplayName) { + _patch["display_name"] = milvusServicePatch.DisplayName + } + if !core.IsNil(milvusServicePatch.Tags) { + _patch["tags"] = milvusServicePatch.Tags + } + + return +} + +// Milvusdb : Details of the Milvus database. +type Milvusdb struct { + // List of databases. + ID *string `json:"id,omitempty"` +} + +// UnmarshalMilvusdb unmarshals an instance of Milvusdb from the specified map of raw messages. +func UnmarshalMilvusdb(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Milvusdb) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetezzaEngine : Netezza engine details. +type NetezzaEngine struct { + // Actions. + Actions []string `json:"actions" validate:"required"` + + // watsonx.data build version. + BuildVersion *string `json:"build_version,omitempty"` + + // External engine details. + Configuration *NetezzaEngineConfiguration `json:"configuration,omitempty"` + + // Created time in epoch format. + CreatedAt *int64 `json:"created_at,omitempty"` + + // Username of the user who created the watsonx.data instance. + CreatedBy *string `json:"created_by,omitempty"` + + // Engine description. + Description *string `json:"description,omitempty"` + + // Engine display name. + DisplayName *string `json:"display_name,omitempty"` + + // Engine host name. In case of OCP based clusters, this is internal hostname. + HostName *string `json:"host_name,omitempty"` + + // Engine programmatic name. + ID *string `json:"id,omitempty"` + + // Origin - place holder. + Origin *string `json:"origin,omitempty"` + + // Engine port. + Port *int64 `json:"port,omitempty"` + + // Engine status. + Status *string `json:"status,omitempty"` + + // Tags. + Tags []string `json:"tags" validate:"required"` + + // Engine type. + Type *string `json:"type,omitempty"` +} + +// UnmarshalNetezzaEngine unmarshals an instance of NetezzaEngine from the specified map of raw messages. +func UnmarshalNetezzaEngine(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetezzaEngine) + err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) + if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "build_version", &obj.BuildVersion) + if err != nil { + err = core.SDKErrorf(err, "", "build_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalNetezzaEngineConfiguration) + if err != nil { + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "host_name", &obj.HostName) + if err != nil { + err = core.SDKErrorf(err, "", "host_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetezzaEngineCollection : list Netezza engines. +type NetezzaEngineCollection struct { + // list Netezza engines. + NetezzaEngines []NetezzaEngine `json:"netezza_engines" validate:"required"` +} + +// UnmarshalNetezzaEngineCollection unmarshals an instance of NetezzaEngineCollection from the specified map of raw messages. +func UnmarshalNetezzaEngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetezzaEngineCollection) + err = core.UnmarshalModel(m, "netezza_engines", &obj.NetezzaEngines, UnmarshalNetezzaEngine) + if err != nil { + err = core.SDKErrorf(err, "", "netezza_engines-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetezzaEngineConfiguration : External engine details. +type NetezzaEngineConfiguration struct { + // External engine connection string. + ConnectionString *string `json:"connection_string,omitempty"` + + // Metastore host. + MetastoreHost *string `json:"metastore_host,omitempty"` +} + +// UnmarshalNetezzaEngineConfiguration unmarshals an instance of NetezzaEngineConfiguration from the specified map of raw messages. +func UnmarshalNetezzaEngineConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetezzaEngineConfiguration) + err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) + if err != nil { + err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "metastore_host", &obj.MetastoreHost) + if err != nil { + err = core.SDKErrorf(err, "", "metastore_host-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetezzaEngineConfigurationBody : External engine details. +type NetezzaEngineConfigurationBody struct { + // External engine connection string. + ConnectionString *string `json:"connection_string" validate:"required"` +} + +// NewNetezzaEngineConfigurationBody : Instantiate NetezzaEngineConfigurationBody (Generic Model Constructor) +func (*WatsonxDataV3) NewNetezzaEngineConfigurationBody(connectionString string) (_model *NetezzaEngineConfigurationBody, err error) { + _model = &NetezzaEngineConfigurationBody{ + ConnectionString: core.StringPtr(connectionString), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalNetezzaEngineConfigurationBody unmarshals an instance of NetezzaEngineConfigurationBody from the specified map of raw messages. +func UnmarshalNetezzaEngineConfigurationBody(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetezzaEngineConfigurationBody) + err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) + if err != nil { + err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetezzaEnginePatch : UpdateEngine body. +type NetezzaEnginePatch struct { + // Modified description. + Description *string `json:"description,omitempty"` + + // Engine display name. + DisplayName *string `json:"display_name,omitempty"` + + // Tags. + Tags []string `json:"tags,omitempty"` +} + +// UnmarshalNetezzaEnginePatch unmarshals an instance of NetezzaEnginePatch from the specified map of raw messages. +func UnmarshalNetezzaEnginePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetezzaEnginePatch) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the NetezzaEnginePatch +func (netezzaEnginePatch *NetezzaEnginePatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(netezzaEnginePatch.Description) { + _patch["description"] = netezzaEnginePatch.Description + } + if !core.IsNil(netezzaEnginePatch.DisplayName) { + _patch["display_name"] = netezzaEnginePatch.DisplayName + } + if !core.IsNil(netezzaEnginePatch.Tags) { + _patch["tags"] = netezzaEnginePatch.Tags + } + + return +} + +// NodeDescription : Presto engine configurations. +type NodeDescription struct { + // Presto engine node type. + NodeType *string `json:"node_type,omitempty"` + + // Quantity of presto engine node. + Quantity *int64 `json:"quantity,omitempty"` +} + +// UnmarshalNodeDescription unmarshals an instance of NodeDescription from the specified map of raw messages. +func UnmarshalNodeDescription(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NodeDescription) + err = core.UnmarshalPrimitive(m, "node_type", &obj.NodeType) + if err != nil { + err = core.SDKErrorf(err, "", "node_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "quantity", &obj.Quantity) + if err != nil { + err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OtherEngine : external engine details. +type OtherEngine struct { + // Actions. + Actions []string `json:"actions" validate:"required"` + + // External engine details. + Configuration *OtherEngineConfiguration `json:"configuration,omitempty"` + + // created time in epoch format. + CreatedAt *int64 `json:"created_at,omitempty"` + + // Username of the user who created the watsonx.data instance. + CreatedBy *string `json:"created_by,omitempty"` + + // engine description. + Description *string `json:"description,omitempty"` + + // Engine display name. + DisplayName *string `json:"display_name,omitempty"` + + // Engine host name. In case of OCP based clusters, this is internal hostname. + HostName *string `json:"host_name,omitempty"` + + // engine programmatic name. + ID *string `json:"id,omitempty"` + + // origin. + Origin *string `json:"origin,omitempty"` + + // Engine port. + Port *int64 `json:"port,omitempty"` + + // engine status. + Status *string `json:"status,omitempty"` + + // Tags. + Tags []string `json:"tags" validate:"required"` + + // Type like presto, netezza, external,.. + Type *string `json:"type,omitempty"` +} + +// UnmarshalOtherEngine unmarshals an instance of OtherEngine from the specified map of raw messages. +func UnmarshalOtherEngine(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OtherEngine) + err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) + if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalOtherEngineConfiguration) + if err != nil { + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "host_name", &obj.HostName) + if err != nil { + err = core.SDKErrorf(err, "", "host_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OtherEngineCollection : list other engines. +type OtherEngineCollection struct { + // list other engines. + OtherEngines []OtherEngine `json:"other_engines" validate:"required"` +} + +// UnmarshalOtherEngineCollection unmarshals an instance of OtherEngineCollection from the specified map of raw messages. +func UnmarshalOtherEngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OtherEngineCollection) + err = core.UnmarshalModel(m, "other_engines", &obj.OtherEngines, UnmarshalOtherEngine) + if err != nil { + err = core.SDKErrorf(err, "", "other_engines-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OtherEngineConfiguration : External engine details. +type OtherEngineConfiguration struct { + // external engine connection string. + ConnectionString *string `json:"connection_string" validate:"required"` + + // metastore host - not required while registering an engine. + MetastoreHost *string `json:"metastore_host,omitempty"` + + // Actual engine type. + Type *string `json:"type" validate:"required"` +} + +// UnmarshalOtherEngineConfiguration unmarshals an instance of OtherEngineConfiguration from the specified map of raw messages. +func UnmarshalOtherEngineConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OtherEngineConfiguration) + err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) + if err != nil { + err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "metastore_host", &obj.MetastoreHost) + if err != nil { + err = core.SDKErrorf(err, "", "metastore_host-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OtherEngineConfigurationBody : External engine details. +type OtherEngineConfigurationBody struct { + // External engine connection string. + ConnectionString *string `json:"connection_string" validate:"required"` + + // Actual engine type. + Type *string `json:"type" validate:"required"` +} + +// NewOtherEngineConfigurationBody : Instantiate OtherEngineConfigurationBody (Generic Model Constructor) +func (*WatsonxDataV3) NewOtherEngineConfigurationBody(connectionString string, typeVar string) (_model *OtherEngineConfigurationBody, err error) { + _model = &OtherEngineConfigurationBody{ + ConnectionString: core.StringPtr(connectionString), + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalOtherEngineConfigurationBody unmarshals an instance of OtherEngineConfigurationBody from the specified map of raw messages. +func UnmarshalOtherEngineConfigurationBody(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OtherEngineConfigurationBody) + err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) + if err != nil { + err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PagedResultsLink : Pagination next/previous page links. +type PagedResultsLink struct { + // Pagination Link. + Href *string `json:"href,omitempty"` +} + +// UnmarshalPagedResultsLink unmarshals an instance of PagedResultsLink from the specified map of raw messages. +func UnmarshalPagedResultsLink(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PagedResultsLink) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PaginationLink : Link to a page of results. +type PaginationLink struct { + // URL to a specific page. + Href *string `json:"href,omitempty"` +} + +// UnmarshalPaginationLink unmarshals an instance of PaginationLink from the specified map of raw messages. +func UnmarshalPaginationLink(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PaginationLink) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + err = core.SDKErrorf(err, "", "href-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PatchAutoscalingConfig : Updated autoscaling configuration. +type PatchAutoscalingConfig struct { + // CPU target in percentage for autoscaling event. + Target *int64 `json:"target,omitempty"` + + // Minimum number of worker nodes. + MinWorkerQuantity *int64 `json:"min_worker_quantity,omitempty"` + + // Maximum number of worker nodes. + MaxWorkerQuantity *int64 `json:"max_worker_quantity,omitempty"` + + // Pod termination wait time in minutes. + QueryTerminationGracePeriodMin *int64 `json:"query_termination_grace_period_min,omitempty"` + + // Wait time between scale-in operations in minutes. + ScaleInStabilizationWindowMin *int64 `json:"scale_in_stabilization_window_min,omitempty"` + + // Number of workers to add/remove per scaling operation. + ScalingStepSize *int64 `json:"scaling_step_size,omitempty"` +} + +// UnmarshalPatchAutoscalingConfig unmarshals an instance of PatchAutoscalingConfig from the specified map of raw messages. +func UnmarshalPatchAutoscalingConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PatchAutoscalingConfig) + err = core.UnmarshalPrimitive(m, "target", &obj.Target) + if err != nil { + err = core.SDKErrorf(err, "", "target-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "min_worker_quantity", &obj.MinWorkerQuantity) + if err != nil { + err = core.SDKErrorf(err, "", "min_worker_quantity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "max_worker_quantity", &obj.MaxWorkerQuantity) + if err != nil { + err = core.SDKErrorf(err, "", "max_worker_quantity-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "query_termination_grace_period_min", &obj.QueryTerminationGracePeriodMin) + if err != nil { + err = core.SDKErrorf(err, "", "query_termination_grace_period_min-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "scale_in_stabilization_window_min", &obj.ScaleInStabilizationWindowMin) + if err != nil { + err = core.SDKErrorf(err, "", "scale_in_stabilization_window_min-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "scaling_step_size", &obj.ScalingStepSize) + if err != nil { + err = core.SDKErrorf(err, "", "scaling_step_size-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PatchAutoscalingSuccess : Autoscaling configuration update success response. +type PatchAutoscalingSuccess struct { + // Whether autoscaling is enabled. + AutoscalingEnabled *bool `json:"autoscaling_enabled,omitempty"` + + // Updated autoscaling configuration. + AutoscalingConfig *PatchAutoscalingConfig `json:"autoscaling_config,omitempty"` +} + +// UnmarshalPatchAutoscalingSuccess unmarshals an instance of PatchAutoscalingSuccess from the specified map of raw messages. +func UnmarshalPatchAutoscalingSuccess(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PatchAutoscalingSuccess) + err = core.UnmarshalPrimitive(m, "autoscaling_enabled", &obj.AutoscalingEnabled) + if err != nil { + err = core.SDKErrorf(err, "", "autoscaling_enabled-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "autoscaling_config", &obj.AutoscalingConfig, UnmarshalPatchAutoscalingConfig) + if err != nil { + err = core.SDKErrorf(err, "", "autoscaling_config-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Path : Storage object size. +type Path struct { + // object path. + Path *string `json:"path,omitempty"` +} + +// UnmarshalPath unmarshals an instance of Path from the specified map of raw messages. +func UnmarshalPath(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Path) + err = core.UnmarshalPrimitive(m, "path", &obj.Path) + if err != nil { + err = core.SDKErrorf(err, "", "path-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PausePrestissimoEngineOptions : The PausePrestissimoEngine options. +type PausePrestissimoEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewPausePrestissimoEngineOptions : Instantiate PausePrestissimoEngineOptions +func (*WatsonxDataV3) NewPausePrestissimoEngineOptions(id string) *PausePrestissimoEngineOptions { + return &PausePrestissimoEngineOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *PausePrestissimoEngineOptions) SetID(id string) *PausePrestissimoEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *PausePrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *PausePrestissimoEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *PausePrestissimoEngineOptions) SetHeaders(param map[string]string) *PausePrestissimoEngineOptions { + options.Headers = param + return options +} + +// PausePrestoEngineOptions : The PausePrestoEngine options. +type PausePrestoEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewPausePrestoEngineOptions : Instantiate PausePrestoEngineOptions +func (*WatsonxDataV3) NewPausePrestoEngineOptions(id string) *PausePrestoEngineOptions { + return &PausePrestoEngineOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *PausePrestoEngineOptions) SetID(id string) *PausePrestoEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *PausePrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *PausePrestoEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *PausePrestoEngineOptions) SetHeaders(param map[string]string) *PausePrestoEngineOptions { + options.Headers = param + return options +} + +// PauseSparkEngineOptions : The PauseSparkEngine options. +type PauseSparkEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` + + // force spark engine pause. Default value is false. + Force *bool `json:"force,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewPauseSparkEngineOptions : Instantiate PauseSparkEngineOptions +func (*WatsonxDataV3) NewPauseSparkEngineOptions(id string) *PauseSparkEngineOptions { + return &PauseSparkEngineOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *PauseSparkEngineOptions) SetID(id string) *PauseSparkEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetForce : Allow user to set Force +func (_options *PauseSparkEngineOptions) SetForce(force bool) *PauseSparkEngineOptions { + _options.Force = core.BoolPtr(force) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *PauseSparkEngineOptions) SetAuthInstanceID(authInstanceID string) *PauseSparkEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *PauseSparkEngineOptions) SetHeaders(param map[string]string) *PauseSparkEngineOptions { + options.Headers = param + return options +} + +// Permission : Permission struct +type Permission struct { + // Eligible permission that the specific user can have on the resource type identifier provided. Resource types can be + // presto, prestissimo, spark, milvus, database, catalogs and storages. + Action *string `json:"action" validate:"required"` + + // Permission type to the resource. It can be explicit or implicit. + PermissionType *string `json:"permission_type" validate:"required"` +} + +// Constants associated with the Permission.Action property. +// Eligible permission that the specific user can have on the resource type identifier provided. Resource types can be +// presto, prestissimo, spark, milvus, database, catalogs and storages. +const ( + Permission_Action_CanAdminister = "can_administer" + Permission_Action_CanManage = "can_manage" + Permission_Action_CanRead = "can_read" + Permission_Action_CanUse = "can_use" + Permission_Action_CanWrite = "can_write" + Permission_Action_MilvusCollectionCreator = "milvus_collection_creator" + Permission_Action_MilvusDbCreator = "milvus_db_creator" + Permission_Action_MilvusPartitionCreator = "milvus_partition_creator" + Permission_Action_SchemaOwner = "schema_owner" + Permission_Action_TableOwner = "table_owner" +) + +// Constants associated with the Permission.PermissionType property. +// Permission type to the resource. It can be explicit or implicit. +const ( + Permission_PermissionType_Explicit = "explicit" + Permission_PermissionType_Implicit = "implicit" +) + +// UnmarshalPermission unmarshals an instance of Permission from the specified map of raw messages. +func UnmarshalPermission(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Permission) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + err = core.SDKErrorf(err, "", "action-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "permission_type", &obj.PermissionType) + if err != nil { + err = core.SDKErrorf(err, "", "permission_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PolicyRuleV2 : PolicyRuleV2 struct +type PolicyRuleV2 struct { + // the actions to enforce when the data policy triggers. + Actions []string `json:"actions" validate:"required"` + + // defines the effect of the data policy. Values can be allow or deny. Deny will have priority over allow. + Effect *string `json:"effect" validate:"required"` + + // the grantees to be granted. + Grantees []RuleGrantee `json:"grantees" validate:"required"` + + // Defines column-level data masking transformation properties. This schema specifies the type of masking to apply to + // sensitive data columns, optional masking conditions, and the list of users or groups (grantees) who are authorized + // to view the masked data. Column masking helps protect sensitive information while maintaining data utility for + // authorized users. + TransformColumns *TransformColumnResponseProperties `json:"transform_columns,omitempty"` + + // Defines row-level filtering properties for data access control. This schema specifies filter conditions that + // determine which rows of data are visible to specific users or groups (grantees). Row filtering enables fine-grained + // access control by restricting data visibility based on row attribute values, ensuring users only see data they are + // authorized to access. + TransformRows *RowFilterProperties `json:"transform_rows,omitempty"` +} + +// Constants associated with the PolicyRuleV2.Effect property. +// defines the effect of the data policy. Values can be allow or deny. Deny will have priority over allow. +const ( + PolicyRuleV2_Effect_Allow = "allow" + PolicyRuleV2_Effect_Deny = "deny" +) + +// UnmarshalPolicyRuleV2 unmarshals an instance of PolicyRuleV2 from the specified map of raw messages. +func UnmarshalPolicyRuleV2(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PolicyRuleV2) + err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) + if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "effect", &obj.Effect) + if err != nil { + err = core.SDKErrorf(err, "", "effect-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "grantees", &obj.Grantees, UnmarshalRuleGrantee) + if err != nil { + err = core.SDKErrorf(err, "", "grantees-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "transform_columns", &obj.TransformColumns, UnmarshalTransformColumnResponseProperties) + if err != nil { + err = core.SDKErrorf(err, "", "transform_columns-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "transform_rows", &obj.TransformRows, UnmarshalRowFilterProperties) + if err != nil { + err = core.SDKErrorf(err, "", "transform_rows-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PolicyV2 : This data policy object contains the unique name of data policy, metadata of the data policy, catalog name, data +// artifact which is used to identify the object in the resource, policy status, resource id and the list of rules in +// data policy. +type PolicyV2 struct { + // name of catalog on which the data policy applies. + CatalogName *string `json:"catalog_name,omitempty"` + + // The data artifact used to identify the object in the resource. + DataArtifact *string `json:"data_artifact,omitempty"` + + // More detailed description of the policy. + Description *string `json:"description,omitempty"` + + // Metadata for data policy. It contains policy identifier, creator of the policy, time when thw policy got created, + // time when the policy got updated, last modifier of the policy and the version of data policy. + Metadata *GetDataPolicyMetadata `json:"metadata,omitempty"` + + // The unique name of the data policy. + PolicyName *string `json:"policy_name,omitempty"` + + // identifier of the resource on which the data policy applies. + ResourceID *string `json:"resource_id,omitempty"` + + // Total number of rules in each data policy. Rule defines who can access what. + RuleCount *int64 `json:"rule_count,omitempty"` + + // The rules list. + Rules []PolicyRuleV2 `json:"rules" validate:"required"` + + // The data policy status. Values can be active or inactive. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the PolicyV2.Status property. +// The data policy status. Values can be active or inactive. +const ( + PolicyV2_Status_Active = "active" + PolicyV2_Status_Inactive = "inactive" +) + +// UnmarshalPolicyV2 unmarshals an instance of PolicyV2 from the specified map of raw messages. +func UnmarshalPolicyV2(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PolicyV2) + err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "data_artifact", &obj.DataArtifact) + if err != nil { + err = core.SDKErrorf(err, "", "data_artifact-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "metadata", &obj.Metadata, UnmarshalGetDataPolicyMetadata) + if err != nil { + err = core.SDKErrorf(err, "", "metadata-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "policy_name", &obj.PolicyName) + if err != nil { + err = core.SDKErrorf(err, "", "policy_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_id", &obj.ResourceID) + if err != nil { + err = core.SDKErrorf(err, "", "resource_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "rule_count", &obj.RuleCount) + if err != nil { + err = core.SDKErrorf(err, "", "rule_count-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalPolicyRuleV2) + if err != nil { + err = core.SDKErrorf(err, "", "rules-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +func (*WatsonxDataV3) NewPolicyV2Patch(policyV2 *PolicyV2) (_patch []JSONPatchOperation) { + if (policyV2.CatalogName != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/catalog_name"), + Value: policyV2.CatalogName, + }) + } + if (policyV2.DataArtifact != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/data_artifact"), + Value: policyV2.DataArtifact, + }) + } + if (policyV2.Description != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/description"), + Value: policyV2.Description, + }) + } + if (policyV2.Metadata != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/metadata"), + Value: policyV2.Metadata, + }) + } + if (policyV2.PolicyName != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/policy_name"), + Value: policyV2.PolicyName, + }) + } + if (policyV2.ResourceID != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/resource_id"), + Value: policyV2.ResourceID, + }) + } + if (policyV2.RuleCount != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/rule_count"), + Value: policyV2.RuleCount, + }) + } + if (policyV2.Rules != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/rules"), + Value: policyV2.Rules, + }) + } + if (policyV2.Status != nil) { + _patch = append(_patch, JSONPatchOperation{ + Op: core.StringPtr(JSONPatchOperation_Op_Add), + Path: core.StringPtr("/status"), + Value: policyV2.Status, + }) + } + return +} + +// PolicyV2Collection : PolicyV2Collection schema contains the list of data policies. +type PolicyV2Collection struct { + // policy collection. + DataPolicies []PolicyV2 `json:"data_policies" validate:"required"` + + // Total number of policies retrieved as reponse of get data policies. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalPolicyV2Collection unmarshals an instance of PolicyV2Collection from the specified map of raw messages. +func UnmarshalPolicyV2Collection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PolicyV2Collection) + err = core.UnmarshalModel(m, "data_policies", &obj.DataPolicies, UnmarshalPolicyV2) + if err != nil { + err = core.SDKErrorf(err, "", "data_policies-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PrestissimoEngine : EngineDetail. +type PrestissimoEngine struct { + // Actions. + Actions []string `json:"actions" validate:"required"` + + // status of optimizer sync. + AnalyzeStatus *string `json:"analyze_status,omitempty"` + + // List of catalogs associated with the the engine. + AssociatedCatalogs []string `json:"associated_catalogs" validate:"required"` + + // watsonx.data build version. + BuildVersion *string `json:"build_version,omitempty"` + + // External engine details. + Configuration *PrestissimoEngineDetails `json:"configuration,omitempty"` + + // Presto engine configurations. + Coordinator *NodeDescription `json:"coordinator,omitempty"` + + // Created time in epoch format. + CreatedAt *int64 `json:"created_at,omitempty"` + + // Username of the user who created the watsonx.data instance. + CreatedBy *string `json:"created_by,omitempty"` + + // Engine description. + Description *string `json:"description,omitempty"` + + // Engine display name. + DisplayName *string `json:"display_name,omitempty"` + + // Applicable only for OCP based clusters. This is typically servicename+route. + ExternalHostName *string `json:"external_host_name" validate:"required"` + + // Failure message. + FailureMessage *string `json:"failure_message,omitempty"` + + // Group ID. + GroupID *string `json:"group_id,omitempty"` + + // Engine host name. In case of OCP based clusters, this is internal hostname. + HostName *string `json:"host_name,omitempty"` + + // Engine programmatic name. + ID *string `json:"id,omitempty"` + + // Is QHMM engine. + IsQhmmEngine *bool `json:"is_qhmm_engine,omitempty"` + + // last optimizer sync call. + LastTimeAnalyzed *string `json:"last_time_analyzed,omitempty"` + + // optimizer enabled status. + OptimizerEnabled *string `json:"optimizer_enabled,omitempty"` + + // Origin - place holder. + Origin *string `json:"origin" validate:"required"` + + // Engine port. + Port *int64 `json:"port,omitempty"` + + // Engine properties. + Properties *PrestissimoEngineProperties `json:"properties,omitempty"` + + // Query status. + QueryStatus *string `json:"query_status,omitempty"` + + // Region - place holder. + Region *string `json:"region,omitempty"` + + // CPD supported sizes are: custom, starter, small, medium, large, xlarge, and xxlarge. IBM cloud supported sizes are: + // custom, starter, small, medium, large, cache_optimized, compute_optimized and lite. + SizeConfig *string `json:"size_config,omitempty"` + + // Engine status. + Status *string `json:"status" validate:"required"` + + // Engine status code. + StatusCode *int64 `json:"status_code" validate:"required"` + + // Tags. + Tags []string `json:"tags" validate:"required"` + + // RemoveEngine properties. + RemoveEngineProperties *RemovePrestissimoEngineProperties `json:"remove_engine_properties,omitempty"` + + // engine will restart accordingily. + RestartType *string `json:"restart_type,omitempty"` + + // Engine type. + Type *string `json:"type,omitempty"` + + // Version of the engine. + Version *string `json:"version,omitempty"` + + // Presto engine configurations. + Worker *NodeDescription `json:"worker,omitempty"` +} + +// Constants associated with the PrestissimoEngine.Origin property. +// Origin - place holder. +const ( + PrestissimoEngine_Origin_Discover = "discover" + PrestissimoEngine_Origin_External = "external" + PrestissimoEngine_Origin_Native = "native" +) + +// Constants associated with the PrestissimoEngine.Status property. +// Engine status. +const ( + PrestissimoEngine_Status_Pending = "pending" + PrestissimoEngine_Status_Running = "running" + PrestissimoEngine_Status_Stopped = "stopped" +) + +// UnmarshalPrestissimoEngine unmarshals an instance of PrestissimoEngine from the specified map of raw messages. +func UnmarshalPrestissimoEngine(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestissimoEngine) + err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) + if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "analyze_status", &obj.AnalyzeStatus) + if err != nil { + err = core.SDKErrorf(err, "", "analyze_status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "associated_catalogs", &obj.AssociatedCatalogs) + if err != nil { + err = core.SDKErrorf(err, "", "associated_catalogs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "build_version", &obj.BuildVersion) + if err != nil { + err = core.SDKErrorf(err, "", "build_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalPrestissimoEngineDetails) + if err != nil { + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "coordinator", &obj.Coordinator, UnmarshalNodeDescription) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "external_host_name", &obj.ExternalHostName) + if err != nil { + err = core.SDKErrorf(err, "", "external_host_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "failure_message", &obj.FailureMessage) + if err != nil { + err = core.SDKErrorf(err, "", "failure_message-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "group_id", &obj.GroupID) + if err != nil { + err = core.SDKErrorf(err, "", "group_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "host_name", &obj.HostName) + if err != nil { + err = core.SDKErrorf(err, "", "host_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "is_qhmm_engine", &obj.IsQhmmEngine) + if err != nil { + err = core.SDKErrorf(err, "", "is_qhmm_engine-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "last_time_analyzed", &obj.LastTimeAnalyzed) + if err != nil { + err = core.SDKErrorf(err, "", "last_time_analyzed-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "optimizer_enabled", &obj.OptimizerEnabled) + if err != nil { + err = core.SDKErrorf(err, "", "optimizer_enabled-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "properties", &obj.Properties, UnmarshalPrestissimoEngineProperties) + if err != nil { + err = core.SDKErrorf(err, "", "properties-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "query_status", &obj.QueryStatus) + if err != nil { + err = core.SDKErrorf(err, "", "query_status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "region", &obj.Region) + if err != nil { + err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) + return } -} - -// SetCatalogID : Allow user to set CatalogID -func (_options *LoadTableOptions) SetCatalogID(catalogID string) *LoadTableOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options -} - -// SetSchemaID : Allow user to set SchemaID -func (_options *LoadTableOptions) SetSchemaID(schemaID string) *LoadTableOptions { - _options.SchemaID = core.StringPtr(schemaID) - return _options -} - -// SetTableID : Allow user to set TableID -func (_options *LoadTableOptions) SetTableID(tableID string) *LoadTableOptions { - _options.TableID = core.StringPtr(tableID) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *LoadTableOptions) SetAuthInstanceID(authInstanceID string) *LoadTableOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *LoadTableOptions) SetHeaders(param map[string]string) *LoadTableOptions { - options.Headers = param - return options -} - -// LoadTableResponse : LoadTableResponse struct -type LoadTableResponse struct { - // Metadata location. - MetadataLocation *string `json:"metadata_location,omitempty"` - - // Path to the table. - TablePath *string `json:"table_path,omitempty"` -} - -// UnmarshalLoadTableResponse unmarshals an instance of LoadTableResponse from the specified map of raw messages. -func UnmarshalLoadTableResponse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(LoadTableResponse) - err = core.UnmarshalPrimitive(m, "metadata_location", &obj.MetadataLocation) + err = core.UnmarshalPrimitive(m, "size_config", &obj.SizeConfig) if err != nil { - err = core.SDKErrorf(err, "", "metadata_location-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "size_config-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "table_path", &obj.TablePath) + err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { - err = core.SDKErrorf(err, "", "table_path-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) + if err != nil { + err = core.SDKErrorf(err, "", "status_code-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "remove_engine_properties", &obj.RemoveEngineProperties, UnmarshalRemovePrestissimoEngineProperties) + if err != nil { + err = core.SDKErrorf(err, "", "remove_engine_properties-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "restart_type", &obj.RestartType) + if err != nil { + err = core.SDKErrorf(err, "", "restart_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "worker", &obj.Worker, UnmarshalNodeDescription) + if err != nil { + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// MilvusDatabaseCollections : List milvus collections. -type MilvusDatabaseCollections struct { - // milvus collections. - Collections []Milvusdbcollection `json:"collections,omitempty"` +// PrestissimoEngineCollection : list Prestissimo Engines. +type PrestissimoEngineCollection struct { + // list prestissimo engines. + PrestissimoEngines []PrestissimoEngine `json:"prestissimo_engines" validate:"required"` } -// UnmarshalMilvusDatabaseCollections unmarshals an instance of MilvusDatabaseCollections from the specified map of raw messages. -func UnmarshalMilvusDatabaseCollections(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(MilvusDatabaseCollections) - err = core.UnmarshalModel(m, "collections", &obj.Collections, UnmarshalMilvusdbcollection) +// UnmarshalPrestissimoEngineCollection unmarshals an instance of PrestissimoEngineCollection from the specified map of raw messages. +func UnmarshalPrestissimoEngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestissimoEngineCollection) + err = core.UnmarshalModel(m, "prestissimo_engines", &obj.PrestissimoEngines, UnmarshalPrestissimoEngine) if err != nil { - err = core.SDKErrorf(err, "", "collections-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "prestissimo_engines-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// MilvusService : milvus service details. -type MilvusService struct { - // bucket access key. - AccessKey *string `json:"access_key,omitempty"` - - // Actions. - Actions []string `json:"actions,omitempty"` - - // bucket name. - BucketName *string `json:"bucket_name,omitempty"` - - // bucket type. - BucketType *string `json:"bucket_type,omitempty"` - - // Username of the user who created the watsonx.data instance. - CreatedBy *string `json:"created_by,omitempty"` - - // Created time in epoch format. - CreatedOn *int64 `json:"created_on,omitempty"` - - // Service description. - Description *string `json:"description,omitempty"` - - // bucket endpoint. - Endpoint *string `json:"endpoint,omitempty"` - - // milvus grpc_host. - GrpcHost *string `json:"grpc_host,omitempty"` - - // milvus port. - GrpcPort *int64 `json:"grpc_port,omitempty"` - - // milvus display name. - HostName *string `json:"host_name,omitempty"` - - // milvus https_host. - HttpsHost *string `json:"https_host,omitempty"` - - // milvus port. - HttpsPort *int64 `json:"https_port,omitempty"` - - // Origin - place holder. - Origin *string `json:"origin,omitempty"` - - // root path. - RootPath *string `json:"root_path,omitempty"` - - // bucket secret access key. - SecretKey *string `json:"secret_key,omitempty"` - - // Service display name. - ServiceDisplayName *string `json:"service_display_name,omitempty"` - - // Service programmatic name. - ServiceID *string `json:"service_id,omitempty"` - - // milvus status. - Status *string `json:"status,omitempty"` - - // milvus status code. - StatusCode *int64 `json:"status_code" validate:"required"` - - // Tags. - Tags []string `json:"tags,omitempty"` +// PrestissimoEngineDetails : External engine details. +type PrestissimoEngineDetails struct { + // Presto engine configurations. + Coordinator *NodeDescription `json:"coordinator" validate:"required"` - // tshirt size. - TshirtSize *string `json:"tshirt_size,omitempty"` + // CPD supported sizes are: custom, starter, small, medium, large, xlarge, and xxlarge. IBM cloud supported sizes are: + // custom, starter, small, medium, large, cache_optimized, compute_optimized and lite. + SizeConfig *string `json:"size_config" validate:"required"` - // service type. - Type *string `json:"type,omitempty"` + // Presto engine configurations. + Worker *NodeDescription `json:"worker" validate:"required"` } -// Constants associated with the MilvusService.Status property. -// milvus status. -const ( - MilvusService_Status_Pending = "pending" - MilvusService_Status_Running = "running" - MilvusService_Status_Stopped = "stopped" -) - -// UnmarshalMilvusService unmarshals an instance of MilvusService from the specified map of raw messages. -func UnmarshalMilvusService(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(MilvusService) - err = core.UnmarshalPrimitive(m, "access_key", &obj.AccessKey) - if err != nil { - err = core.SDKErrorf(err, "", "access_key-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) - if err != nil { - err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) - return +// NewPrestissimoEngineDetails : Instantiate PrestissimoEngineDetails (Generic Model Constructor) +func (*WatsonxDataV3) NewPrestissimoEngineDetails(coordinator *NodeDescription, sizeConfig string, worker *NodeDescription) (_model *PrestissimoEngineDetails, err error) { + _model = &PrestissimoEngineDetails{ + Coordinator: coordinator, + SizeConfig: core.StringPtr(sizeConfig), + Worker: worker, } - err = core.UnmarshalPrimitive(m, "bucket_name", &obj.BucketName) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "bucket_name-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalPrimitive(m, "bucket_type", &obj.BucketType) + return +} + +// UnmarshalPrestissimoEngineDetails unmarshals an instance of PrestissimoEngineDetails from the specified map of raw messages. +func UnmarshalPrestissimoEngineDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestissimoEngineDetails) + err = core.UnmarshalModel(m, "coordinator", &obj.Coordinator, UnmarshalNodeDescription) if err != nil { - err = core.SDKErrorf(err, "", "bucket_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + err = core.UnmarshalPrimitive(m, "size_config", &obj.SizeConfig) if err != nil { - err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "size_config-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + err = core.UnmarshalModel(m, "worker", &obj.Worker, UnmarshalNodeDescription) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PrestissimoEnginePatch : Update prestissimo engine body. +type PrestissimoEnginePatch struct { + // Modified description. + Description *string `json:"description,omitempty"` + + // Engine display name. + DisplayName *string `json:"display_name,omitempty"` + + // Engine properties. + Properties *PrestissimoEngineProperties `json:"properties,omitempty"` + + // RemoveEngine properties. + RemoveEngineProperties *RemovePrestissimoEngineProperties `json:"remove_engine_properties,omitempty"` + + // engine will restart accordingily. + RestartType *string `json:"restart_type,omitempty"` + + // Tags. + Tags []string `json:"tags,omitempty"` +} + +// UnmarshalPrestissimoEnginePatch unmarshals an instance of PrestissimoEnginePatch from the specified map of raw messages. +func UnmarshalPrestissimoEnginePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestissimoEnginePatch) err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) if err != nil { - err = core.SDKErrorf(err, "", "endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "grpc_host", &obj.GrpcHost) + err = core.UnmarshalModel(m, "properties", &obj.Properties, UnmarshalPrestissimoEngineProperties) if err != nil { - err = core.SDKErrorf(err, "", "grpc_host-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "properties-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "grpc_port", &obj.GrpcPort) + err = core.UnmarshalModel(m, "remove_engine_properties", &obj.RemoveEngineProperties, UnmarshalRemovePrestissimoEngineProperties) if err != nil { - err = core.SDKErrorf(err, "", "grpc_port-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "remove_engine_properties-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "host_name", &obj.HostName) + err = core.UnmarshalPrimitive(m, "restart_type", &obj.RestartType) if err != nil { - err = core.SDKErrorf(err, "", "host_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "restart_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "https_host", &obj.HttpsHost) + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { - err = core.SDKErrorf(err, "", "https_host-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "https_port", &obj.HttpsPort) - if err != nil { - err = core.SDKErrorf(err, "", "https_port-error", common.GetComponentInfo()) - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the PrestissimoEnginePatch +func (prestissimoEnginePatch *PrestissimoEnginePatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(prestissimoEnginePatch.Description) { + _patch["description"] = prestissimoEnginePatch.Description } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) - if err != nil { - err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) - return + if !core.IsNil(prestissimoEnginePatch.DisplayName) { + _patch["display_name"] = prestissimoEnginePatch.DisplayName } - err = core.UnmarshalPrimitive(m, "root_path", &obj.RootPath) - if err != nil { - err = core.SDKErrorf(err, "", "root_path-error", common.GetComponentInfo()) - return + if !core.IsNil(prestissimoEnginePatch.Properties) { + _patch["properties"] = prestissimoEnginePatch.Properties.asPatch() + } + if !core.IsNil(prestissimoEnginePatch.RemoveEngineProperties) { + _patch["remove_engine_properties"] = prestissimoEnginePatch.RemoveEngineProperties.asPatch() + } + if !core.IsNil(prestissimoEnginePatch.RestartType) { + _patch["restart_type"] = prestissimoEnginePatch.RestartType } - err = core.UnmarshalPrimitive(m, "secret_key", &obj.SecretKey) - if err != nil { - err = core.SDKErrorf(err, "", "secret_key-error", common.GetComponentInfo()) - return + if !core.IsNil(prestissimoEnginePatch.Tags) { + _patch["tags"] = prestissimoEnginePatch.Tags } - err = core.UnmarshalPrimitive(m, "service_display_name", &obj.ServiceDisplayName) + + return +} + +// PrestissimoEngineProperties : Engine properties. +type PrestissimoEngineProperties struct { + // Catalog Properties for Prestissimo. + Catalog map[string]PrestissimoEnginePropertiesCatalogAdditionalProperties `json:"catalog,omitempty"` + + // Engine Properties for Prestissimo. + Configuration *PrestissimoEnginePropertiesConfiguration `json:"configuration,omitempty"` + + // Global engine properties. + Global map[string]string `json:"global,omitempty"` + + // JVM Properties for Prestissimo. + Jvm *PrestissimoEnginePropertiesJvm `json:"jvm,omitempty"` + + // LogConfig Properties for Prestissimo. + LogConfig *PrestissimoEnginePropertiesLogConfig `json:"log_config,omitempty"` + + // Optimizer engine properties. + OptimizerProperties map[string]string `json:"optimizer_properties,omitempty"` + + // Velox Properties. + Velox map[string]string `json:"velox,omitempty"` +} + +// UnmarshalPrestissimoEngineProperties unmarshals an instance of PrestissimoEngineProperties from the specified map of raw messages. +func UnmarshalPrestissimoEngineProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestissimoEngineProperties) + err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalPrestissimoEnginePropertiesCatalogAdditionalProperties) if err != nil { - err = core.SDKErrorf(err, "", "service_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "service_id", &obj.ServiceID) + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalPrestissimoEnginePropertiesConfiguration) if err != nil { - err = core.SDKErrorf(err, "", "service_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "global", &obj.Global) if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "global-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) + err = core.UnmarshalModel(m, "jvm", &obj.Jvm, UnmarshalPrestissimoEnginePropertiesJvm) if err != nil { - err = core.SDKErrorf(err, "", "status_code-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "jvm-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalModel(m, "log_config", &obj.LogConfig, UnmarshalPrestissimoEnginePropertiesLogConfig) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "log_config-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tshirt_size", &obj.TshirtSize) + err = core.UnmarshalPrimitive(m, "optimizer_properties", &obj.OptimizerProperties) if err != nil { - err = core.SDKErrorf(err, "", "tshirt_size-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "optimizer_properties-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "velox", &obj.Velox) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "velox-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// MilvusServiceBucketPatch : UpdateService body. -type MilvusServiceBucketPatch struct { - // bucket name. - BucketName *string `json:"bucket_name,omitempty"` +// asPatch returns a generic map representation of the PrestissimoEngineProperties +func (prestissimoEngineProperties *PrestissimoEngineProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(prestissimoEngineProperties.Catalog) { + catalogPatchMap := map[string]map[string]interface{}{} + for k, v := range prestissimoEngineProperties.Catalog { + catalogPatchMap[k] = v.asPatch() + } + _patch["catalog"] = catalogPatchMap + } + if !core.IsNil(prestissimoEngineProperties.Configuration) { + _patch["configuration"] = prestissimoEngineProperties.Configuration.asPatch() + } + if !core.IsNil(prestissimoEngineProperties.Global) { + _patch["global"] = prestissimoEngineProperties.Global + } + if !core.IsNil(prestissimoEngineProperties.Jvm) { + _patch["jvm"] = prestissimoEngineProperties.Jvm.asPatch() + } + if !core.IsNil(prestissimoEngineProperties.LogConfig) { + _patch["log_config"] = prestissimoEngineProperties.LogConfig.asPatch() + } + if !core.IsNil(prestissimoEngineProperties.OptimizerProperties) { + _patch["optimizer_properties"] = prestissimoEngineProperties.OptimizerProperties + } + if !core.IsNil(prestissimoEngineProperties.Velox) { + _patch["velox"] = prestissimoEngineProperties.Velox + } - // How is the Milvus instance managed. - ManagedBy *string `json:"managed_by,omitempty"` + return +} - // root path. - RootPath *string `json:"root_path,omitempty"` +// PrestissimoEnginePropertiesCatalogAdditionalProperties : PrestissimoEnginePropertiesCatalogAdditionalProperties struct +type PrestissimoEnginePropertiesCatalogAdditionalProperties struct { + // Coordinator Properties for Prestissimo. + Coordinator map[string]interface{} `json:"coordinator,omitempty"` - // tshirt size. - TshirtSize *string `json:"tshirt_size,omitempty"` + // Worker Properties for Prestissimo. + Worker map[string]interface{} `json:"worker,omitempty"` } -// UnmarshalMilvusServiceBucketPatch unmarshals an instance of MilvusServiceBucketPatch from the specified map of raw messages. -func UnmarshalMilvusServiceBucketPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(MilvusServiceBucketPatch) - err = core.UnmarshalPrimitive(m, "bucket_name", &obj.BucketName) - if err != nil { - err = core.SDKErrorf(err, "", "bucket_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) - if err != nil { - err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "root_path", &obj.RootPath) +// UnmarshalPrestissimoEnginePropertiesCatalogAdditionalProperties unmarshals an instance of PrestissimoEnginePropertiesCatalogAdditionalProperties from the specified map of raw messages. +func UnmarshalPrestissimoEnginePropertiesCatalogAdditionalProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestissimoEnginePropertiesCatalogAdditionalProperties) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "root_path-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tshirt_size", &obj.TshirtSize) + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) if err != nil { - err = core.SDKErrorf(err, "", "tshirt_size-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the MilvusServiceBucketPatch -func (milvusServiceBucketPatch *MilvusServiceBucketPatch) AsPatch() (_patch map[string]interface{}, err error) { +// asPatch returns a generic map representation of the PrestissimoEnginePropertiesCatalogAdditionalProperties +func (prestissimoEnginePropertiesCatalogAdditionalProperties *PrestissimoEnginePropertiesCatalogAdditionalProperties) asPatch() (_patch map[string]interface{}) { _patch = map[string]interface{}{} - if !core.IsNil(milvusServiceBucketPatch.BucketName) { - _patch["bucket_name"] = milvusServiceBucketPatch.BucketName + if !core.IsNil(prestissimoEnginePropertiesCatalogAdditionalProperties.Coordinator) { + _patch["coordinator"] = prestissimoEnginePropertiesCatalogAdditionalProperties.Coordinator } - if !core.IsNil(milvusServiceBucketPatch.ManagedBy) { - _patch["managed_by"] = milvusServiceBucketPatch.ManagedBy - } - if !core.IsNil(milvusServiceBucketPatch.RootPath) { - _patch["root_path"] = milvusServiceBucketPatch.RootPath - } - if !core.IsNil(milvusServiceBucketPatch.TshirtSize) { - _patch["tshirt_size"] = milvusServiceBucketPatch.TshirtSize + if !core.IsNil(prestissimoEnginePropertiesCatalogAdditionalProperties.Worker) { + _patch["worker"] = prestissimoEnginePropertiesCatalogAdditionalProperties.Worker } return } -// MilvusServiceCollection : List milvus services. -type MilvusServiceCollection struct { - // milvus service body. - MilvusServices []MilvusService `json:"milvus_services,omitempty"` +// PrestissimoEnginePropertiesConfiguration : Engine Properties for Prestissimo. +type PrestissimoEnginePropertiesConfiguration struct { + // Configuration Coordinator Properties of Prestissimo. + Coordinator map[string]string `json:"coordinator,omitempty"` + + // Configuration Worker Properties of Prestissimo. + Worker map[string]string `json:"worker,omitempty"` } -// UnmarshalMilvusServiceCollection unmarshals an instance of MilvusServiceCollection from the specified map of raw messages. -func UnmarshalMilvusServiceCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(MilvusServiceCollection) - err = core.UnmarshalModel(m, "milvus_services", &obj.MilvusServices, UnmarshalMilvusService) +// UnmarshalPrestissimoEnginePropertiesConfiguration unmarshals an instance of PrestissimoEnginePropertiesConfiguration from the specified map of raw messages. +func UnmarshalPrestissimoEnginePropertiesConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestissimoEnginePropertiesConfiguration) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "milvus_services-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// MilvusServiceDatabases : List milvus databases. -type MilvusServiceDatabases struct { - // milvus database body. - Databases []string `json:"databases,omitempty"` -} - -// UnmarshalMilvusServiceDatabases unmarshals an instance of MilvusServiceDatabases from the specified map of raw messages. -func UnmarshalMilvusServiceDatabases(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(MilvusServiceDatabases) - err = core.UnmarshalPrimitive(m, "databases", &obj.Databases) + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) if err != nil { - err = core.SDKErrorf(err, "", "databases-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// MilvusServicePatch : UpdateService body. -type MilvusServicePatch struct { - // Modified description. - Description *string `json:"description,omitempty"` +// asPatch returns a generic map representation of the PrestissimoEnginePropertiesConfiguration +func (prestissimoEnginePropertiesConfiguration *PrestissimoEnginePropertiesConfiguration) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(prestissimoEnginePropertiesConfiguration.Coordinator) { + _patch["coordinator"] = prestissimoEnginePropertiesConfiguration.Coordinator + } + if !core.IsNil(prestissimoEnginePropertiesConfiguration.Worker) { + _patch["worker"] = prestissimoEnginePropertiesConfiguration.Worker + } - // Service display name. - ServiceDisplayName *string `json:"service_display_name,omitempty"` + return +} - // Tags. - Tags []string `json:"tags,omitempty"` +// PrestissimoEnginePropertiesJvm : JVM Properties for Prestissimo. +type PrestissimoEnginePropertiesJvm struct { + // JVM coordinator Properties of Prestissimo. + Coordinator map[string]string `json:"coordinator,omitempty"` } -// UnmarshalMilvusServicePatch unmarshals an instance of MilvusServicePatch from the specified map of raw messages. -func UnmarshalMilvusServicePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(MilvusServicePatch) - err = core.UnmarshalPrimitive(m, "description", &obj.Description) - if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "service_display_name", &obj.ServiceDisplayName) - if err != nil { - err = core.SDKErrorf(err, "", "service_display_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) +// UnmarshalPrestissimoEnginePropertiesJvm unmarshals an instance of PrestissimoEnginePropertiesJvm from the specified map of raw messages. +func UnmarshalPrestissimoEnginePropertiesJvm(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestissimoEnginePropertiesJvm) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the MilvusServicePatch -func (milvusServicePatch *MilvusServicePatch) AsPatch() (_patch map[string]interface{}, err error) { +// asPatch returns a generic map representation of the PrestissimoEnginePropertiesJvm +func (prestissimoEnginePropertiesJvm *PrestissimoEnginePropertiesJvm) asPatch() (_patch map[string]interface{}) { _patch = map[string]interface{}{} - if !core.IsNil(milvusServicePatch.Description) { - _patch["description"] = milvusServicePatch.Description - } - if !core.IsNil(milvusServicePatch.ServiceDisplayName) { - _patch["service_display_name"] = milvusServicePatch.ServiceDisplayName - } - if !core.IsNil(milvusServicePatch.Tags) { - _patch["tags"] = milvusServicePatch.Tags + if !core.IsNil(prestissimoEnginePropertiesJvm.Coordinator) { + _patch["coordinator"] = prestissimoEnginePropertiesJvm.Coordinator } return } -// Milvusdbcollection : milvus service details. -type Milvusdbcollection struct { - // milvus collection id. - CollectionID *int64 `json:"collection_id,omitempty"` - - // milvus status. - CollectionName *string `json:"collection_name,omitempty"` - - // milvus physical channels. - PhysicalChannels []string `json:"physical_channels,omitempty"` +// PrestissimoEnginePropertiesLogConfig : LogConfig Properties for Prestissimo. +type PrestissimoEnginePropertiesLogConfig struct { + // LogConfig coordinator Properties of Prestissimo. + Coordinator map[string]string `json:"coordinator,omitempty"` - // milvus virtual channels. - VirtualChannels []string `json:"virtual_channels,omitempty"` + // LogConfig worker Properties of Prestissimo. + Worker map[string]string `json:"worker,omitempty"` } -// UnmarshalMilvusdbcollection unmarshals an instance of Milvusdbcollection from the specified map of raw messages. -func UnmarshalMilvusdbcollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Milvusdbcollection) - err = core.UnmarshalPrimitive(m, "collection_id", &obj.CollectionID) +// UnmarshalPrestissimoEnginePropertiesLogConfig unmarshals an instance of PrestissimoEnginePropertiesLogConfig from the specified map of raw messages. +func UnmarshalPrestissimoEnginePropertiesLogConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestissimoEnginePropertiesLogConfig) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "collection_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "collection_name", &obj.CollectionName) + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) if err != nil { - err = core.SDKErrorf(err, "", "collection_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "physical_channels", &obj.PhysicalChannels) - if err != nil { - err = core.SDKErrorf(err, "", "physical_channels-error", common.GetComponentInfo()) - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the PrestissimoEnginePropertiesLogConfig +func (prestissimoEnginePropertiesLogConfig *PrestissimoEnginePropertiesLogConfig) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(prestissimoEnginePropertiesLogConfig.Coordinator) { + _patch["coordinator"] = prestissimoEnginePropertiesLogConfig.Coordinator } - err = core.UnmarshalPrimitive(m, "virtual_channels", &obj.VirtualChannels) - if err != nil { - err = core.SDKErrorf(err, "", "virtual_channels-error", common.GetComponentInfo()) - return + if !core.IsNil(prestissimoEnginePropertiesLogConfig.Worker) { + _patch["worker"] = prestissimoEnginePropertiesLogConfig.Worker } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// NetezzaEngine : Netezza engine details. -type NetezzaEngine struct { +// PrestoEngine : Presto engine details. +type PrestoEngine struct { // Actions. - Actions []string `json:"actions,omitempty"` + Actions []string `json:"actions" validate:"required"` + + // Catalogs associated to the presto engine. + AssociatedCatalogs []string `json:"associated_catalogs" validate:"required"` // watsonx.data build version. BuildVersion *string `json:"build_version,omitempty"` - // Created user name. - CreatedBy *string `json:"created_by,omitempty"` + // Engine configuration details. + Configuration *EngineDetails `json:"configuration,omitempty"` + + // Presto engine configurations. + Coordinator *NodeDescription `json:"coordinator,omitempty"` // Created time in epoch format. - CreatedOn *int64 `json:"created_on,omitempty"` + CreatedAt *int64 `json:"created_at,omitempty"` + + // Username of the user who created the watsonx.data instance. + CreatedBy *string `json:"created_by,omitempty"` // Engine description. Description *string `json:"description,omitempty"` - // External engine details. - EngineDetails *NetezzaEngineDetails `json:"engine_details,omitempty"` - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` + DisplayName *string `json:"display_name,omitempty"` - // Engine programmatic name. - EngineID *string `json:"engine_id,omitempty"` + // Driver details. + Drivers []Driver `json:"drivers" validate:"required"` + + // Engine properties. + Properties *EngineProperties `json:"properties,omitempty"` + + // The engine properties to be removed which was added through api customisation. + RemoveEngineProperties *RemoveEngineProperties `json:"remove_engine_properties,omitempty"` + + // The type of engine restart . The value can be set to forcefully restart an engine. + RestartType *string `json:"restart_type,omitempty"` + + // Applicable only for OCP based clusters. This is typically servicename+route. + ExternalHostName *string `json:"external_host_name" validate:"required"` + + // Failure message. + FailureMessage *string `json:"failure_message,omitempty"` + + // Group ID. + GroupID *string `json:"group_id,omitempty"` // Engine host name. In case of OCP based clusters, this is internal hostname. HostName *string `json:"host_name,omitempty"` - // Origin - place holder. - Origin *string `json:"origin,omitempty"` + // The unigue identifier for the engine. + ID *string `json:"id,omitempty"` + + // Is QHMM engine. + IsQhmmEngine *bool `json:"is_qhmm_engine,omitempty"` + + // Origin. + Origin *string `json:"origin" validate:"required"` // Engine port. Port *int64 `json:"port,omitempty"` + // Query status. + QueryStatus *string `json:"query_status,omitempty"` + + // Resource group details. + ResourceGroups []ResourceGroupForEngine `json:"resource_groups" validate:"required"` + + // CPD supported sizes are: custom, starter, small, medium, large, xlarge, and xxlarge. IBM cloud supported sizes are: + // custom, starter, small, medium, large, cache_optimized, compute_optimized and lite. + SizeConfig *string `json:"size_config,omitempty"` + // Engine status. - Status *string `json:"status,omitempty"` + Status *string `json:"status" validate:"required"` + + // Engine status code. + StatusCode *int64 `json:"status_code" validate:"required"` // Tags. - Tags []string `json:"tags,omitempty"` + Tags []string `json:"tags" validate:"required"` - // Engine type. + // Engine type presto. Type *string `json:"type,omitempty"` + + // Version of the engine. + Version *string `json:"version,omitempty"` + + // Presto engine configurations. + Worker *NodeDescription `json:"worker,omitempty"` + + // Enable autoscaling for the engine. + AutoscalingEnabled *bool `json:"autoscaling_enabled,omitempty"` + + // Autoscaling configuration for the engine. + AutoscalingConfig *AutoscalingConfig `json:"autoscaling_config,omitempty"` } -// UnmarshalNetezzaEngine unmarshals an instance of NetezzaEngine from the specified map of raw messages. -func UnmarshalNetezzaEngine(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetezzaEngine) +// Constants associated with the PrestoEngine.Origin property. +// Origin. +const ( + PrestoEngine_Origin_Discover = "discover" + PrestoEngine_Origin_External = "external" + PrestoEngine_Origin_Native = "native" +) + +// Constants associated with the PrestoEngine.Status property. +// Engine status. +const ( + PrestoEngine_Status_Pending = "pending" + PrestoEngine_Status_Running = "running" + PrestoEngine_Status_Stopped = "stopped" +) + +// UnmarshalPrestoEngine unmarshals an instance of PrestoEngine from the specified map of raw messages. +func UnmarshalPrestoEngine(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestoEngine) err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) if err != nil { - err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "associated_catalogs", &obj.AssociatedCatalogs) + if err != nil { + err = core.SDKErrorf(err, "", "associated_catalogs-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "build_version", &obj.BuildVersion) + if err != nil { + err = core.SDKErrorf(err, "", "build_version-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalEngineDetails) + if err != nil { + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "coordinator", &obj.Coordinator, UnmarshalNodeDescription) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "build_version", &obj.BuildVersion) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { - err = core.SDKErrorf(err, "", "build_version-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) if err != nil { - err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + err = core.UnmarshalModel(m, "drivers", &obj.Drivers, UnmarshalDriver) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "drivers-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalModel(m, "properties", &obj.Properties, UnmarshalEngineProperties) if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "properties-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "remove_engine_properties", &obj.RemoveEngineProperties, UnmarshalRemoveEngineProperties) + if err != nil { + err = core.SDKErrorf(err, "", "remove_engine_properties-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "engine_details", &obj.EngineDetails, UnmarshalNetezzaEngineDetails) + err = core.UnmarshalPrimitive(m, "restart_type", &obj.RestartType) if err != nil { - err = core.SDKErrorf(err, "", "engine_details-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "restart_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_display_name", &obj.EngineDisplayName) + err = core.UnmarshalPrimitive(m, "external_host_name", &obj.ExternalHostName) if err != nil { - err = core.SDKErrorf(err, "", "engine_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "external_host_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) + err = core.UnmarshalPrimitive(m, "failure_message", &obj.FailureMessage) if err != nil { - err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "failure_message-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "group_id", &obj.GroupID) + if err != nil { + err = core.SDKErrorf(err, "", "group_id-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "host_name", &obj.HostName) @@ -22161,6 +27146,16 @@ func UnmarshalNetezzaEngine(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "host_name-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "is_qhmm_engine", &obj.IsQhmmEngine) + if err != nil { + err = core.SDKErrorf(err, "", "is_qhmm_engine-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) if err != nil { err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) @@ -22171,11 +27166,31 @@ func UnmarshalNetezzaEngine(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "query_status", &obj.QueryStatus) + if err != nil { + err = core.SDKErrorf(err, "", "query_status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "resource_groups", &obj.ResourceGroups, UnmarshalResourceGroupForEngine) + if err != nil { + err = core.SDKErrorf(err, "", "resource_groups-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "size_config", &obj.SizeConfig) + if err != nil { + err = core.SDKErrorf(err, "", "size_config-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) + if err != nil { + err = core.SDKErrorf(err, "", "status_code-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) @@ -22186,817 +27201,1045 @@ func UnmarshalNetezzaEngine(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetezzaEngineCollection : list Netezza engines. -type NetezzaEngineCollection struct { - // list Netezza engines. - NetezzaEngines []NetezzaEngine `json:"netezza_engines,omitempty"` -} - -// UnmarshalNetezzaEngineCollection unmarshals an instance of NetezzaEngineCollection from the specified map of raw messages. -func UnmarshalNetezzaEngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetezzaEngineCollection) - err = core.UnmarshalModel(m, "netezza_engines", &obj.NetezzaEngines, UnmarshalNetezzaEngine) + err = core.UnmarshalPrimitive(m, "version", &obj.Version) if err != nil { - err = core.SDKErrorf(err, "", "netezza_engines-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// NetezzaEngineDetails : External engine details. -type NetezzaEngineDetails struct { - // External engine connection string. - ConnectionString *string `json:"connection_string,omitempty"` - - // Metastore host. - MetastoreHost *string `json:"metastore_host,omitempty"` -} - -// UnmarshalNetezzaEngineDetails unmarshals an instance of NetezzaEngineDetails from the specified map of raw messages. -func UnmarshalNetezzaEngineDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetezzaEngineDetails) - err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) + err = core.UnmarshalModel(m, "worker", &obj.Worker, UnmarshalNodeDescription) if err != nil { - err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "metastore_host", &obj.MetastoreHost) + err = core.UnmarshalPrimitive(m, "autoscaling_enabled", &obj.AutoscalingEnabled) if err != nil { - err = core.SDKErrorf(err, "", "metastore_host-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "autoscaling_enabled-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "autoscaling_config", &obj.AutoscalingConfig, UnmarshalAutoscalingConfig) + if err != nil { + err = core.SDKErrorf(err, "", "autoscaling_config-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// NetezzaEngineDetailsBody : External engine details. -type NetezzaEngineDetailsBody struct { - // External engine connection string. - ConnectionString *string `json:"connection_string,omitempty"` +// PrestoEngineCollection : Collection of Presto engines. +type PrestoEngineCollection struct { + // List of Presto engines. + PrestoEngines []PrestoEngine `json:"presto_engines" validate:"required"` } -// UnmarshalNetezzaEngineDetailsBody unmarshals an instance of NetezzaEngineDetailsBody from the specified map of raw messages. -func UnmarshalNetezzaEngineDetailsBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetezzaEngineDetailsBody) - err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) +// UnmarshalPrestoEngineCollection unmarshals an instance of PrestoEngineCollection from the specified map of raw messages. +func UnmarshalPrestoEngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestoEngineCollection) + err = core.UnmarshalModel(m, "presto_engines", &obj.PrestoEngines, UnmarshalPrestoEngine) if err != nil { - err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "presto_engines-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// NetezzaEnginePatch : UpdateEngine body. -type NetezzaEnginePatch struct { +// PrestoEnginePatch : The request payload to update presto engine. +type PrestoEnginePatch struct { // Modified description. Description *string `json:"description,omitempty"` // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` + DisplayName *string `json:"display_name,omitempty"` + + // Engine properties. + Properties *EngineProperties `json:"properties,omitempty"` + + // The engine properties to be removed which was added through api customisation. + RemoveEngineProperties *RemoveEngineProperties `json:"remove_engine_properties,omitempty"` + + // The type of engine restart . The value can be set to forcefully restart an engine. + RestartType *string `json:"restart_type,omitempty"` // Tags. Tags []string `json:"tags,omitempty"` } -// UnmarshalNetezzaEnginePatch unmarshals an instance of NetezzaEnginePatch from the specified map of raw messages. -func UnmarshalNetezzaEnginePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NetezzaEnginePatch) +// UnmarshalPrestoEnginePatch unmarshals an instance of PrestoEnginePatch from the specified map of raw messages. +func UnmarshalPrestoEnginePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestoEnginePatch) err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_display_name", &obj.EngineDisplayName) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) if err != nil { - err = core.SDKErrorf(err, "", "engine_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalModel(m, "properties", &obj.Properties, UnmarshalEngineProperties) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "properties-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the NetezzaEnginePatch -func (netezzaEnginePatch *NetezzaEnginePatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(netezzaEnginePatch.Description) { - _patch["description"] = netezzaEnginePatch.Description - } - if !core.IsNil(netezzaEnginePatch.EngineDisplayName) { - _patch["engine_display_name"] = netezzaEnginePatch.EngineDisplayName - } - if !core.IsNil(netezzaEnginePatch.Tags) { - _patch["tags"] = netezzaEnginePatch.Tags + err = core.UnmarshalModel(m, "remove_engine_properties", &obj.RemoveEngineProperties, UnmarshalRemoveEngineProperties) + if err != nil { + err = core.SDKErrorf(err, "", "remove_engine_properties-error", common.GetComponentInfo()) + return } - - return -} - -// NodeDescription : NodeDescription. -type NodeDescription struct { - // Node type. - NodeType *string `json:"node_type,omitempty"` - - // Quantity. - Quantity *int64 `json:"quantity,omitempty"` -} - -// UnmarshalNodeDescription unmarshals an instance of NodeDescription from the specified map of raw messages. -func UnmarshalNodeDescription(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NodeDescription) - err = core.UnmarshalPrimitive(m, "node_type", &obj.NodeType) + err = core.UnmarshalPrimitive(m, "restart_type", &obj.RestartType) if err != nil { - err = core.SDKErrorf(err, "", "node_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "restart_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "quantity", &obj.Quantity) + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { - err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// NodeDescriptionBody : coordinator/worker property settings. -type NodeDescriptionBody struct { - // Node Type, r5, m, i.. - NodeType *string `json:"node_type,omitempty"` - - // Number of nodes. - Quantity *int64 `json:"quantity,omitempty"` -} - -// UnmarshalNodeDescriptionBody unmarshals an instance of NodeDescriptionBody from the specified map of raw messages. -func UnmarshalNodeDescriptionBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(NodeDescriptionBody) - err = core.UnmarshalPrimitive(m, "node_type", &obj.NodeType) - if err != nil { - err = core.SDKErrorf(err, "", "node_type-error", common.GetComponentInfo()) - return +// AsPatch returns a generic map representation of the PrestoEnginePatch +func (prestoEnginePatch *PrestoEnginePatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(prestoEnginePatch.Description) { + _patch["description"] = prestoEnginePatch.Description } - err = core.UnmarshalPrimitive(m, "quantity", &obj.Quantity) - if err != nil { - err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) - return + if !core.IsNil(prestoEnginePatch.DisplayName) { + _patch["display_name"] = prestoEnginePatch.DisplayName } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + if !core.IsNil(prestoEnginePatch.Properties) { + _patch["properties"] = prestoEnginePatch.Properties.asPatch() + } + if !core.IsNil(prestoEnginePatch.RemoveEngineProperties) { + _patch["remove_engine_properties"] = prestoEnginePatch.RemoveEngineProperties.asPatch() + } + if !core.IsNil(prestoEnginePatch.RestartType) { + _patch["restart_type"] = prestoEnginePatch.RestartType + } + if !core.IsNil(prestoEnginePatch.Tags) { + _patch["tags"] = prestoEnginePatch.Tags + } + return } -// OtherEngine : external engine details. -type OtherEngine struct { - // Actions. - Actions []string `json:"actions,omitempty"` - - // created user name. - CreatedBy *string `json:"created_by,omitempty"` - - // created time in epoch format. - CreatedOn *int64 `json:"created_on,omitempty"` - - // engine description. - Description *string `json:"description,omitempty"` - - // External engine details. - EngineDetails *OtherEngineDetails `json:"engine_details,omitempty"` - - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` - - // engine programmatic name. - EngineID *string `json:"engine_id,omitempty"` +// PrestoEngineProperties : Complete Presto engine configuration properties. +type PrestoEngineProperties struct { + // Catalog configurations mapped by catalog name. + Catalog map[string]CatalogProperties `json:"catalog,omitempty"` - // Engine host name. In case of OCP based clusters, this is internal hostname. - HostName *string `json:"host_name,omitempty"` + // General configuration properties. + Configuration *ConfigurationProperties `json:"configuration,omitempty"` - // origin. - Origin *string `json:"origin,omitempty"` + // Event listener configuration properties. + EventListener map[string]string `json:"event_listener,omitempty"` - // Engine port. - Port *int64 `json:"port,omitempty"` + // Global configuration properties. + Global map[string]string `json:"global,omitempty"` - // engine status. - Status *string `json:"status,omitempty"` + // JMX exporter configuration properties. + JmxExporterConfig map[string]string `json:"jmx_exporter_config,omitempty"` - // Tags. - Tags []string `json:"tags,omitempty"` + // JVM configuration properties. + Jvm *JvmProperties `json:"jvm,omitempty"` - // Type like presto, netezza, external,.. - Type *string `json:"type,omitempty"` + // Logging configuration properties. + LogConfig *LogConfigProperties `json:"log_config,omitempty"` } -// UnmarshalOtherEngine unmarshals an instance of OtherEngine from the specified map of raw messages. -func UnmarshalOtherEngine(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OtherEngine) - err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) - if err != nil { - err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) - if err != nil { - err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) +// UnmarshalPrestoEngineProperties unmarshals an instance of PrestoEngineProperties from the specified map of raw messages. +func UnmarshalPrestoEngineProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestoEngineProperties) + err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalCatalogProperties) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) - if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "engine_details", &obj.EngineDetails, UnmarshalOtherEngineDetails) - if err != nil { - err = core.SDKErrorf(err, "", "engine_details-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "engine_display_name", &obj.EngineDisplayName) - if err != nil { - err = core.SDKErrorf(err, "", "engine_display_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) - if err != nil { - err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "host_name", &obj.HostName) + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalConfigurationProperties) if err != nil { - err = core.SDKErrorf(err, "", "host_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + err = core.UnmarshalPrimitive(m, "event_listener", &obj.EventListener) if err != nil { - err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "event_listener-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) + err = core.UnmarshalPrimitive(m, "global", &obj.Global) if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "global-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "jmx_exporter_config", &obj.JmxExporterConfig) if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "jmx_exporter_config-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalModel(m, "jvm", &obj.Jvm, UnmarshalJvmProperties) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "jvm-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalModel(m, "log_config", &obj.LogConfig, UnmarshalLogConfigProperties) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "log_config-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// OtherEngineCollection : list other engines. -type OtherEngineCollection struct { - // list other engines. - OtherEngines []OtherEngine `json:"other_engines,omitempty"` +// asPatch returns a generic map representation of the PrestoEngineProperties +func (prestoEngineProperties *PrestoEngineProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(prestoEngineProperties.Catalog) { + catalogPatchMap := map[string]map[string]interface{}{} + for k, v := range prestoEngineProperties.Catalog { + catalogPatchMap[k] = v.asPatch() + } + _patch["catalog"] = catalogPatchMap + } + if !core.IsNil(prestoEngineProperties.Configuration) { + _patch["configuration"] = prestoEngineProperties.Configuration.asPatch() + } + if !core.IsNil(prestoEngineProperties.EventListener) { + _patch["event_listener"] = prestoEngineProperties.EventListener + } + if !core.IsNil(prestoEngineProperties.Global) { + _patch["global"] = prestoEngineProperties.Global + } + if !core.IsNil(prestoEngineProperties.JmxExporterConfig) { + _patch["jmx_exporter_config"] = prestoEngineProperties.JmxExporterConfig + } + if !core.IsNil(prestoEngineProperties.Jvm) { + _patch["jvm"] = prestoEngineProperties.Jvm.asPatch() + } + if !core.IsNil(prestoEngineProperties.LogConfig) { + _patch["log_config"] = prestoEngineProperties.LogConfig.asPatch() + } + + return } -// UnmarshalOtherEngineCollection unmarshals an instance of OtherEngineCollection from the specified map of raw messages. -func UnmarshalOtherEngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OtherEngineCollection) - err = core.UnmarshalModel(m, "other_engines", &obj.OtherEngines, UnmarshalOtherEngine) +// PrestoEnginePropertiesDetails : Wrapper object containing Presto engine properties. +type PrestoEnginePropertiesDetails struct { + // Presto engine configuration properties. + EngineProperties *PrestoEngineProperties `json:"engine_properties,omitempty"` +} + +// UnmarshalPrestoEnginePropertiesDetails unmarshals an instance of PrestoEnginePropertiesDetails from the specified map of raw messages. +func UnmarshalPrestoEnginePropertiesDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestoEnginePropertiesDetails) + err = core.UnmarshalModel(m, "engine_properties", &obj.EngineProperties, UnmarshalPrestoEngineProperties) if err != nil { - err = core.SDKErrorf(err, "", "other_engines-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "engine_properties-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// OtherEngineDetails : External engine details. -type OtherEngineDetails struct { - // external engine connection string. - ConnectionString *string `json:"connection_string" validate:"required"` +// AsPatch returns a generic map representation of the PrestoEnginePropertiesDetails +func (prestoEnginePropertiesDetails *PrestoEnginePropertiesDetails) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(prestoEnginePropertiesDetails.EngineProperties) { + _patch["engine_properties"] = prestoEnginePropertiesDetails.EngineProperties.asPatch() + } - // Actual engine type. - EngineType *string `json:"engine_type" validate:"required"` + return +} - // metastore host - not required while registering an engine. - MetastoreHost *string `json:"metastore_host,omitempty"` +// PrestoEngineSuccessResponse : Presto engine success message. +type PrestoEngineSuccessResponse struct { + // Response of success. + Response *SuccessResponse `json:"response,omitempty"` } -// UnmarshalOtherEngineDetails unmarshals an instance of OtherEngineDetails from the specified map of raw messages. -func UnmarshalOtherEngineDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OtherEngineDetails) - err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) +// UnmarshalPrestoEngineSuccessResponse unmarshals an instance of PrestoEngineSuccessResponse from the specified map of raw messages. +func UnmarshalPrestoEngineSuccessResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestoEngineSuccessResponse) + err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) if err != nil { - err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_type", &obj.EngineType) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PrestoQueryExplain : ExplainStatement OK. +type PrestoQueryExplain struct { + // Response of success. + Response *SuccessResponse `json:"response" validate:"required"` + + // Result. + Result *string `json:"result" validate:"required"` +} + +// UnmarshalPrestoQueryExplain unmarshals an instance of PrestoQueryExplain from the specified map of raw messages. +func UnmarshalPrestoQueryExplain(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PrestoQueryExplain) + err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) if err != nil { - err = core.SDKErrorf(err, "", "engine_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "metastore_host", &obj.MetastoreHost) + err = core.UnmarshalPrimitive(m, "result", &obj.Result) if err != nil { - err = core.SDKErrorf(err, "", "metastore_host-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "result-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// OtherEngineDetailsBody : External engine details. -type OtherEngineDetailsBody struct { - // External engine connection string. - ConnectionString *string `json:"connection_string" validate:"required"` - - // Actual engine type. - EngineType *string `json:"engine_type" validate:"required"` +// RangerDetails : Details realted to the available resources for `ranger`. +type RangerDetails struct { + // Lists all available resources for ranger. + Resources []RangerResource `json:"resources" validate:"required"` } -// NewOtherEngineDetailsBody : Instantiate OtherEngineDetailsBody (Generic Model Constructor) -func (*WatsonxDataV2) NewOtherEngineDetailsBody(connectionString string, engineType string) (_model *OtherEngineDetailsBody, err error) { - _model = &OtherEngineDetailsBody{ - ConnectionString: core.StringPtr(connectionString), - EngineType: core.StringPtr(engineType), - } - err = core.ValidateStruct(_model, "required parameters") +// UnmarshalRangerDetails unmarshals an instance of RangerDetails from the specified map of raw messages. +func UnmarshalRangerDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RangerDetails) + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalRangerResource) if err != nil { - err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resources-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// UnmarshalOtherEngineDetailsBody unmarshals an instance of OtherEngineDetailsBody from the specified map of raw messages. -func UnmarshalOtherEngineDetailsBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(OtherEngineDetailsBody) - err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) +// RangerResource : The ranger resource. +type RangerResource struct { + // Currently selected resource for `ranger`. + Name *string `json:"name,omitempty"` + + // The type of the ranger resource. + Type *string `json:"type,omitempty"` +} + +// UnmarshalRangerResource unmarshals an instance of RangerResource from the specified map of raw messages. +func UnmarshalRangerResource(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RangerResource) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_type", &obj.EngineType) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "engine_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// Path : Bucket object size. -type Path struct { - // object path. - Path *string `json:"path,omitempty"` +// RegisterTableCreatedBody : Register table. +type RegisterTableCreatedBody struct { + // Response of success. + Response *SuccessResponse `json:"response,omitempty"` } -// UnmarshalPath unmarshals an instance of Path from the specified map of raw messages. -func UnmarshalPath(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(Path) - err = core.UnmarshalPrimitive(m, "path", &obj.Path) +// UnmarshalRegisterTableCreatedBody unmarshals an instance of RegisterTableCreatedBody from the specified map of raw messages. +func UnmarshalRegisterTableCreatedBody(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegisterTableCreatedBody) + err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) if err != nil { - err = core.SDKErrorf(err, "", "path-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// PausePrestissimoEngineOptions : The PausePrestissimoEngine options. -type PausePrestissimoEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// RegisterTableOptions : The RegisterTable options. +type RegisterTableOptions struct { + // catalog id. + CatalogID *string `json:"catalog_id" validate:"required,ne="` + + // URL encoded schema name. + SchemaID *string `json:"schema_id" validate:"required,ne="` + + // Metadata location. + MetadataLocation *string `json:"metadata_location" validate:"required"` + + // Table name. + TableName *string `json:"table_name" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewPausePrestissimoEngineOptions : Instantiate PausePrestissimoEngineOptions -func (*WatsonxDataV2) NewPausePrestissimoEngineOptions(engineID string) *PausePrestissimoEngineOptions { - return &PausePrestissimoEngineOptions{ - EngineID: core.StringPtr(engineID), +// NewRegisterTableOptions : Instantiate RegisterTableOptions +func (*WatsonxDataV3) NewRegisterTableOptions(catalogID string, schemaID string, metadataLocation string, tableName string) *RegisterTableOptions { + return &RegisterTableOptions{ + CatalogID: core.StringPtr(catalogID), + SchemaID: core.StringPtr(schemaID), + MetadataLocation: core.StringPtr(metadataLocation), + TableName: core.StringPtr(tableName), } } -// SetEngineID : Allow user to set EngineID -func (_options *PausePrestissimoEngineOptions) SetEngineID(engineID string) *PausePrestissimoEngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetCatalogID : Allow user to set CatalogID +func (_options *RegisterTableOptions) SetCatalogID(catalogID string) *RegisterTableOptions { + _options.CatalogID = core.StringPtr(catalogID) return _options } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *PausePrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *PausePrestissimoEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) +// SetSchemaID : Allow user to set SchemaID +func (_options *RegisterTableOptions) SetSchemaID(schemaID string) *RegisterTableOptions { + _options.SchemaID = core.StringPtr(schemaID) return _options } -// SetHeaders : Allow user to set Headers -func (options *PausePrestissimoEngineOptions) SetHeaders(param map[string]string) *PausePrestissimoEngineOptions { - options.Headers = param - return options -} - -// PausePrestoEngineOptions : The PausePrestoEngine options. -type PausePrestoEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewPausePrestoEngineOptions : Instantiate PausePrestoEngineOptions -func (*WatsonxDataV2) NewPausePrestoEngineOptions(engineID string) *PausePrestoEngineOptions { - return &PausePrestoEngineOptions{ - EngineID: core.StringPtr(engineID), - } +// SetMetadataLocation : Allow user to set MetadataLocation +func (_options *RegisterTableOptions) SetMetadataLocation(metadataLocation string) *RegisterTableOptions { + _options.MetadataLocation = core.StringPtr(metadataLocation) + return _options } -// SetEngineID : Allow user to set EngineID -func (_options *PausePrestoEngineOptions) SetEngineID(engineID string) *PausePrestoEngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetTableName : Allow user to set TableName +func (_options *RegisterTableOptions) SetTableName(tableName string) *RegisterTableOptions { + _options.TableName = core.StringPtr(tableName) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *PausePrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *PausePrestoEngineOptions { +func (_options *RegisterTableOptions) SetAuthInstanceID(authInstanceID string) *RegisterTableOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *PausePrestoEngineOptions) SetHeaders(param map[string]string) *PausePrestoEngineOptions { +func (options *RegisterTableOptions) SetHeaders(param map[string]string) *RegisterTableOptions { options.Headers = param return options } -// PauseSparkEngineOptions : The PauseSparkEngine options. -type PauseSparkEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// RemoveEngineProperties : The engine properties to be removed which was added through api customisation. +type RemoveEngineProperties struct { + // Catalog properties with dynamic catalog names. + Catalog map[string]RemoveEnginePropertiesCatalogAdditionalProperties `json:"catalog" validate:"required"` - // force spark engine pause. - Force *bool `json:"force,omitempty"` + // RemoveEngine configuration properties. + Configuration *RemoveEnginePropertiesConfiguration `json:"configuration" validate:"required"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // The event listener engine properties to be removed which was added through api customisation. + EventListener []string `json:"event_listener" validate:"required"` - // Allows users to set headers on API requests. - Headers map[string]string -} + // The global properties to be removed which was added through api customisation. + Global []string `json:"global" validate:"required"` -// NewPauseSparkEngineOptions : Instantiate PauseSparkEngineOptions -func (*WatsonxDataV2) NewPauseSparkEngineOptions(engineID string) *PauseSparkEngineOptions { - return &PauseSparkEngineOptions{ - EngineID: core.StringPtr(engineID), - } -} + // The jm properties to be removed which was added through api customisation. + JmxExporterConfig []string `json:"jmx_exporter_config" validate:"required"` -// SetEngineID : Allow user to set EngineID -func (_options *PauseSparkEngineOptions) SetEngineID(engineID string) *PauseSparkEngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} + // JVM properties. + Jvm *RemoveEnginePropertiesJvm `json:"jvm" validate:"required"` -// SetForce : Allow user to set Force -func (_options *PauseSparkEngineOptions) SetForce(force bool) *PauseSparkEngineOptions { - _options.Force = core.BoolPtr(force) - return _options + // Remove engine log configuration properties. + LogConfig *RemoveEnginePropertiesLogConfig `json:"log_config" validate:"required"` } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *PauseSparkEngineOptions) SetAuthInstanceID(authInstanceID string) *PauseSparkEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options +// NewRemoveEngineProperties : Instantiate RemoveEngineProperties (Generic Model Constructor) +func (*WatsonxDataV3) NewRemoveEngineProperties(catalog map[string]RemoveEnginePropertiesCatalogAdditionalProperties, configuration *RemoveEnginePropertiesConfiguration, eventListener []string, global []string, jmxExporterConfig []string, jvm *RemoveEnginePropertiesJvm, logConfig *RemoveEnginePropertiesLogConfig) (_model *RemoveEngineProperties, err error) { + _model = &RemoveEngineProperties{ + Catalog: catalog, + Configuration: configuration, + EventListener: eventListener, + Global: global, + JmxExporterConfig: jmxExporterConfig, + Jvm: jvm, + LogConfig: logConfig, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return } -// SetHeaders : Allow user to set Headers -func (options *PauseSparkEngineOptions) SetHeaders(param map[string]string) *PauseSparkEngineOptions { - options.Headers = param - return options +// UnmarshalRemoveEngineProperties unmarshals an instance of RemoveEngineProperties from the specified map of raw messages. +func UnmarshalRemoveEngineProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RemoveEngineProperties) + err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalRemoveEnginePropertiesCatalogAdditionalProperties) + if err != nil { + err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalRemoveEnginePropertiesConfiguration) + if err != nil { + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "event_listener", &obj.EventListener) + if err != nil { + err = core.SDKErrorf(err, "", "event_listener-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "global", &obj.Global) + if err != nil { + err = core.SDKErrorf(err, "", "global-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "jmx_exporter_config", &obj.JmxExporterConfig) + if err != nil { + err = core.SDKErrorf(err, "", "jmx_exporter_config-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "jvm", &obj.Jvm, UnmarshalRemoveEnginePropertiesJvm) + if err != nil { + err = core.SDKErrorf(err, "", "jvm-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "log_config", &obj.LogConfig, UnmarshalRemoveEnginePropertiesLogConfig) + if err != nil { + err = core.SDKErrorf(err, "", "log_config-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// PrestissimoEndpoints : Endpoints. -type PrestissimoEndpoints struct { - // Application API. - ApplicationsApi *string `json:"applications_api,omitempty"` - - // History server endpoint. - HistoryServerEndpoint *string `json:"history_server_endpoint,omitempty"` - - // Spark kernel endpoint. - SparkAccessEndpoint *string `json:"spark_access_endpoint,omitempty"` - - // Spark jobs V4 endpoint. - SparkJobsV4Endpoint *string `json:"spark_jobs_v4_endpoint,omitempty"` +// asPatch returns a generic map representation of the RemoveEngineProperties +func (removeEngineProperties *RemoveEngineProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(removeEngineProperties.Catalog) { + catalogPatchMap := map[string]map[string]interface{}{} + for k, v := range removeEngineProperties.Catalog { + catalogPatchMap[k] = v.asPatch() + } + _patch["catalog"] = catalogPatchMap + } + if !core.IsNil(removeEngineProperties.Configuration) { + _patch["configuration"] = removeEngineProperties.Configuration.asPatch() + } + if !core.IsNil(removeEngineProperties.EventListener) { + _patch["event_listener"] = removeEngineProperties.EventListener + } + if !core.IsNil(removeEngineProperties.Global) { + _patch["global"] = removeEngineProperties.Global + } + if !core.IsNil(removeEngineProperties.JmxExporterConfig) { + _patch["jmx_exporter_config"] = removeEngineProperties.JmxExporterConfig + } + if !core.IsNil(removeEngineProperties.Jvm) { + _patch["jvm"] = removeEngineProperties.Jvm.asPatch() + } + if !core.IsNil(removeEngineProperties.LogConfig) { + _patch["log_config"] = removeEngineProperties.LogConfig.asPatch() + } - // Spark kernel endpoint. - SparkKernelEndpoint *string `json:"spark_kernel_endpoint,omitempty"` + return +} - // View history server. - ViewHistoryServer *string `json:"view_history_server,omitempty"` +// RemoveEnginePropertiesCatalogAdditionalProperties : RemoveEnginePropertiesCatalogAdditionalProperties struct +type RemoveEnginePropertiesCatalogAdditionalProperties struct { + // The catalog properties to be removed. + Coordinator []string `json:"coordinator" validate:"required"` - // Wxd application endpoint. - WxdApplicationEndpoint *string `json:"wxd_application_endpoint,omitempty"` + // The catalog properties to be removed. + Worker []string `json:"worker" validate:"required"` } -// UnmarshalPrestissimoEndpoints unmarshals an instance of PrestissimoEndpoints from the specified map of raw messages. -func UnmarshalPrestissimoEndpoints(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestissimoEndpoints) - err = core.UnmarshalPrimitive(m, "applications_api", &obj.ApplicationsApi) - if err != nil { - err = core.SDKErrorf(err, "", "applications_api-error", common.GetComponentInfo()) - return +// NewRemoveEnginePropertiesCatalogAdditionalProperties : Instantiate RemoveEnginePropertiesCatalogAdditionalProperties (Generic Model Constructor) +func (*WatsonxDataV3) NewRemoveEnginePropertiesCatalogAdditionalProperties(coordinator []string, worker []string) (_model *RemoveEnginePropertiesCatalogAdditionalProperties, err error) { + _model = &RemoveEnginePropertiesCatalogAdditionalProperties{ + Coordinator: coordinator, + Worker: worker, } - err = core.UnmarshalPrimitive(m, "history_server_endpoint", &obj.HistoryServerEndpoint) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "history_server_endpoint-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalPrimitive(m, "spark_access_endpoint", &obj.SparkAccessEndpoint) + return +} + +// UnmarshalRemoveEnginePropertiesCatalogAdditionalProperties unmarshals an instance of RemoveEnginePropertiesCatalogAdditionalProperties from the specified map of raw messages. +func UnmarshalRemoveEnginePropertiesCatalogAdditionalProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RemoveEnginePropertiesCatalogAdditionalProperties) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "spark_access_endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "spark_jobs_v4_endpoint", &obj.SparkJobsV4Endpoint) + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) if err != nil { - err = core.SDKErrorf(err, "", "spark_jobs_v4_endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "spark_kernel_endpoint", &obj.SparkKernelEndpoint) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the RemoveEnginePropertiesCatalogAdditionalProperties +func (removeEnginePropertiesCatalogAdditionalProperties *RemoveEnginePropertiesCatalogAdditionalProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(removeEnginePropertiesCatalogAdditionalProperties.Coordinator) { + _patch["coordinator"] = removeEnginePropertiesCatalogAdditionalProperties.Coordinator + } + if !core.IsNil(removeEnginePropertiesCatalogAdditionalProperties.Worker) { + _patch["worker"] = removeEnginePropertiesCatalogAdditionalProperties.Worker + } + + return +} + +// RemoveEnginePropertiesConfiguration : RemoveEngine configuration properties. +type RemoveEnginePropertiesConfiguration struct { + // The configuration properties to be removed. + Coordinator []string `json:"coordinator" validate:"required"` + + // The configuration properties to be removed. + Worker []string `json:"worker" validate:"required"` +} + +// NewRemoveEnginePropertiesConfiguration : Instantiate RemoveEnginePropertiesConfiguration (Generic Model Constructor) +func (*WatsonxDataV3) NewRemoveEnginePropertiesConfiguration(coordinator []string, worker []string) (_model *RemoveEnginePropertiesConfiguration, err error) { + _model = &RemoveEnginePropertiesConfiguration{ + Coordinator: coordinator, + Worker: worker, + } + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "spark_kernel_endpoint-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalPrimitive(m, "view_history_server", &obj.ViewHistoryServer) + return +} + +// UnmarshalRemoveEnginePropertiesConfiguration unmarshals an instance of RemoveEnginePropertiesConfiguration from the specified map of raw messages. +func UnmarshalRemoveEnginePropertiesConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RemoveEnginePropertiesConfiguration) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "view_history_server-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "wxd_application_endpoint", &obj.WxdApplicationEndpoint) + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) if err != nil { - err = core.SDKErrorf(err, "", "wxd_application_endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// PrestissimoEngine : EngineDetail. -type PrestissimoEngine struct { - // Actions. - Actions []string `json:"actions,omitempty"` - - // Associated catalog. - AssociatedCatalogs []string `json:"associated_catalogs,omitempty"` - - // watsonx.data build version. - BuildVersion *string `json:"build_version,omitempty"` - - // coordinator/worker property settings. - Coordinator *PrestissimoNodeDescriptionBody `json:"coordinator,omitempty"` - - // Created user name. - CreatedBy *string `json:"created_by,omitempty"` - - // Created time in epoch format. - CreatedOn *int64 `json:"created_on,omitempty"` +// asPatch returns a generic map representation of the RemoveEnginePropertiesConfiguration +func (removeEnginePropertiesConfiguration *RemoveEnginePropertiesConfiguration) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(removeEnginePropertiesConfiguration.Coordinator) { + _patch["coordinator"] = removeEnginePropertiesConfiguration.Coordinator + } + if !core.IsNil(removeEnginePropertiesConfiguration.Worker) { + _patch["worker"] = removeEnginePropertiesConfiguration.Worker + } - // Engine description. - Description *string `json:"description,omitempty"` + return +} - // External engine details. - EngineDetails *PrestissimoEngineDetails `json:"engine_details,omitempty"` +// RemoveEnginePropertiesJvm : JVM properties. +type RemoveEnginePropertiesJvm struct { + // The JVM properties to be removed. + Coordinator []string `json:"coordinator" validate:"required"` - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` + // The JVM properties to be removed. + Worker []string `json:"worker" validate:"required"` +} - // Engine programmatic name. - EngineID *string `json:"engine_id,omitempty"` +// NewRemoveEnginePropertiesJvm : Instantiate RemoveEnginePropertiesJvm (Generic Model Constructor) +func (*WatsonxDataV3) NewRemoveEnginePropertiesJvm(coordinator []string, worker []string) (_model *RemoveEnginePropertiesJvm, err error) { + _model = &RemoveEnginePropertiesJvm{ + Coordinator: coordinator, + Worker: worker, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} - // Engine properties. - EngineProperties *PrestissimoEngineEngineProperties `json:"engine_properties,omitempty"` +// UnmarshalRemoveEnginePropertiesJvm unmarshals an instance of RemoveEnginePropertiesJvm from the specified map of raw messages. +func UnmarshalRemoveEnginePropertiesJvm(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RemoveEnginePropertiesJvm) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + if err != nil { + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // Triggers engine restart if value is force. - EngineRestart *string `json:"engine_restart,omitempty"` +// asPatch returns a generic map representation of the RemoveEnginePropertiesJvm +func (removeEnginePropertiesJvm *RemoveEnginePropertiesJvm) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(removeEnginePropertiesJvm.Coordinator) { + _patch["coordinator"] = removeEnginePropertiesJvm.Coordinator + } + if !core.IsNil(removeEnginePropertiesJvm.Worker) { + _patch["worker"] = removeEnginePropertiesJvm.Worker + } - // Applicable only for OCP based clusters. This is typically servicename+route. - ExternalHostName *string `json:"external_host_name" validate:"required"` + return +} - // Group ID. - GroupID *string `json:"group_id,omitempty"` +// RemoveEnginePropertiesLogConfig : Remove engine log configuration properties. +type RemoveEnginePropertiesLogConfig struct { + // The LogConfig properties to be removed. + Coordinator []string `json:"coordinator" validate:"required"` - // Engine host name. In case of OCP based clusters, this is internal hostname. - HostName *string `json:"host_name,omitempty"` + // The LogConfig properties to be removed. + Worker []string `json:"worker" validate:"required"` +} - // Origin - place holder. - Origin *string `json:"origin,omitempty"` +// NewRemoveEnginePropertiesLogConfig : Instantiate RemoveEnginePropertiesLogConfig (Generic Model Constructor) +func (*WatsonxDataV3) NewRemoveEnginePropertiesLogConfig(coordinator []string, worker []string) (_model *RemoveEnginePropertiesLogConfig, err error) { + _model = &RemoveEnginePropertiesLogConfig{ + Coordinator: coordinator, + Worker: worker, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} - // Engine port. - Port *int64 `json:"port,omitempty"` +// UnmarshalRemoveEnginePropertiesLogConfig unmarshals an instance of RemoveEnginePropertiesLogConfig from the specified map of raw messages. +func UnmarshalRemoveEnginePropertiesLogConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RemoveEnginePropertiesLogConfig) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) + if err != nil { + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + if err != nil { + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // Region - place holder. - Region *string `json:"region,omitempty"` +// asPatch returns a generic map representation of the RemoveEnginePropertiesLogConfig +func (removeEnginePropertiesLogConfig *RemoveEnginePropertiesLogConfig) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(removeEnginePropertiesLogConfig.Coordinator) { + _patch["coordinator"] = removeEnginePropertiesLogConfig.Coordinator + } + if !core.IsNil(removeEnginePropertiesLogConfig.Worker) { + _patch["worker"] = removeEnginePropertiesLogConfig.Worker + } - // RemoveEngine properties. - RemoveEngineProperties *RemoveEngineProperties `json:"remove_engine_properties,omitempty"` + return +} - // CPD supported sizes are: custom, starter, small, medium, large, xlarge, and xxlarge. IBM cloud supported sizes are: - // custom, starter, small, medium, large, cache_optimized, compute_optimized and lite. - SizeConfig *string `json:"size_config,omitempty"` +// RemovePrestissimoEngineProperties : RemoveEngine properties. +type RemovePrestissimoEngineProperties struct { + // Catalog properties with dynamic catalog names. + Catalog map[string]RemovePrestissimoEnginePropertiesCatalogAdditionalProperties `json:"catalog" validate:"required"` - // Engine status. - Status *string `json:"status,omitempty"` + // Configuration properties of prestissimo that should be removed. + Configuration *RemovePrestissimoEnginePropertiesConfiguration `json:"configuration" validate:"required"` - // Engine status code. - StatusCode *int64 `json:"status_code" validate:"required"` + // Global properties of prestissimo that should be removed. + Global []string `json:"global" validate:"required"` - // Tags. - Tags []string `json:"tags,omitempty"` + // JVM properties of prestissimo that should be removed. + Jvm *RemovePrestissimoEnginePropertiesJvm `json:"jvm" validate:"required"` - // Engine type. - Type *string `json:"type,omitempty"` + // LogConfig properties of prestissimo that should be removed. + LogConfig *RemovePrestissimoEnginePropertiesLogConfig `json:"log_config" validate:"required"` - // Version of the engine. - Version *string `json:"version,omitempty"` + // Optimizer properties of prestissimo that should be removed. + OptimizerProperties []string `json:"optimizer_properties" validate:"required"` - // coordinator/worker property settings. - Worker *PrestissimoNodeDescriptionBody `json:"worker,omitempty"` + // Velox properties of prestissimo that should be removed. + Velox []string `json:"velox" validate:"required"` } -// Constants associated with the PrestissimoEngine.EngineRestart property. -// Triggers engine restart if value is force. -const ( - PrestissimoEngine_EngineRestart_False = "false" - PrestissimoEngine_EngineRestart_Force = "force" -) - -// Constants associated with the PrestissimoEngine.Origin property. -// Origin - place holder. -const ( - PrestissimoEngine_Origin_Discover = "discover" - PrestissimoEngine_Origin_External = "external" - PrestissimoEngine_Origin_Native = "native" -) - -// Constants associated with the PrestissimoEngine.Status property. -// Engine status. -const ( - PrestissimoEngine_Status_Pending = "pending" - PrestissimoEngine_Status_Running = "running" - PrestissimoEngine_Status_Stopped = "stopped" -) +// NewRemovePrestissimoEngineProperties : Instantiate RemovePrestissimoEngineProperties (Generic Model Constructor) +func (*WatsonxDataV3) NewRemovePrestissimoEngineProperties(catalog map[string]RemovePrestissimoEnginePropertiesCatalogAdditionalProperties, configuration *RemovePrestissimoEnginePropertiesConfiguration, global []string, jvm *RemovePrestissimoEnginePropertiesJvm, logConfig *RemovePrestissimoEnginePropertiesLogConfig, optimizerProperties []string, velox []string) (_model *RemovePrestissimoEngineProperties, err error) { + _model = &RemovePrestissimoEngineProperties{ + Catalog: catalog, + Configuration: configuration, + Global: global, + Jvm: jvm, + LogConfig: logConfig, + OptimizerProperties: optimizerProperties, + Velox: velox, + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} -// UnmarshalPrestissimoEngine unmarshals an instance of PrestissimoEngine from the specified map of raw messages. -func UnmarshalPrestissimoEngine(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestissimoEngine) - err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) +// UnmarshalRemovePrestissimoEngineProperties unmarshals an instance of RemovePrestissimoEngineProperties from the specified map of raw messages. +func UnmarshalRemovePrestissimoEngineProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RemovePrestissimoEngineProperties) + err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalRemovePrestissimoEnginePropertiesCatalogAdditionalProperties) if err != nil { - err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "associated_catalogs", &obj.AssociatedCatalogs) + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalRemovePrestissimoEnginePropertiesConfiguration) if err != nil { - err = core.SDKErrorf(err, "", "associated_catalogs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "build_version", &obj.BuildVersion) + err = core.UnmarshalPrimitive(m, "global", &obj.Global) if err != nil { - err = core.SDKErrorf(err, "", "build_version-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "global-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "coordinator", &obj.Coordinator, UnmarshalPrestissimoNodeDescriptionBody) + err = core.UnmarshalModel(m, "jvm", &obj.Jvm, UnmarshalRemovePrestissimoEnginePropertiesJvm) if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "jvm-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + err = core.UnmarshalModel(m, "log_config", &obj.LogConfig, UnmarshalRemovePrestissimoEnginePropertiesLogConfig) if err != nil { - err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "log_config-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + err = core.UnmarshalPrimitive(m, "optimizer_properties", &obj.OptimizerProperties) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "optimizer_properties-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) + err = core.UnmarshalPrimitive(m, "velox", &obj.Velox) if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "velox-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "engine_details", &obj.EngineDetails, UnmarshalPrestissimoEngineDetails) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the RemovePrestissimoEngineProperties +func (removePrestissimoEngineProperties *RemovePrestissimoEngineProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(removePrestissimoEngineProperties.Catalog) { + catalogPatchMap := map[string]map[string]interface{}{} + for k, v := range removePrestissimoEngineProperties.Catalog { + catalogPatchMap[k] = v.asPatch() + } + _patch["catalog"] = catalogPatchMap + } + if !core.IsNil(removePrestissimoEngineProperties.Configuration) { + _patch["configuration"] = removePrestissimoEngineProperties.Configuration.asPatch() + } + if !core.IsNil(removePrestissimoEngineProperties.Global) { + _patch["global"] = removePrestissimoEngineProperties.Global + } + if !core.IsNil(removePrestissimoEngineProperties.Jvm) { + _patch["jvm"] = removePrestissimoEngineProperties.Jvm.asPatch() + } + if !core.IsNil(removePrestissimoEngineProperties.LogConfig) { + _patch["log_config"] = removePrestissimoEngineProperties.LogConfig.asPatch() + } + if !core.IsNil(removePrestissimoEngineProperties.OptimizerProperties) { + _patch["optimizer_properties"] = removePrestissimoEngineProperties.OptimizerProperties + } + if !core.IsNil(removePrestissimoEngineProperties.Velox) { + _patch["velox"] = removePrestissimoEngineProperties.Velox + } + + return +} + +// RemovePrestissimoEnginePropertiesCatalogAdditionalProperties : Catalog properties of prestissimo that should be removed. +type RemovePrestissimoEnginePropertiesCatalogAdditionalProperties struct { + // Catalog coordinator properties of prestissimo that should be removed. + Coordinator []string `json:"coordinator" validate:"required"` + + // Catalog worker properties of prestissimo that should be removed. + Worker []string `json:"worker" validate:"required"` +} + +// NewRemovePrestissimoEnginePropertiesCatalogAdditionalProperties : Instantiate RemovePrestissimoEnginePropertiesCatalogAdditionalProperties (Generic Model Constructor) +func (*WatsonxDataV3) NewRemovePrestissimoEnginePropertiesCatalogAdditionalProperties(coordinator []string, worker []string) (_model *RemovePrestissimoEnginePropertiesCatalogAdditionalProperties, err error) { + _model = &RemovePrestissimoEnginePropertiesCatalogAdditionalProperties{ + Coordinator: coordinator, + Worker: worker, + } + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "engine_details-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalPrimitive(m, "engine_display_name", &obj.EngineDisplayName) + return +} + +// UnmarshalRemovePrestissimoEnginePropertiesCatalogAdditionalProperties unmarshals an instance of RemovePrestissimoEnginePropertiesCatalogAdditionalProperties from the specified map of raw messages. +func UnmarshalRemovePrestissimoEnginePropertiesCatalogAdditionalProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RemovePrestissimoEnginePropertiesCatalogAdditionalProperties) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "engine_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) if err != nil { - err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "engine_properties", &obj.EngineProperties, UnmarshalPrestissimoEngineEngineProperties) - if err != nil { - err = core.SDKErrorf(err, "", "engine_properties-error", common.GetComponentInfo()) - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the RemovePrestissimoEnginePropertiesCatalogAdditionalProperties +func (removePrestissimoEnginePropertiesCatalogAdditionalProperties *RemovePrestissimoEnginePropertiesCatalogAdditionalProperties) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(removePrestissimoEnginePropertiesCatalogAdditionalProperties.Coordinator) { + _patch["coordinator"] = removePrestissimoEnginePropertiesCatalogAdditionalProperties.Coordinator } - err = core.UnmarshalPrimitive(m, "engine_restart", &obj.EngineRestart) - if err != nil { - err = core.SDKErrorf(err, "", "engine_restart-error", common.GetComponentInfo()) - return + if !core.IsNil(removePrestissimoEnginePropertiesCatalogAdditionalProperties.Worker) { + _patch["worker"] = removePrestissimoEnginePropertiesCatalogAdditionalProperties.Worker } - err = core.UnmarshalPrimitive(m, "external_host_name", &obj.ExternalHostName) - if err != nil { - err = core.SDKErrorf(err, "", "external_host_name-error", common.GetComponentInfo()) - return + + return +} + +// RemovePrestissimoEnginePropertiesConfiguration : Configuration properties of prestissimo that should be removed. +type RemovePrestissimoEnginePropertiesConfiguration struct { + // Coordinator Properties that should be deleted for Prestissimo. + Coordinator []string `json:"coordinator" validate:"required"` + + // Worker Properties that should be deleted for Prestissimo. + Worker []string `json:"worker" validate:"required"` +} + +// NewRemovePrestissimoEnginePropertiesConfiguration : Instantiate RemovePrestissimoEnginePropertiesConfiguration (Generic Model Constructor) +func (*WatsonxDataV3) NewRemovePrestissimoEnginePropertiesConfiguration(coordinator []string, worker []string) (_model *RemovePrestissimoEnginePropertiesConfiguration, err error) { + _model = &RemovePrestissimoEnginePropertiesConfiguration{ + Coordinator: coordinator, + Worker: worker, } - err = core.UnmarshalPrimitive(m, "group_id", &obj.GroupID) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "group_id-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalPrimitive(m, "host_name", &obj.HostName) + return +} + +// UnmarshalRemovePrestissimoEnginePropertiesConfiguration unmarshals an instance of RemovePrestissimoEnginePropertiesConfiguration from the specified map of raw messages. +func UnmarshalRemovePrestissimoEnginePropertiesConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RemovePrestissimoEnginePropertiesConfiguration) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "host_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) if err != nil { - err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the RemovePrestissimoEnginePropertiesConfiguration +func (removePrestissimoEnginePropertiesConfiguration *RemovePrestissimoEnginePropertiesConfiguration) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(removePrestissimoEnginePropertiesConfiguration.Coordinator) { + _patch["coordinator"] = removePrestissimoEnginePropertiesConfiguration.Coordinator } - err = core.UnmarshalPrimitive(m, "region", &obj.Region) - if err != nil { - err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) - return + if !core.IsNil(removePrestissimoEnginePropertiesConfiguration.Worker) { + _patch["worker"] = removePrestissimoEnginePropertiesConfiguration.Worker } - err = core.UnmarshalModel(m, "remove_engine_properties", &obj.RemoveEngineProperties, UnmarshalRemoveEngineProperties) - if err != nil { - err = core.SDKErrorf(err, "", "remove_engine_properties-error", common.GetComponentInfo()) - return + + return +} + +// RemovePrestissimoEnginePropertiesJvm : JVM properties of prestissimo that should be removed. +type RemovePrestissimoEnginePropertiesJvm struct { + // JVM coordinator properties of prestissimo that should be removed. + Coordinator []string `json:"coordinator" validate:"required"` +} + +// NewRemovePrestissimoEnginePropertiesJvm : Instantiate RemovePrestissimoEnginePropertiesJvm (Generic Model Constructor) +func (*WatsonxDataV3) NewRemovePrestissimoEnginePropertiesJvm(coordinator []string) (_model *RemovePrestissimoEnginePropertiesJvm, err error) { + _model = &RemovePrestissimoEnginePropertiesJvm{ + Coordinator: coordinator, } - err = core.UnmarshalPrimitive(m, "size_config", &obj.SizeConfig) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "size_config-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + return +} + +// UnmarshalRemovePrestissimoEnginePropertiesJvm unmarshals an instance of RemovePrestissimoEnginePropertiesJvm from the specified map of raw messages. +func UnmarshalRemovePrestissimoEnginePropertiesJvm(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RemovePrestissimoEnginePropertiesJvm) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) - if err != nil { - err = core.SDKErrorf(err, "", "status_code-error", common.GetComponentInfo()) - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the RemovePrestissimoEnginePropertiesJvm +func (removePrestissimoEnginePropertiesJvm *RemovePrestissimoEnginePropertiesJvm) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(removePrestissimoEnginePropertiesJvm.Coordinator) { + _patch["coordinator"] = removePrestissimoEnginePropertiesJvm.Coordinator } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) - if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) - return + + return +} + +// RemovePrestissimoEnginePropertiesLogConfig : LogConfig properties of prestissimo that should be removed. +type RemovePrestissimoEnginePropertiesLogConfig struct { + // LogConfig coordinator properties of prestissimo that should be removed. + Coordinator []string `json:"coordinator" validate:"required"` + + // LogConfig worker properties of prestissimo that should be removed. + Worker []string `json:"worker" validate:"required"` +} + +// NewRemovePrestissimoEnginePropertiesLogConfig : Instantiate RemovePrestissimoEnginePropertiesLogConfig (Generic Model Constructor) +func (*WatsonxDataV3) NewRemovePrestissimoEnginePropertiesLogConfig(coordinator []string, worker []string) (_model *RemovePrestissimoEnginePropertiesLogConfig, err error) { + _model = &RemovePrestissimoEnginePropertiesLogConfig{ + Coordinator: coordinator, + Worker: worker, } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) + return +} + +// UnmarshalRemovePrestissimoEnginePropertiesLogConfig unmarshals an instance of RemovePrestissimoEnginePropertiesLogConfig from the specified map of raw messages. +func UnmarshalRemovePrestissimoEnginePropertiesLogConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RemovePrestissimoEnginePropertiesLogConfig) + err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) if err != nil { - err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "worker", &obj.Worker, UnmarshalPrestissimoNodeDescriptionBody) + err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) if err != nil { err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) return @@ -23005,651 +28248,802 @@ func UnmarshalPrestissimoEngine(m map[string]json.RawMessage, result interface{} return } -// PrestissimoEngineCollection : list Prestissimo Engines. -type PrestissimoEngineCollection struct { - // list prestissimo engines. - PrestissimoEngines []PrestissimoEngine `json:"prestissimo_engines,omitempty"` +// asPatch returns a generic map representation of the RemovePrestissimoEnginePropertiesLogConfig +func (removePrestissimoEnginePropertiesLogConfig *RemovePrestissimoEnginePropertiesLogConfig) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(removePrestissimoEnginePropertiesLogConfig.Coordinator) { + _patch["coordinator"] = removePrestissimoEnginePropertiesLogConfig.Coordinator + } + if !core.IsNil(removePrestissimoEnginePropertiesLogConfig.Worker) { + _patch["worker"] = removePrestissimoEnginePropertiesLogConfig.Worker + } + + return } -// UnmarshalPrestissimoEngineCollection unmarshals an instance of PrestissimoEngineCollection from the specified map of raw messages. -func UnmarshalPrestissimoEngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestissimoEngineCollection) - err = core.UnmarshalModel(m, "prestissimo_engines", &obj.PrestissimoEngines, UnmarshalPrestissimoEngine) - if err != nil { - err = core.SDKErrorf(err, "", "prestissimo_engines-error", common.GetComponentInfo()) - return +// ReplaceDataPolicyOptions : The ReplaceDataPolicy options. +type ReplaceDataPolicyOptions struct { + // Name of data policy as path param which needs to be updated. + Name *string `json:"name" validate:"required,ne="` + + // The data artifact provides the full path of the resource to which the data policy applies. + DataArtifact *string `json:"data_artifact" validate:"required"` + + // rules is the array RuleV2. RuleV2 contains the effect, actions and grantees. + Rules []RuleV2 `json:"rules" validate:"required"` + + // name of the catalog in which the data policy resource is residing. + CatalogName *string `json:"catalog_name,omitempty"` + + // type of the catalog in which the data policy resource is residing. + CatalogType *string `json:"catalog_type,omitempty"` + + // a more detailed description of the policy. + Description *string `json:"description,omitempty"` + + // The unique name of the data policy.It should be in a given pattern. + PolicyName *string `json:"policy_name,omitempty"` + + // identifier of the resource on which the data policy is created on. + ResourceID *string `json:"resource_id,omitempty"` + + // status of data policy. Values can be active or inactive. + Status *string `json:"status,omitempty"` + + // Unique identifier assigned to a specific watsonx.data instance. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// Constants associated with the ReplaceDataPolicyOptions.Status property. +// status of data policy. Values can be active or inactive. +const ( + ReplaceDataPolicyOptions_Status_Active = "active" + ReplaceDataPolicyOptions_Status_Inactive = "inactive" +) + +// NewReplaceDataPolicyOptions : Instantiate ReplaceDataPolicyOptions +func (*WatsonxDataV3) NewReplaceDataPolicyOptions(name string, dataArtifact string, rules []RuleV2) *ReplaceDataPolicyOptions { + return &ReplaceDataPolicyOptions{ + Name: core.StringPtr(name), + DataArtifact: core.StringPtr(dataArtifact), + Rules: rules, } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// PrestissimoEngineDetails : External engine details. -type PrestissimoEngineDetails struct { - // api key to work with the saas IAE instance. - ApiKey *string `json:"api_key,omitempty"` +// SetName : Allow user to set Name +func (_options *ReplaceDataPolicyOptions) SetName(name string) *ReplaceDataPolicyOptions { + _options.Name = core.StringPtr(name) + return _options +} - // External engine connection string. - ConnectionString *string `json:"connection_string,omitempty"` +// SetDataArtifact : Allow user to set DataArtifact +func (_options *ReplaceDataPolicyOptions) SetDataArtifact(dataArtifact string) *ReplaceDataPolicyOptions { + _options.DataArtifact = core.StringPtr(dataArtifact) + return _options +} + +// SetRules : Allow user to set Rules +func (_options *ReplaceDataPolicyOptions) SetRules(rules []RuleV2) *ReplaceDataPolicyOptions { + _options.Rules = rules + return _options +} + +// SetCatalogName : Allow user to set CatalogName +func (_options *ReplaceDataPolicyOptions) SetCatalogName(catalogName string) *ReplaceDataPolicyOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options +} + +// SetCatalogType : Allow user to set CatalogType +func (_options *ReplaceDataPolicyOptions) SetCatalogType(catalogType string) *ReplaceDataPolicyOptions { + _options.CatalogType = core.StringPtr(catalogType) + return _options +} + +// SetDescription : Allow user to set Description +func (_options *ReplaceDataPolicyOptions) SetDescription(description string) *ReplaceDataPolicyOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetPolicyName : Allow user to set PolicyName +func (_options *ReplaceDataPolicyOptions) SetPolicyName(policyName string) *ReplaceDataPolicyOptions { + _options.PolicyName = core.StringPtr(policyName) + return _options +} + +// SetResourceID : Allow user to set ResourceID +func (_options *ReplaceDataPolicyOptions) SetResourceID(resourceID string) *ReplaceDataPolicyOptions { + _options.ResourceID = core.StringPtr(resourceID) + return _options +} + +// SetStatus : Allow user to set Status +func (_options *ReplaceDataPolicyOptions) SetStatus(status string) *ReplaceDataPolicyOptions { + _options.Status = core.StringPtr(status) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ReplaceDataPolicyOptions) SetAuthInstanceID(authInstanceID string) *ReplaceDataPolicyOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceDataPolicyOptions) SetHeaders(param map[string]string) *ReplaceDataPolicyOptions { + options.Headers = param + return options +} + +// ReplaceSalIntegrationEnrichmentGlobalSettingsOptions : The ReplaceSalIntegrationEnrichmentGlobalSettings options. +type ReplaceSalIntegrationEnrichmentGlobalSettingsOptions struct { + // semantic expansion. + Expansion *SalEnrichmentSettingsExpansion `json:"expansion" validate:"required"` + + // semantic expansion. + TermAssignment *SalEnrichmentSettingsTermAssignment `json:"term_assignment" validate:"required"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewReplaceSalIntegrationEnrichmentGlobalSettingsOptions : Instantiate ReplaceSalIntegrationEnrichmentGlobalSettingsOptions +func (*WatsonxDataV3) NewReplaceSalIntegrationEnrichmentGlobalSettingsOptions(expansion *SalEnrichmentSettingsExpansion, termAssignment *SalEnrichmentSettingsTermAssignment) *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions { + return &ReplaceSalIntegrationEnrichmentGlobalSettingsOptions{ + Expansion: expansion, + TermAssignment: termAssignment, + } +} + +// SetExpansion : Allow user to set Expansion +func (_options *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) SetExpansion(expansion *SalEnrichmentSettingsExpansion) *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions { + _options.Expansion = expansion + return _options +} + +// SetTermAssignment : Allow user to set TermAssignment +func (_options *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) SetTermAssignment(termAssignment *SalEnrichmentSettingsTermAssignment) *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions { + _options.TermAssignment = termAssignment + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) SetAuthInstanceID(authInstanceID string) *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) SetHeaders(param map[string]string) *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions { + options.Headers = param + return options +} + +// ReplaceSalIntegrationEnrichmentProjectSettingsOptions : The ReplaceSalIntegrationEnrichmentProjectSettings options. +type ReplaceSalIntegrationEnrichmentProjectSettingsOptions struct { + // IBM Knowledge Catalog project id. + ProjectID *string `json:"project_id" validate:"required"` + + // semantic expansion. + Expansion *SalEnrichmentSettingsExpansion `json:"expansion" validate:"required"` + + // semantic expansion. + TermAssignment *SalEnrichmentSettingsTermAssignment `json:"term_assignment" validate:"required"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewReplaceSalIntegrationEnrichmentProjectSettingsOptions : Instantiate ReplaceSalIntegrationEnrichmentProjectSettingsOptions +func (*WatsonxDataV3) NewReplaceSalIntegrationEnrichmentProjectSettingsOptions(projectID string, expansion *SalEnrichmentSettingsExpansion, termAssignment *SalEnrichmentSettingsTermAssignment) *ReplaceSalIntegrationEnrichmentProjectSettingsOptions { + return &ReplaceSalIntegrationEnrichmentProjectSettingsOptions{ + ProjectID: core.StringPtr(projectID), + Expansion: expansion, + TermAssignment: termAssignment, + } +} + +// SetProjectID : Allow user to set ProjectID +func (_options *ReplaceSalIntegrationEnrichmentProjectSettingsOptions) SetProjectID(projectID string) *ReplaceSalIntegrationEnrichmentProjectSettingsOptions { + _options.ProjectID = core.StringPtr(projectID) + return _options +} - // coordinator/worker property settings. - Coordinator *PrestissimoNodeDescriptionBody `json:"coordinator,omitempty"` +// SetExpansion : Allow user to set Expansion +func (_options *ReplaceSalIntegrationEnrichmentProjectSettingsOptions) SetExpansion(expansion *SalEnrichmentSettingsExpansion) *ReplaceSalIntegrationEnrichmentProjectSettingsOptions { + _options.Expansion = expansion + return _options +} - // Endpoints. - Endpoints *PrestissimoEndpoints `json:"endpoints,omitempty"` +// SetTermAssignment : Allow user to set TermAssignment +func (_options *ReplaceSalIntegrationEnrichmentProjectSettingsOptions) SetTermAssignment(termAssignment *SalEnrichmentSettingsTermAssignment) *ReplaceSalIntegrationEnrichmentProjectSettingsOptions { + _options.TermAssignment = termAssignment + return _options +} - // Instance to access the instance. - InstanceID *string `json:"instance_id,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ReplaceSalIntegrationEnrichmentProjectSettingsOptions) SetAuthInstanceID(authInstanceID string) *ReplaceSalIntegrationEnrichmentProjectSettingsOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // How is the spark instance managed. - ManagedBy *string `json:"managed_by,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *ReplaceSalIntegrationEnrichmentProjectSettingsOptions) SetHeaders(param map[string]string) *ReplaceSalIntegrationEnrichmentProjectSettingsOptions { + options.Headers = param + return options +} - // Metastore host. - MetastoreHost *string `json:"metastore_host,omitempty"` +// ResourceDetails : This resource details contain resource type and resource id or name. +type ResourceDetails struct { + // Identifier of the resource. + ID *string `json:"id,omitempty"` - // CPD supported sizes are: custom, starter, small, medium, large, xlarge, and xxlarge. IBM cloud supported sizes are: - // custom, starter, small, medium, large, cache_optimized, compute_optimized and lite. - SizeConfig *string `json:"size_config,omitempty"` + // Name of the resource. + Name *string `json:"name,omitempty"` - // coordinator/worker property settings. - Worker *PrestissimoNodeDescriptionBody `json:"worker,omitempty"` + // Type of resource. + Type *string `json:"type" validate:"required"` } -// Constants associated with the PrestissimoEngineDetails.SizeConfig property. -// CPD supported sizes are: custom, starter, small, medium, large, xlarge, and xxlarge. IBM cloud supported sizes are: -// custom, starter, small, medium, large, cache_optimized, compute_optimized and lite. +// Constants associated with the ResourceDetails.Type property. +// Type of resource. const ( - PrestissimoEngineDetails_SizeConfig_CacheOptimized = "cache_optimized" - PrestissimoEngineDetails_SizeConfig_ComputeOptimized = "compute_optimized" - PrestissimoEngineDetails_SizeConfig_Custom = "custom" - PrestissimoEngineDetails_SizeConfig_Large = "large" - PrestissimoEngineDetails_SizeConfig_Medium = "medium" - PrestissimoEngineDetails_SizeConfig_Small = "small" - PrestissimoEngineDetails_SizeConfig_Starter = "starter" + ResourceDetails_Type_Catalog = "catalog" + ResourceDetails_Type_Database = "database" + ResourceDetails_Type_Datastax = "datastax" + ResourceDetails_Type_Milvus = "milvus" + ResourceDetails_Type_Prestissimo = "prestissimo" + ResourceDetails_Type_Presto = "presto" + ResourceDetails_Type_Spark = "spark" + ResourceDetails_Type_Storage = "storage" ) -// UnmarshalPrestissimoEngineDetails unmarshals an instance of PrestissimoEngineDetails from the specified map of raw messages. -func UnmarshalPrestissimoEngineDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestissimoEngineDetails) - err = core.UnmarshalPrimitive(m, "api_key", &obj.ApiKey) - if err != nil { - err = core.SDKErrorf(err, "", "api_key-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) - if err != nil { - err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "coordinator", &obj.Coordinator, UnmarshalPrestissimoNodeDescriptionBody) - if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "endpoints", &obj.Endpoints, UnmarshalPrestissimoEndpoints) - if err != nil { - err = core.SDKErrorf(err, "", "endpoints-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) - if err != nil { - err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) - if err != nil { - err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "metastore_host", &obj.MetastoreHost) - if err != nil { - err = core.SDKErrorf(err, "", "metastore_host-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "size_config", &obj.SizeConfig) - if err != nil { - err = core.SDKErrorf(err, "", "size_config-error", common.GetComponentInfo()) - return +// NewResourceDetails : Instantiate ResourceDetails (Generic Model Constructor) +func (*WatsonxDataV3) NewResourceDetails(typeVar string) (_model *ResourceDetails, err error) { + _model = &ResourceDetails{ + Type: core.StringPtr(typeVar), } - err = core.UnmarshalModel(m, "worker", &obj.Worker, UnmarshalPrestissimoNodeDescriptionBody) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// PrestissimoEngineEngineProperties : Engine properties. -type PrestissimoEngineEngineProperties struct { - // Catalog settings. - Catalog *PrestissimoPropertiesCatalog `json:"catalog,omitempty"` - - // Configuration settings for the engine properties. - Configuration *EnginePropertiesOaiGenConfiguration `json:"configuration,omitempty"` - - // velox settings. - Velox *PrestissimoEnginePropertiesVelox `json:"velox,omitempty"` - - // JVM settings. - Jvm *PrestissimoEnginePropertiesOaiGen1Jvm `json:"jvm,omitempty"` -} - -// UnmarshalPrestissimoEngineEngineProperties unmarshals an instance of PrestissimoEngineEngineProperties from the specified map of raw messages. -func UnmarshalPrestissimoEngineEngineProperties(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestissimoEngineEngineProperties) - err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalPrestissimoPropertiesCatalog) - if err != nil { - err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalEnginePropertiesOaiGenConfiguration) +// UnmarshalResourceDetails unmarshals an instance of ResourceDetails from the specified map of raw messages. +func UnmarshalResourceDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceDetails) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "velox", &obj.Velox, UnmarshalPrestissimoEnginePropertiesVelox) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "velox-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "jvm", &obj.Jvm, UnmarshalPrestissimoEnginePropertiesOaiGen1Jvm) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "jvm-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the PrestissimoEngineEngineProperties -func (prestissimoEngineEngineProperties *PrestissimoEngineEngineProperties) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestissimoEngineEngineProperties.Catalog) { - _patch["catalog"] = prestissimoEngineEngineProperties.Catalog.asPatch() - } - if !core.IsNil(prestissimoEngineEngineProperties.Configuration) { - _patch["configuration"] = prestissimoEngineEngineProperties.Configuration.asPatch() - } - if !core.IsNil(prestissimoEngineEngineProperties.Velox) { - _patch["velox"] = prestissimoEngineEngineProperties.Velox.asPatch() - } - if !core.IsNil(prestissimoEngineEngineProperties.Jvm) { - _patch["jvm"] = prestissimoEngineEngineProperties.Jvm.asPatch() - } - - return -} - -// PrestissimoEnginePatch : Update prestissimo engine body. -type PrestissimoEnginePatch struct { - // Modified description. - Description *string `json:"description,omitempty"` - - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` - - // Engine properties. - EngineProperties *PrestissimoEngineEngineProperties `json:"engine_properties,omitempty"` - - // Triggers engine restart if value is force. - EngineRestart *string `json:"engine_restart,omitempty"` +// ResourceDetailsBulkUpdate : This resource details contain resource type and resource id or name. +type ResourceDetailsBulkUpdate struct { + // Identifier of the resource. + ID *string `json:"id,omitempty"` - // RemoveEngine properties. - RemoveEngineProperties *RemoveEngineProperties `json:"remove_engine_properties,omitempty"` + // Name of the resource. + Name *string `json:"name,omitempty"` - // Tags. - Tags []string `json:"tags,omitempty"` + // Type of resource. + Type *string `json:"type" validate:"required"` } -// Constants associated with the PrestissimoEnginePatch.EngineRestart property. -// Triggers engine restart if value is force. +// Constants associated with the ResourceDetailsBulkUpdate.Type property. +// Type of resource. const ( - PrestissimoEnginePatch_EngineRestart_False = "false" - PrestissimoEnginePatch_EngineRestart_Force = "force" + ResourceDetailsBulkUpdate_Type_Catalog = "catalog" + ResourceDetailsBulkUpdate_Type_Database = "database" + ResourceDetailsBulkUpdate_Type_Datastax = "datastax" + ResourceDetailsBulkUpdate_Type_Milvus = "milvus" + ResourceDetailsBulkUpdate_Type_Prestissimo = "prestissimo" + ResourceDetailsBulkUpdate_Type_Presto = "presto" + ResourceDetailsBulkUpdate_Type_Spark = "spark" + ResourceDetailsBulkUpdate_Type_Storage = "storage" ) -// UnmarshalPrestissimoEnginePatch unmarshals an instance of PrestissimoEnginePatch from the specified map of raw messages. -func UnmarshalPrestissimoEnginePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestissimoEnginePatch) - err = core.UnmarshalPrimitive(m, "description", &obj.Description) - if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "engine_display_name", &obj.EngineDisplayName) - if err != nil { - err = core.SDKErrorf(err, "", "engine_display_name-error", common.GetComponentInfo()) - return +// NewResourceDetailsBulkUpdate : Instantiate ResourceDetailsBulkUpdate (Generic Model Constructor) +func (*WatsonxDataV3) NewResourceDetailsBulkUpdate(typeVar string) (_model *ResourceDetailsBulkUpdate, err error) { + _model = &ResourceDetailsBulkUpdate{ + Type: core.StringPtr(typeVar), } - err = core.UnmarshalModel(m, "engine_properties", &obj.EngineProperties, UnmarshalPrestissimoEngineEngineProperties) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "engine_properties-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalPrimitive(m, "engine_restart", &obj.EngineRestart) + return +} + +// UnmarshalResourceDetailsBulkUpdate unmarshals an instance of ResourceDetailsBulkUpdate from the specified map of raw messages. +func UnmarshalResourceDetailsBulkUpdate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceDetailsBulkUpdate) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "engine_restart-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "remove_engine_properties", &obj.RemoveEngineProperties, UnmarshalRemoveEngineProperties) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "remove_engine_properties-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the PrestissimoEnginePatch -func (prestissimoEnginePatch *PrestissimoEnginePatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(prestissimoEnginePatch.Description) { - _patch["description"] = prestissimoEnginePatch.Description - } - if !core.IsNil(prestissimoEnginePatch.EngineDisplayName) { - _patch["engine_display_name"] = prestissimoEnginePatch.EngineDisplayName - } - if !core.IsNil(prestissimoEnginePatch.EngineProperties) { - _patch["engine_properties"] = prestissimoEnginePatch.EngineProperties.asPatch() - } - if !core.IsNil(prestissimoEnginePatch.EngineRestart) { - _patch["engine_restart"] = prestissimoEnginePatch.EngineRestart - } - if !core.IsNil(prestissimoEnginePatch.RemoveEngineProperties) { - _patch["remove_engine_properties"] = prestissimoEnginePatch.RemoveEngineProperties.asPatch() - } - if !core.IsNil(prestissimoEnginePatch.Tags) { - _patch["tags"] = prestissimoEnginePatch.Tags - } - - return -} +// ResourceGroupForEngine : ResourceGroupForEngine struct +type ResourceGroupForEngine struct { + // Resource group file name. + ResourceGroupFileName *string `json:"resource_group_file_name,omitempty"` -// PrestissimoEnginePropertiesCatalog : Catalog settings. -type PrestissimoEnginePropertiesCatalog struct { - // catalog name. - CatalogName []string `json:"catalog_name,omitempty"` + // Resource group id. + ResourceGroupID *string `json:"resource_group_id,omitempty"` } -// UnmarshalPrestissimoEnginePropertiesCatalog unmarshals an instance of PrestissimoEnginePropertiesCatalog from the specified map of raw messages. -func UnmarshalPrestissimoEnginePropertiesCatalog(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestissimoEnginePropertiesCatalog) - err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) +// UnmarshalResourceGroupForEngine unmarshals an instance of ResourceGroupForEngine from the specified map of raw messages. +func UnmarshalResourceGroupForEngine(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupForEngine) + err = core.UnmarshalPrimitive(m, "resource_group_file_name", &obj.ResourceGroupFileName) if err != nil { - err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_group_file_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) + if err != nil { + err = core.SDKErrorf(err, "", "resource_group_id-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the PrestissimoEnginePropertiesCatalog -func (prestissimoEnginePropertiesCatalog *PrestissimoEnginePropertiesCatalog) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestissimoEnginePropertiesCatalog.CatalogName) { - _patch["catalog_name"] = prestissimoEnginePropertiesCatalog.CatalogName - } +// RestartPrestissimoEngineOptions : The RestartPrestissimoEngine options. +type RestartPrestissimoEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - return -} + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` -// PrestissimoEnginePropertiesOaiGen1Jvm : JVM settings. -type PrestissimoEnginePropertiesOaiGen1Jvm struct { - // Coordinator/ worker properties. - Coordinator map[string]string `json:"coordinator,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalPrestissimoEnginePropertiesOaiGen1Jvm unmarshals an instance of PrestissimoEnginePropertiesOaiGen1Jvm from the specified map of raw messages. -func UnmarshalPrestissimoEnginePropertiesOaiGen1Jvm(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestissimoEnginePropertiesOaiGen1Jvm) - err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) - if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) - return +// NewRestartPrestissimoEngineOptions : Instantiate RestartPrestissimoEngineOptions +func (*WatsonxDataV3) NewRestartPrestissimoEngineOptions(id string) *RestartPrestissimoEngineOptions { + return &RestartPrestissimoEngineOptions{ + ID: core.StringPtr(id), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// asPatch returns a generic map representation of the PrestissimoEnginePropertiesOaiGen1Jvm -func (prestissimoEnginePropertiesOaiGen1Jvm *PrestissimoEnginePropertiesOaiGen1Jvm) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestissimoEnginePropertiesOaiGen1Jvm.Coordinator) { - _patch["coordinator"] = prestissimoEnginePropertiesOaiGen1Jvm.Coordinator - } +// SetID : Allow user to set ID +func (_options *RestartPrestissimoEngineOptions) SetID(id string) *RestartPrestissimoEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} - return +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *RestartPrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *RestartPrestissimoEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options } -// PrestissimoEnginePropertiesVelox : velox settings. -type PrestissimoEnginePropertiesVelox struct { - // velox property. - VeloxProperty []string `json:"velox_property,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *RestartPrestissimoEngineOptions) SetHeaders(param map[string]string) *RestartPrestissimoEngineOptions { + options.Headers = param + return options } -// UnmarshalPrestissimoEnginePropertiesVelox unmarshals an instance of PrestissimoEnginePropertiesVelox from the specified map of raw messages. -func UnmarshalPrestissimoEnginePropertiesVelox(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestissimoEnginePropertiesVelox) - err = core.UnmarshalPrimitive(m, "velox_property", &obj.VeloxProperty) - if err != nil { - err = core.SDKErrorf(err, "", "velox_property-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// RestartPrestoEngineOptions : The RestartPrestoEngine options. +type RestartPrestoEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string } -// asPatch returns a generic map representation of the PrestissimoEnginePropertiesVelox -func (prestissimoEnginePropertiesVelox *PrestissimoEnginePropertiesVelox) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestissimoEnginePropertiesVelox.VeloxProperty) { - _patch["velox_property"] = prestissimoEnginePropertiesVelox.VeloxProperty +// NewRestartPrestoEngineOptions : Instantiate RestartPrestoEngineOptions +func (*WatsonxDataV3) NewRestartPrestoEngineOptions(id string) *RestartPrestoEngineOptions { + return &RestartPrestoEngineOptions{ + ID: core.StringPtr(id), } +} - return +// SetID : Allow user to set ID +func (_options *RestartPrestoEngineOptions) SetID(id string) *RestartPrestoEngineOptions { + _options.ID = core.StringPtr(id) + return _options } -// PrestissimoNodeDescriptionBody : coordinator/worker property settings. -type PrestissimoNodeDescriptionBody struct { - // Node Type, r5, m, i.. - NodeType *string `json:"node_type,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *RestartPrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *RestartPrestoEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // Number of nodes. - Quantity *int64 `json:"quantity,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *RestartPrestoEngineOptions) SetHeaders(param map[string]string) *RestartPrestoEngineOptions { + options.Headers = param + return options } -// UnmarshalPrestissimoNodeDescriptionBody unmarshals an instance of PrestissimoNodeDescriptionBody from the specified map of raw messages. -func UnmarshalPrestissimoNodeDescriptionBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestissimoNodeDescriptionBody) - err = core.UnmarshalPrimitive(m, "node_type", &obj.NodeType) - if err != nil { - err = core.SDKErrorf(err, "", "node_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "quantity", &obj.Quantity) - if err != nil { - err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// ResultPrestissimoExplainStatement : ExplainStatement OK. +type ResultPrestissimoExplainStatement struct { + // result. + Result *string `json:"result,omitempty"` } -// asPatch returns a generic map representation of the PrestissimoNodeDescriptionBody -func (prestissimoNodeDescriptionBody *PrestissimoNodeDescriptionBody) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestissimoNodeDescriptionBody.NodeType) { - _patch["node_type"] = prestissimoNodeDescriptionBody.NodeType - } - if !core.IsNil(prestissimoNodeDescriptionBody.Quantity) { - _patch["quantity"] = prestissimoNodeDescriptionBody.Quantity +// UnmarshalResultPrestissimoExplainStatement unmarshals an instance of ResultPrestissimoExplainStatement from the specified map of raw messages. +func UnmarshalResultPrestissimoExplainStatement(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResultPrestissimoExplainStatement) + err = core.UnmarshalPrimitive(m, "result", &obj.Result) + if err != nil { + err = core.SDKErrorf(err, "", "result-error", common.GetComponentInfo()) + return } - + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// PrestissimoPropertiesCatalog : Catalog settings. -type PrestissimoPropertiesCatalog struct { - // Catalog settings. - CatalogName *EnginePropertiesCatalog `json:"catalog_name,omitempty"` +// ResultRunPrestissimoExplainAnalyzeStatement : explainAnalyzeStatement OK. +type ResultRunPrestissimoExplainAnalyzeStatement struct { + // explainAnalyzeStatement result. + Result *string `json:"result,omitempty"` } -// UnmarshalPrestissimoPropertiesCatalog unmarshals an instance of PrestissimoPropertiesCatalog from the specified map of raw messages. -func UnmarshalPrestissimoPropertiesCatalog(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestissimoPropertiesCatalog) - err = core.UnmarshalModel(m, "catalog_name", &obj.CatalogName, UnmarshalEnginePropertiesCatalog) +// UnmarshalResultRunPrestissimoExplainAnalyzeStatement unmarshals an instance of ResultRunPrestissimoExplainAnalyzeStatement from the specified map of raw messages. +func UnmarshalResultRunPrestissimoExplainAnalyzeStatement(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResultRunPrestissimoExplainAnalyzeStatement) + err = core.UnmarshalPrimitive(m, "result", &obj.Result) if err != nil { - err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "result-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the PrestissimoPropertiesCatalog -func (prestissimoPropertiesCatalog *PrestissimoPropertiesCatalog) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestissimoPropertiesCatalog.CatalogName) { - _patch["catalog_name"] = prestissimoPropertiesCatalog.CatalogName.asPatch() - } - - return -} - -// PrestoEngine : EngineDetail. -type PrestoEngine struct { - // Actions. - Actions []string `json:"actions,omitempty"` - - // Associated catalogs. - AssociatedCatalogs []string `json:"associated_catalogs,omitempty"` - - // watsonx.data build version. - BuildVersion *string `json:"build_version,omitempty"` +// ResumePrestissimoEngineOptions : The ResumePrestissimoEngine options. +type ResumePrestissimoEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // NodeDescription. - Coordinator *NodeDescription `json:"coordinator,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // Created user name. - CreatedBy *string `json:"created_by,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string +} - // Created time in epoch format. - CreatedOn *int64 `json:"created_on,omitempty"` +// NewResumePrestissimoEngineOptions : Instantiate ResumePrestissimoEngineOptions +func (*WatsonxDataV3) NewResumePrestissimoEngineOptions(id string) *ResumePrestissimoEngineOptions { + return &ResumePrestissimoEngineOptions{ + ID: core.StringPtr(id), + } +} - // Engine description. - Description *string `json:"description,omitempty"` +// SetID : Allow user to set ID +func (_options *ResumePrestissimoEngineOptions) SetID(id string) *ResumePrestissimoEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} - // Driver details. - Drivers []Driver `json:"drivers,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ResumePrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *ResumePrestissimoEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // Node details. - EngineDetails *EngineDetailsBody `json:"engine_details,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *ResumePrestissimoEngineOptions) SetHeaders(param map[string]string) *ResumePrestissimoEngineOptions { + options.Headers = param + return options +} - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` +// ResumePrestoEngineOptions : The ResumePrestoEngine options. +type ResumePrestoEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // Engine programmatic name. - EngineID *string `json:"engine_id,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // Engine properties. - EngineProperties *PrestoEngineEngineProperties `json:"engine_properties,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string +} - // Triggers engine restart if value is force. - EngineRestart *string `json:"engine_restart,omitempty"` +// NewResumePrestoEngineOptions : Instantiate ResumePrestoEngineOptions +func (*WatsonxDataV3) NewResumePrestoEngineOptions(id string) *ResumePrestoEngineOptions { + return &ResumePrestoEngineOptions{ + ID: core.StringPtr(id), + } +} - // Applicable only for OCP based clusters. This is typically servicename+route. - ExternalHostName *string `json:"external_host_name" validate:"required"` +// SetID : Allow user to set ID +func (_options *ResumePrestoEngineOptions) SetID(id string) *ResumePrestoEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} - // Group ID. - GroupID *string `json:"group_id,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ResumePrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *ResumePrestoEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // Engine host name. In case of OCP based clusters, this is internal hostname. - HostName *string `json:"host_name,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *ResumePrestoEngineOptions) SetHeaders(param map[string]string) *ResumePrestoEngineOptions { + options.Headers = param + return options +} - // Origin - created or registered. - Origin *string `json:"origin,omitempty"` +// ResumeSparkEngineOptions : The ResumeSparkEngine options. +type ResumeSparkEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // Engine port. - Port *int64 `json:"port,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // Region (cloud). - Region *string `json:"region,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string +} - // RemoveEngine properties. - RemoveEngineProperties *PrestoEnginePatchRemoveEngineProperties `json:"remove_engine_properties,omitempty"` +// NewResumeSparkEngineOptions : Instantiate ResumeSparkEngineOptions +func (*WatsonxDataV3) NewResumeSparkEngineOptions(id string) *ResumeSparkEngineOptions { + return &ResumeSparkEngineOptions{ + ID: core.StringPtr(id), + } +} - // CPD supported sizes are: custom, starter, small, medium, large, xlarge, and xxlarge. IBM cloud supported sizes are: - // custom, starter, small, medium, large, cache_optimized, compute_optimized and lite. - SizeConfig *string `json:"size_config,omitempty"` +// SetID : Allow user to set ID +func (_options *ResumeSparkEngineOptions) SetID(id string) *ResumeSparkEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} - // Engine status. - Status *string `json:"status,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ResumeSparkEngineOptions) SetAuthInstanceID(authInstanceID string) *ResumeSparkEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // Engine status code. - StatusCode *int64 `json:"status_code" validate:"required"` +// SetHeaders : Allow user to set Headers +func (options *ResumeSparkEngineOptions) SetHeaders(param map[string]string) *ResumeSparkEngineOptions { + options.Headers = param + return options +} - // Tags. - Tags []string `json:"tags,omitempty"` +// RevokeResourceAccessPoliciesOptions : The RevokeResourceAccessPolicies options. +type RevokeResourceAccessPoliciesOptions struct { + // List of resources to which the access policies should be applied. + Resources []ResourceDetails `json:"resources,omitempty"` - // Engine type presto. - Type *string `json:"type,omitempty"` + // List of subjects (users and user groups) to which the access policy applies, along with the specified permissions. + Subjects []SubjectRevoke `json:"subjects,omitempty"` - // Version of the engine. - Version *string `json:"version,omitempty"` + // Unique identifier assigned to a specific watsonx.data instance. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // NodeDescription. - Worker *NodeDescription `json:"worker,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string } -// Constants associated with the PrestoEngine.EngineRestart property. -// Triggers engine restart if value is force. -const ( - PrestoEngine_EngineRestart_False = "false" - PrestoEngine_EngineRestart_Force = "force" -) - -// Constants associated with the PrestoEngine.Origin property. -// Origin - created or registered. -const ( - PrestoEngine_Origin_Discover = "discover" - PrestoEngine_Origin_External = "external" - PrestoEngine_Origin_Native = "native" -) +// NewRevokeResourceAccessPoliciesOptions : Instantiate RevokeResourceAccessPoliciesOptions +func (*WatsonxDataV3) NewRevokeResourceAccessPoliciesOptions() *RevokeResourceAccessPoliciesOptions { + return &RevokeResourceAccessPoliciesOptions{} +} -// Constants associated with the PrestoEngine.Status property. -// Engine status. -const ( - PrestoEngine_Status_Pending = "pending" - PrestoEngine_Status_Running = "running" - PrestoEngine_Status_Stopped = "stopped" -) +// SetResources : Allow user to set Resources +func (_options *RevokeResourceAccessPoliciesOptions) SetResources(resources []ResourceDetails) *RevokeResourceAccessPoliciesOptions { + _options.Resources = resources + return _options +} -// UnmarshalPrestoEngine unmarshals an instance of PrestoEngine from the specified map of raw messages. -func UnmarshalPrestoEngine(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestoEngine) - err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) - if err != nil { - err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "associated_catalogs", &obj.AssociatedCatalogs) - if err != nil { - err = core.SDKErrorf(err, "", "associated_catalogs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "build_version", &obj.BuildVersion) - if err != nil { - err = core.SDKErrorf(err, "", "build_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "coordinator", &obj.Coordinator, UnmarshalNodeDescription) - if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) - if err != nil { - err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) - if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "description", &obj.Description) - if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "drivers", &obj.Drivers, UnmarshalDriver) - if err != nil { - err = core.SDKErrorf(err, "", "drivers-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "engine_details", &obj.EngineDetails, UnmarshalEngineDetailsBody) - if err != nil { - err = core.SDKErrorf(err, "", "engine_details-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "engine_display_name", &obj.EngineDisplayName) - if err != nil { - err = core.SDKErrorf(err, "", "engine_display_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) - if err != nil { - err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "engine_properties", &obj.EngineProperties, UnmarshalPrestoEngineEngineProperties) - if err != nil { - err = core.SDKErrorf(err, "", "engine_properties-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "engine_restart", &obj.EngineRestart) - if err != nil { - err = core.SDKErrorf(err, "", "engine_restart-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "external_host_name", &obj.ExternalHostName) - if err != nil { - err = core.SDKErrorf(err, "", "external_host_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "group_id", &obj.GroupID) - if err != nil { - err = core.SDKErrorf(err, "", "group_id-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "host_name", &obj.HostName) - if err != nil { - err = core.SDKErrorf(err, "", "host_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) - if err != nil { - err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "port", &obj.Port) - if err != nil { - err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "region", &obj.Region) - if err != nil { - err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) - return +// SetSubjects : Allow user to set Subjects +func (_options *RevokeResourceAccessPoliciesOptions) SetSubjects(subjects []SubjectRevoke) *RevokeResourceAccessPoliciesOptions { + _options.Subjects = subjects + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *RevokeResourceAccessPoliciesOptions) SetAuthInstanceID(authInstanceID string) *RevokeResourceAccessPoliciesOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RevokeResourceAccessPoliciesOptions) SetHeaders(param map[string]string) *RevokeResourceAccessPoliciesOptions { + options.Headers = param + return options +} + +// RollbackTableOptions : The RollbackTable options. +type RollbackTableOptions struct { + // Catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` + + // Schema name. + SchemaName *string `json:"schema_name" validate:"required,ne="` + + // Table name. + TableName *string `json:"table_name" validate:"required,ne="` + + // Snapshot Id. + SnapshotID *string `json:"snapshot_id,omitempty"` + + // Engine id. + EngineID *string `json:"engine_id,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewRollbackTableOptions : Instantiate RollbackTableOptions +func (*WatsonxDataV3) NewRollbackTableOptions(catalogName string, schemaName string, tableName string) *RollbackTableOptions { + return &RollbackTableOptions{ + CatalogName: core.StringPtr(catalogName), + SchemaName: core.StringPtr(schemaName), + TableName: core.StringPtr(tableName), } - err = core.UnmarshalModel(m, "remove_engine_properties", &obj.RemoveEngineProperties, UnmarshalPrestoEnginePatchRemoveEngineProperties) +} + +// SetCatalogName : Allow user to set CatalogName +func (_options *RollbackTableOptions) SetCatalogName(catalogName string) *RollbackTableOptions { + _options.CatalogName = core.StringPtr(catalogName) + return _options +} + +// SetSchemaName : Allow user to set SchemaName +func (_options *RollbackTableOptions) SetSchemaName(schemaName string) *RollbackTableOptions { + _options.SchemaName = core.StringPtr(schemaName) + return _options +} + +// SetTableName : Allow user to set TableName +func (_options *RollbackTableOptions) SetTableName(tableName string) *RollbackTableOptions { + _options.TableName = core.StringPtr(tableName) + return _options +} + +// SetSnapshotID : Allow user to set SnapshotID +func (_options *RollbackTableOptions) SetSnapshotID(snapshotID string) *RollbackTableOptions { + _options.SnapshotID = core.StringPtr(snapshotID) + return _options +} + +// SetEngineID : Allow user to set EngineID +func (_options *RollbackTableOptions) SetEngineID(engineID string) *RollbackTableOptions { + _options.EngineID = core.StringPtr(engineID) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *RollbackTableOptions) SetAuthInstanceID(authInstanceID string) *RollbackTableOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RollbackTableOptions) SetHeaders(param map[string]string) *RollbackTableOptions { + options.Headers = param + return options +} + +// RowFilterProperties : Defines row-level filtering properties for data access control. This schema specifies filter conditions that +// determine which rows of data are visible to specific users or groups (grantees). Row filtering enables fine-grained +// access control by restricting data visibility based on row attribute values, ensuring users only see data they are +// authorized to access. +type RowFilterProperties struct { + // Additional filter condition for row filtering. + FilterCondition *string `json:"filter_condition,omitempty"` + + // Row filter expression that determines which rows are visible. + RowFilter *string `json:"row_filter,omitempty"` +} + +// UnmarshalRowFilterProperties unmarshals an instance of RowFilterProperties from the specified map of raw messages. +func UnmarshalRowFilterProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RowFilterProperties) + err = core.UnmarshalPrimitive(m, "filter_condition", &obj.FilterCondition) if err != nil { - err = core.SDKErrorf(err, "", "remove_engine_properties-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "filter_condition-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "size_config", &obj.SizeConfig) + err = core.UnmarshalPrimitive(m, "row_filter", &obj.RowFilter) if err != nil { - err = core.SDKErrorf(err, "", "size_config-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "row_filter-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) - if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RuleGrantee : RuleGrantee contain type which can be user_identity or tag. Use user_identity as type for user or group. Key can be +// user_name for user or group_id for acess groups. Value can be username and access group id. +type RuleGrantee struct { + // grantee key can be user_name for user and group_id for user group. + Key *string `json:"key" validate:"required"` + + // grantee type. Values can be user_identity or tag. + Type *string `json:"type" validate:"required"` + + // grantee value can be username or group id. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the RuleGrantee.Key property. +// grantee key can be user_name for user and group_id for user group. +const ( + RuleGrantee_Key_AttributeName = "attribute_name" + RuleGrantee_Key_GroupID = "group_id" + RuleGrantee_Key_UserName = "user_name" +) + +// Constants associated with the RuleGrantee.Type property. +// grantee type. Values can be user_identity or tag. +const ( + RuleGrantee_Type_Tag = "tag" + RuleGrantee_Type_UserIdentity = "user_identity" +) + +// NewRuleGrantee : Instantiate RuleGrantee (Generic Model Constructor) +func (*WatsonxDataV3) NewRuleGrantee(key string, typeVar string, value string) (_model *RuleGrantee, err error) { + _model = &RuleGrantee{ + Key: core.StringPtr(key), + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), } - err = core.UnmarshalPrimitive(m, "status_code", &obj.StatusCode) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "status_code-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + return +} + +// UnmarshalRuleGrantee unmarshals an instance of RuleGrantee from the specified map of raw messages. +func UnmarshalRuleGrantee(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RuleGrantee) + err = core.UnmarshalPrimitive(m, "key", &obj.Key) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "key-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "type", &obj.Type) @@ -23657,947 +29051,834 @@ func UnmarshalPrestoEngine(m map[string]json.RawMessage, result interface{}) (er err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) - if err != nil { - err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "worker", &obj.Worker, UnmarshalNodeDescription) - if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// PrestoEngineCollection : List Presto engines. -type PrestoEngineCollection struct { - // Presto engine. - PrestoEngines []PrestoEngine `json:"presto_engines,omitempty"` -} - -// UnmarshalPrestoEngineCollection unmarshals an instance of PrestoEngineCollection from the specified map of raw messages. -func UnmarshalPrestoEngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestoEngineCollection) - err = core.UnmarshalModel(m, "presto_engines", &obj.PrestoEngines, UnmarshalPrestoEngine) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { - err = core.SDKErrorf(err, "", "presto_engines-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// PrestoEngineEngineProperties : Engine properties. -type PrestoEngineEngineProperties struct { - // Catalog settings. - Catalog *PrestoEnginePropertiesCatalog `json:"catalog,omitempty"` +// RuleV2 : RuleV2 struct +type RuleV2 struct { + // the actions to enforce when the data policy triggers. + Actions []string `json:"actions" validate:"required"` - // Configuration settings. - Configuration *EnginePropertiesOaiGen1Configuration `json:"configuration,omitempty"` + // defines the effect of the data policy. Values can be allow or deny. Deny will have priority over allow. + Effect *string `json:"effect,omitempty"` - // Event Listener settings. - EventListener *PrestoEnginePropertiesEventListener `json:"event_listener,omitempty"` + // the grantees to be granted. Each rule grantee contains type, key and value. Type can be user_identity or tag. key + // can be user_name, group_id or attribute_name. Value can be name of user_name or the group id of access user group. + Grantees []RuleGrantee `json:"grantees" validate:"required"` - // Global session is to accomodate all the custom properties that can be applicable for both coordinator and worker. - Global *PrestoEnginePropertiesGlobal `json:"global,omitempty"` + // Defines column-level data masking transformation properties. This schema specifies the type of masking to apply to + // sensitive data columns, optional masking conditions, and the list of users or groups (grantees) who are authorized + // to view the masked data. Column masking helps protect sensitive information while maintaining data utility for + // authorized users. + TransformColumns *TransformColumnProperties `json:"transform_columns,omitempty"` - // JVM settings. - Jvm *EnginePropertiesOaiGen1Jvm `json:"jvm,omitempty"` - - // JMX Exporter config settings. - JmxExporterConfig *PrestoEnginePropertiesJMX `json:"jmx_exporter_config,omitempty"` - - // Log Configuration settings. - LogConfig *EnginePropertiesLogConfiguration `json:"log_config,omitempty"` + // Defines row-level filtering properties for data access control. This schema specifies filter conditions that + // determine which rows of data are visible to specific users or groups (grantees). Row filtering enables fine-grained + // access control by restricting data visibility based on row attribute values, ensuring users only see data they are + // authorized to access. + TransformRows *RowFilterProperties `json:"transform_rows,omitempty"` } -// UnmarshalPrestoEngineEngineProperties unmarshals an instance of PrestoEngineEngineProperties from the specified map of raw messages. -func UnmarshalPrestoEngineEngineProperties(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestoEngineEngineProperties) - err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalPrestoEnginePropertiesCatalog) - if err != nil { - err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) - return +// Constants associated with the RuleV2.Effect property. +// defines the effect of the data policy. Values can be allow or deny. Deny will have priority over allow. +const ( + RuleV2_Effect_Allow = "allow" + RuleV2_Effect_Deny = "deny" +) + +// NewRuleV2 : Instantiate RuleV2 (Generic Model Constructor) +func (*WatsonxDataV3) NewRuleV2(actions []string, grantees []RuleGrantee) (_model *RuleV2, err error) { + _model = &RuleV2{ + Actions: actions, + Grantees: grantees, } - err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalEnginePropertiesOaiGen1Configuration) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalModel(m, "event_listener", &obj.EventListener, UnmarshalPrestoEnginePropertiesEventListener) + return +} + +// UnmarshalRuleV2 unmarshals an instance of RuleV2 from the specified map of raw messages. +func UnmarshalRuleV2(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RuleV2) + err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) if err != nil { - err = core.SDKErrorf(err, "", "event_listener-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "global", &obj.Global, UnmarshalPrestoEnginePropertiesGlobal) + err = core.UnmarshalPrimitive(m, "effect", &obj.Effect) if err != nil { - err = core.SDKErrorf(err, "", "global-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "effect-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "jvm", &obj.Jvm, UnmarshalEnginePropertiesOaiGen1Jvm) + err = core.UnmarshalModel(m, "grantees", &obj.Grantees, UnmarshalRuleGrantee) if err != nil { - err = core.SDKErrorf(err, "", "jvm-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "grantees-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "jmx_exporter_config", &obj.JmxExporterConfig, UnmarshalPrestoEnginePropertiesJMX) + err = core.UnmarshalModel(m, "transform_columns", &obj.TransformColumns, UnmarshalTransformColumnProperties) if err != nil { - err = core.SDKErrorf(err, "", "jmx_exporter_config-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "transform_columns-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "log_config", &obj.LogConfig, UnmarshalEnginePropertiesLogConfiguration) + err = core.UnmarshalModel(m, "transform_rows", &obj.TransformRows, UnmarshalRowFilterProperties) if err != nil { - err = core.SDKErrorf(err, "", "log_config-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "transform_rows-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the PrestoEngineEngineProperties -func (prestoEngineEngineProperties *PrestoEngineEngineProperties) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestoEngineEngineProperties.Catalog) { - _patch["catalog"] = prestoEngineEngineProperties.Catalog.asPatch() - } - if !core.IsNil(prestoEngineEngineProperties.Configuration) { - _patch["configuration"] = prestoEngineEngineProperties.Configuration.asPatch() - } - if !core.IsNil(prestoEngineEngineProperties.EventListener) { - _patch["event_listener"] = prestoEngineEngineProperties.EventListener.asPatch() - } - if !core.IsNil(prestoEngineEngineProperties.Global) { - _patch["global"] = prestoEngineEngineProperties.Global.asPatch() - } - if !core.IsNil(prestoEngineEngineProperties.Jvm) { - _patch["jvm"] = prestoEngineEngineProperties.Jvm.asPatch() - } - if !core.IsNil(prestoEngineEngineProperties.JmxExporterConfig) { - _patch["jmx_exporter_config"] = prestoEngineEngineProperties.JmxExporterConfig.asPatch() - } - if !core.IsNil(prestoEngineEngineProperties.LogConfig) { - _patch["log_config"] = prestoEngineEngineProperties.LogConfig.asPatch() +// RunExplainAnalyzeStatementOptions : The RunExplainAnalyzeStatement options. +type RunExplainAnalyzeStatementOptions struct { + // Engine id. + ID *string `json:"id" validate:"required,ne="` + + // Presto query to show explain analyze. + Statement *string `json:"statement" validate:"required"` + + // Verbose. + Verbose *bool `json:"verbose,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewRunExplainAnalyzeStatementOptions : Instantiate RunExplainAnalyzeStatementOptions +func (*WatsonxDataV3) NewRunExplainAnalyzeStatementOptions(id string, statement string) *RunExplainAnalyzeStatementOptions { + return &RunExplainAnalyzeStatementOptions{ + ID: core.StringPtr(id), + Statement: core.StringPtr(statement), } +} - return +// SetID : Allow user to set ID +func (_options *RunExplainAnalyzeStatementOptions) SetID(id string) *RunExplainAnalyzeStatementOptions { + _options.ID = core.StringPtr(id) + return _options } -// PrestoEnginePatch : UpdateEngine body. -type PrestoEnginePatch struct { - // Modified description. - Description *string `json:"description,omitempty"` +// SetStatement : Allow user to set Statement +func (_options *RunExplainAnalyzeStatementOptions) SetStatement(statement string) *RunExplainAnalyzeStatementOptions { + _options.Statement = core.StringPtr(statement) + return _options +} - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` +// SetVerbose : Allow user to set Verbose +func (_options *RunExplainAnalyzeStatementOptions) SetVerbose(verbose bool) *RunExplainAnalyzeStatementOptions { + _options.Verbose = core.BoolPtr(verbose) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *RunExplainAnalyzeStatementOptions) SetAuthInstanceID(authInstanceID string) *RunExplainAnalyzeStatementOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *RunExplainAnalyzeStatementOptions) SetHeaders(param map[string]string) *RunExplainAnalyzeStatementOptions { + options.Headers = param + return options +} + +// RunExplainStatementOptions : The RunExplainStatement options. +type RunExplainStatementOptions struct { + // Engine id. + ID *string `json:"id" validate:"required,ne="` + + // Presto query to determine explain plan. + Statement *string `json:"statement" validate:"required"` + + // Catalog name. + Catalog *string `json:"catalog,omitempty"` + + // Format. + Format *string `json:"format,omitempty"` + + // Schema name. + Schema *string `json:"schema,omitempty"` + + // Type. + Type *string `json:"type,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// Constants associated with the RunExplainStatementOptions.Format property. +// Format. +const ( + RunExplainStatementOptions_Format_Graphviz = "graphviz" + RunExplainStatementOptions_Format_JSON = "json" + RunExplainStatementOptions_Format_Text = "text" +) - // Engine properties. - EngineProperties *PrestoEngineEngineProperties `json:"engine_properties,omitempty"` +// Constants associated with the RunExplainStatementOptions.Type property. +// Type. +const ( + RunExplainStatementOptions_Type_Distributed = "distributed" + RunExplainStatementOptions_Type_Io = "io" + RunExplainStatementOptions_Type_Logical = "logical" + RunExplainStatementOptions_Type_Validate = "validate" +) - // Triggers engine restart if value is force. - EngineRestart *string `json:"engine_restart,omitempty"` +// NewRunExplainStatementOptions : Instantiate RunExplainStatementOptions +func (*WatsonxDataV3) NewRunExplainStatementOptions(id string, statement string) *RunExplainStatementOptions { + return &RunExplainStatementOptions{ + ID: core.StringPtr(id), + Statement: core.StringPtr(statement), + } +} - // RemoveEngine properties. - RemoveEngineProperties *PrestoEnginePatchRemoveEngineProperties `json:"remove_engine_properties,omitempty"` +// SetID : Allow user to set ID +func (_options *RunExplainStatementOptions) SetID(id string) *RunExplainStatementOptions { + _options.ID = core.StringPtr(id) + return _options +} - // Tags. - Tags []string `json:"tags,omitempty"` +// SetStatement : Allow user to set Statement +func (_options *RunExplainStatementOptions) SetStatement(statement string) *RunExplainStatementOptions { + _options.Statement = core.StringPtr(statement) + return _options } -// Constants associated with the PrestoEnginePatch.EngineRestart property. -// Triggers engine restart if value is force. -const ( - PrestoEnginePatch_EngineRestart_False = "false" - PrestoEnginePatch_EngineRestart_Force = "force" -) +// SetCatalog : Allow user to set Catalog +func (_options *RunExplainStatementOptions) SetCatalog(catalog string) *RunExplainStatementOptions { + _options.Catalog = core.StringPtr(catalog) + return _options +} -// UnmarshalPrestoEnginePatch unmarshals an instance of PrestoEnginePatch from the specified map of raw messages. -func UnmarshalPrestoEnginePatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestoEnginePatch) - err = core.UnmarshalPrimitive(m, "description", &obj.Description) - if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "engine_display_name", &obj.EngineDisplayName) - if err != nil { - err = core.SDKErrorf(err, "", "engine_display_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "engine_properties", &obj.EngineProperties, UnmarshalPrestoEngineEngineProperties) - if err != nil { - err = core.SDKErrorf(err, "", "engine_properties-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "engine_restart", &obj.EngineRestart) - if err != nil { - err = core.SDKErrorf(err, "", "engine_restart-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "remove_engine_properties", &obj.RemoveEngineProperties, UnmarshalPrestoEnginePatchRemoveEngineProperties) - if err != nil { - err = core.SDKErrorf(err, "", "remove_engine_properties-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) - if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetFormat : Allow user to set Format +func (_options *RunExplainStatementOptions) SetFormat(format string) *RunExplainStatementOptions { + _options.Format = core.StringPtr(format) + return _options } -// AsPatch returns a generic map representation of the PrestoEnginePatch -func (prestoEnginePatch *PrestoEnginePatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(prestoEnginePatch.Description) { - _patch["description"] = prestoEnginePatch.Description - } - if !core.IsNil(prestoEnginePatch.EngineDisplayName) { - _patch["engine_display_name"] = prestoEnginePatch.EngineDisplayName - } - if !core.IsNil(prestoEnginePatch.EngineProperties) { - _patch["engine_properties"] = prestoEnginePatch.EngineProperties.asPatch() - } - if !core.IsNil(prestoEnginePatch.EngineRestart) { - _patch["engine_restart"] = prestoEnginePatch.EngineRestart - } - if !core.IsNil(prestoEnginePatch.RemoveEngineProperties) { - _patch["remove_engine_properties"] = prestoEnginePatch.RemoveEngineProperties.asPatch() - } - if !core.IsNil(prestoEnginePatch.Tags) { - _patch["tags"] = prestoEnginePatch.Tags - } +// SetSchema : Allow user to set Schema +func (_options *RunExplainStatementOptions) SetSchema(schema string) *RunExplainStatementOptions { + _options.Schema = core.StringPtr(schema) + return _options +} - return +// SetType : Allow user to set Type +func (_options *RunExplainStatementOptions) SetType(typeVar string) *RunExplainStatementOptions { + _options.Type = core.StringPtr(typeVar) + return _options } -// PrestoEnginePatchRemoveEngineProperties : RemoveEngine properties. -type PrestoEnginePatchRemoveEngineProperties struct { - // Catalog settings. - Catalog *PrestoEnginePropertiesCatalog `json:"catalog,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *RunExplainStatementOptions) SetAuthInstanceID(authInstanceID string) *RunExplainStatementOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // Configuration settings for removing engine properties. - Configuration *RemoveEnginePropertiesOaiGenConfiguration `json:"configuration,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *RunExplainStatementOptions) SetHeaders(param map[string]string) *RunExplainStatementOptions { + options.Headers = param + return options +} - // JVM properties. - Jvm *RemoveEnginePropertiesOaiGenJvm `json:"jvm,omitempty"` +// RunPrestissimoExplainAnalyzeStatementOptions : The RunPrestissimoExplainAnalyzeStatement options. +type RunPrestissimoExplainAnalyzeStatementOptions struct { + // Engine id. + ID *string `json:"id" validate:"required,ne="` - EventListener []string `json:"event_listener,omitempty"` + // Presto query to show explain analyze. + Statement *string `json:"statement" validate:"required"` - Global []string `json:"global,omitempty"` + // Verbose. + Verbose *bool `json:"verbose,omitempty"` - JmxExporterConfig []string `json:"jmx_exporter_config,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // JVM properties. - LogConfig *RemoveEnginePropertiesLogConfig `json:"log_config,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalPrestoEnginePatchRemoveEngineProperties unmarshals an instance of PrestoEnginePatchRemoveEngineProperties from the specified map of raw messages. -func UnmarshalPrestoEnginePatchRemoveEngineProperties(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestoEnginePatchRemoveEngineProperties) - err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalPrestoEnginePropertiesCatalog) - if err != nil { - err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalRemoveEnginePropertiesOaiGenConfiguration) - if err != nil { - err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "jvm", &obj.Jvm, UnmarshalRemoveEnginePropertiesOaiGenJvm) - if err != nil { - err = core.SDKErrorf(err, "", "jvm-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "event_listener", &obj.EventListener) - if err != nil { - err = core.SDKErrorf(err, "", "event_listener-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "global", &obj.Global) - if err != nil { - err = core.SDKErrorf(err, "", "global-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "jmx_exporter_config", &obj.JmxExporterConfig) - if err != nil { - err = core.SDKErrorf(err, "", "jmx_exporter_config-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "log_config", &obj.LogConfig, UnmarshalRemoveEnginePropertiesLogConfig) - if err != nil { - err = core.SDKErrorf(err, "", "log_config-error", common.GetComponentInfo()) - return +// NewRunPrestissimoExplainAnalyzeStatementOptions : Instantiate RunPrestissimoExplainAnalyzeStatementOptions +func (*WatsonxDataV3) NewRunPrestissimoExplainAnalyzeStatementOptions(id string, statement string) *RunPrestissimoExplainAnalyzeStatementOptions { + return &RunPrestissimoExplainAnalyzeStatementOptions{ + ID: core.StringPtr(id), + Statement: core.StringPtr(statement), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// asPatch returns a generic map representation of the PrestoEnginePatchRemoveEngineProperties -func (prestoEnginePatchRemoveEngineProperties *PrestoEnginePatchRemoveEngineProperties) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestoEnginePatchRemoveEngineProperties.Catalog) { - _patch["catalog"] = prestoEnginePatchRemoveEngineProperties.Catalog.asPatch() - } - if !core.IsNil(prestoEnginePatchRemoveEngineProperties.Configuration) { - _patch["configuration"] = prestoEnginePatchRemoveEngineProperties.Configuration.asPatch() - } - if !core.IsNil(prestoEnginePatchRemoveEngineProperties.Jvm) { - _patch["jvm"] = prestoEnginePatchRemoveEngineProperties.Jvm.asPatch() - } - if !core.IsNil(prestoEnginePatchRemoveEngineProperties.EventListener) { - _patch["event_listener"] = prestoEnginePatchRemoveEngineProperties.EventListener - } - if !core.IsNil(prestoEnginePatchRemoveEngineProperties.Global) { - _patch["global"] = prestoEnginePatchRemoveEngineProperties.Global - } - if !core.IsNil(prestoEnginePatchRemoveEngineProperties.JmxExporterConfig) { - _patch["jmx_exporter_config"] = prestoEnginePatchRemoveEngineProperties.JmxExporterConfig - } - if !core.IsNil(prestoEnginePatchRemoveEngineProperties.LogConfig) { - _patch["log_config"] = prestoEnginePatchRemoveEngineProperties.LogConfig.asPatch() - } - - return +// SetID : Allow user to set ID +func (_options *RunPrestissimoExplainAnalyzeStatementOptions) SetID(id string) *RunPrestissimoExplainAnalyzeStatementOptions { + _options.ID = core.StringPtr(id) + return _options } -// PrestoEnginePropertiesCatalog : Catalog settings. -type PrestoEnginePropertiesCatalog struct { - // Catalog settings. - CatalogName *EnginePropertiesCatalog `json:"catalog_name,omitempty"` +// SetStatement : Allow user to set Statement +func (_options *RunPrestissimoExplainAnalyzeStatementOptions) SetStatement(statement string) *RunPrestissimoExplainAnalyzeStatementOptions { + _options.Statement = core.StringPtr(statement) + return _options } -// UnmarshalPrestoEnginePropertiesCatalog unmarshals an instance of PrestoEnginePropertiesCatalog from the specified map of raw messages. -func UnmarshalPrestoEnginePropertiesCatalog(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestoEnginePropertiesCatalog) - err = core.UnmarshalModel(m, "catalog_name", &obj.CatalogName, UnmarshalEnginePropertiesCatalog) - if err != nil { - err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetVerbose : Allow user to set Verbose +func (_options *RunPrestissimoExplainAnalyzeStatementOptions) SetVerbose(verbose bool) *RunPrestissimoExplainAnalyzeStatementOptions { + _options.Verbose = core.BoolPtr(verbose) + return _options } -// asPatch returns a generic map representation of the PrestoEnginePropertiesCatalog -func (prestoEnginePropertiesCatalog *PrestoEnginePropertiesCatalog) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestoEnginePropertiesCatalog.CatalogName) { - _patch["catalog_name"] = prestoEnginePropertiesCatalog.CatalogName.asPatch() - } - - return +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *RunPrestissimoExplainAnalyzeStatementOptions) SetAuthInstanceID(authInstanceID string) *RunPrestissimoExplainAnalyzeStatementOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options } -// PrestoEnginePropertiesEventListener : Event Listener settings. -type PrestoEnginePropertiesEventListener struct { - // Event listener properties. - EventListenerProperty *string `json:"event_listener_property,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *RunPrestissimoExplainAnalyzeStatementOptions) SetHeaders(param map[string]string) *RunPrestissimoExplainAnalyzeStatementOptions { + options.Headers = param + return options } -// UnmarshalPrestoEnginePropertiesEventListener unmarshals an instance of PrestoEnginePropertiesEventListener from the specified map of raw messages. -func UnmarshalPrestoEnginePropertiesEventListener(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestoEnginePropertiesEventListener) - err = core.UnmarshalPrimitive(m, "event_listener_property", &obj.EventListenerProperty) - if err != nil { - err = core.SDKErrorf(err, "", "event_listener_property-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} +// RunPrestissimoExplainStatementOptions : The RunPrestissimoExplainStatement options. +type RunPrestissimoExplainStatementOptions struct { + // Engine id. + ID *string `json:"id" validate:"required,ne="` -// asPatch returns a generic map representation of the PrestoEnginePropertiesEventListener -func (prestoEnginePropertiesEventListener *PrestoEnginePropertiesEventListener) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestoEnginePropertiesEventListener.EventListenerProperty) { - _patch["event_listener_property"] = prestoEnginePropertiesEventListener.EventListenerProperty - } + // Presto query to determine explain plan. + Statement *string `json:"statement" validate:"required"` - return -} + // Catalog name. + Catalog *string `json:"catalog,omitempty"` + + // Format. + Format *string `json:"format,omitempty"` + + // Schema name. + Schema *string `json:"schema,omitempty"` + + // Type. + Type *string `json:"type,omitempty"` -// PrestoEnginePropertiesGlobal : Global session is to accomodate all the custom properties that can be applicable for both coordinator and worker. -type PrestoEnginePropertiesGlobal struct { - // Global property settings. - GlobalProperty *string `json:"global_property,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalPrestoEnginePropertiesGlobal unmarshals an instance of PrestoEnginePropertiesGlobal from the specified map of raw messages. -func UnmarshalPrestoEnginePropertiesGlobal(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestoEnginePropertiesGlobal) - err = core.UnmarshalPrimitive(m, "global_property", &obj.GlobalProperty) - if err != nil { - err = core.SDKErrorf(err, "", "global_property-error", common.GetComponentInfo()) - return +// Constants associated with the RunPrestissimoExplainStatementOptions.Format property. +// Format. +const ( + RunPrestissimoExplainStatementOptions_Format_Graphviz = "graphviz" + RunPrestissimoExplainStatementOptions_Format_JSON = "json" + RunPrestissimoExplainStatementOptions_Format_Text = "text" +) + +// Constants associated with the RunPrestissimoExplainStatementOptions.Type property. +// Type. +const ( + RunPrestissimoExplainStatementOptions_Type_Distributed = "distributed" + RunPrestissimoExplainStatementOptions_Type_Io = "io" + RunPrestissimoExplainStatementOptions_Type_Logical = "logical" + RunPrestissimoExplainStatementOptions_Type_Validate = "validate" +) + +// NewRunPrestissimoExplainStatementOptions : Instantiate RunPrestissimoExplainStatementOptions +func (*WatsonxDataV3) NewRunPrestissimoExplainStatementOptions(id string, statement string) *RunPrestissimoExplainStatementOptions { + return &RunPrestissimoExplainStatementOptions{ + ID: core.StringPtr(id), + Statement: core.StringPtr(statement), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// asPatch returns a generic map representation of the PrestoEnginePropertiesGlobal -func (prestoEnginePropertiesGlobal *PrestoEnginePropertiesGlobal) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestoEnginePropertiesGlobal.GlobalProperty) { - _patch["global_property"] = prestoEnginePropertiesGlobal.GlobalProperty - } +// SetID : Allow user to set ID +func (_options *RunPrestissimoExplainStatementOptions) SetID(id string) *RunPrestissimoExplainStatementOptions { + _options.ID = core.StringPtr(id) + return _options +} - return +// SetStatement : Allow user to set Statement +func (_options *RunPrestissimoExplainStatementOptions) SetStatement(statement string) *RunPrestissimoExplainStatementOptions { + _options.Statement = core.StringPtr(statement) + return _options } -// PrestoEnginePropertiesJMX : JMX Exporter config settings. -type PrestoEnginePropertiesJMX struct { - // JMX Exporter config settings. - GlobalProperty *string `json:"global_property,omitempty"` +// SetCatalog : Allow user to set Catalog +func (_options *RunPrestissimoExplainStatementOptions) SetCatalog(catalog string) *RunPrestissimoExplainStatementOptions { + _options.Catalog = core.StringPtr(catalog) + return _options } -// UnmarshalPrestoEnginePropertiesJMX unmarshals an instance of PrestoEnginePropertiesJMX from the specified map of raw messages. -func UnmarshalPrestoEnginePropertiesJMX(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PrestoEnginePropertiesJMX) - err = core.UnmarshalPrimitive(m, "global_property", &obj.GlobalProperty) - if err != nil { - err = core.SDKErrorf(err, "", "global_property-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetFormat : Allow user to set Format +func (_options *RunPrestissimoExplainStatementOptions) SetFormat(format string) *RunPrestissimoExplainStatementOptions { + _options.Format = core.StringPtr(format) + return _options } -// asPatch returns a generic map representation of the PrestoEnginePropertiesJMX -func (prestoEnginePropertiesJMX *PrestoEnginePropertiesJMX) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(prestoEnginePropertiesJMX.GlobalProperty) { - _patch["global_property"] = prestoEnginePropertiesJMX.GlobalProperty - } - - return +// SetSchema : Allow user to set Schema +func (_options *RunPrestissimoExplainStatementOptions) SetSchema(schema string) *RunPrestissimoExplainStatementOptions { + _options.Schema = core.StringPtr(schema) + return _options } -// PreviewIngestionFile : Schema of the data in the source file. -type PreviewIngestionFile struct { - // Array of column names of the table. - ColumnNames []string `json:"column_names" validate:"required"` - - // Array of column types of the table. - ColumnTypes []string `json:"column_types" validate:"required"` - - // Name of the file being previewed. - FileName *string `json:"file_name" validate:"required"` +// SetType : Allow user to set Type +func (_options *RunPrestissimoExplainStatementOptions) SetType(typeVar string) *RunPrestissimoExplainStatementOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} - // First 10 rows of the table. - Rows *PreviewIngestionFileRows `json:"rows" validate:"required"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *RunPrestissimoExplainStatementOptions) SetAuthInstanceID(authInstanceID string) *RunPrestissimoExplainStatementOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options } -// UnmarshalPreviewIngestionFile unmarshals an instance of PreviewIngestionFile from the specified map of raw messages. -func UnmarshalPreviewIngestionFile(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PreviewIngestionFile) - err = core.UnmarshalPrimitive(m, "column_names", &obj.ColumnNames) - if err != nil { - err = core.SDKErrorf(err, "", "column_names-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "column_types", &obj.ColumnTypes) - if err != nil { - err = core.SDKErrorf(err, "", "column_types-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "file_name", &obj.FileName) - if err != nil { - err = core.SDKErrorf(err, "", "file_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "rows", &obj.Rows, UnmarshalPreviewIngestionFileRows) - if err != nil { - err = core.SDKErrorf(err, "", "rows-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetHeaders : Allow user to set Headers +func (options *RunPrestissimoExplainStatementOptions) SetHeaders(param map[string]string) *RunPrestissimoExplainStatementOptions { + options.Headers = param + return options } -// PreviewIngestionFilePrototypeCsvProperty : CSV properties of source file(s). -type PreviewIngestionFilePrototypeCsvProperty struct { - // Encoding used in CSV file. - Encoding *string `json:"encoding,omitempty"` +// SalEnrichmentDataAsset : SAL encrichmed asset in IKC associated with table in Watsonx.data. +type SalEnrichmentDataAsset struct { + // attributes of the asset. + Attributes []string `json:"attributes" validate:"required"` - // Escape character of CSV file. - EscapeCharacter *string `json:"escape_character,omitempty"` + // data asset id in IKC. + ID *string `json:"id,omitempty"` - // Field delimiter of CSV file. - FieldDelimiter *string `json:"field_delimiter,omitempty"` + // asset name (table name). + Name *string `json:"name,omitempty"` - // Identify if header exists in CSV file. - Header *bool `json:"header,omitempty"` + // unique resource name of IKC asset. + ResourceKey *string `json:"resource_key,omitempty"` - // Line delimiter of CSV file. - LineDelimiter *string `json:"line_delimiter,omitempty"` + // schema name. + SchemaName *string `json:"schema_name,omitempty"` } -// UnmarshalPreviewIngestionFilePrototypeCsvProperty unmarshals an instance of PreviewIngestionFilePrototypeCsvProperty from the specified map of raw messages. -func UnmarshalPreviewIngestionFilePrototypeCsvProperty(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PreviewIngestionFilePrototypeCsvProperty) - err = core.UnmarshalPrimitive(m, "encoding", &obj.Encoding) +// UnmarshalSalEnrichmentDataAsset unmarshals an instance of SalEnrichmentDataAsset from the specified map of raw messages. +func UnmarshalSalEnrichmentDataAsset(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalEnrichmentDataAsset) + err = core.UnmarshalPrimitive(m, "attributes", &obj.Attributes) if err != nil { - err = core.SDKErrorf(err, "", "encoding-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "attributes-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "escape_character", &obj.EscapeCharacter) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "escape_character-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "field_delimiter", &obj.FieldDelimiter) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "field_delimiter-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "header", &obj.Header) + err = core.UnmarshalPrimitive(m, "resource_key", &obj.ResourceKey) if err != nil { - err = core.SDKErrorf(err, "", "header-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_key-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "line_delimiter", &obj.LineDelimiter) + err = core.UnmarshalPrimitive(m, "schema_name", &obj.SchemaName) if err != nil { - err = core.SDKErrorf(err, "", "line_delimiter-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "schema_name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// PreviewIngestionFileRows : First 10 rows of the table. -type PreviewIngestionFileRows struct { - // Each rows slice. - RowEight []string `json:"row_eight,omitempty"` - - // Each rows slice. - RowFive []string `json:"row_five,omitempty"` - - // Each rows slice. - RowFour []string `json:"row_four,omitempty"` - - // Each rows slice. - RowNine []string `json:"row_nine,omitempty"` - - // Each rows slice. - RowOne []string `json:"row_one,omitempty"` - - // Each rows slice. - RowSeven []string `json:"row_seven,omitempty"` - - // Each rows slice. - RowSix []string `json:"row_six,omitempty"` - - // Each rows slice. - RowTen []string `json:"row_ten,omitempty"` - - // Each rows slice. - RowThree []string `json:"row_three,omitempty"` - - // Each rows slice. - RowTwo []string `json:"row_two,omitempty"` +// SalEnrichmentDataAssetCollection : Collection if SAL enriched assets in IKC. +type SalEnrichmentDataAssetCollection struct { + // list of enrichment asset in IKC. + DataAssets []SalEnrichmentDataAsset `json:"data_assets" validate:"required"` } -// UnmarshalPreviewIngestionFileRows unmarshals an instance of PreviewIngestionFileRows from the specified map of raw messages. -func UnmarshalPreviewIngestionFileRows(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PreviewIngestionFileRows) - err = core.UnmarshalPrimitive(m, "row_eight", &obj.RowEight) - if err != nil { - err = core.SDKErrorf(err, "", "row_eight-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "row_five", &obj.RowFive) - if err != nil { - err = core.SDKErrorf(err, "", "row_five-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "row_four", &obj.RowFour) - if err != nil { - err = core.SDKErrorf(err, "", "row_four-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "row_nine", &obj.RowNine) - if err != nil { - err = core.SDKErrorf(err, "", "row_nine-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "row_one", &obj.RowOne) - if err != nil { - err = core.SDKErrorf(err, "", "row_one-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "row_seven", &obj.RowSeven) - if err != nil { - err = core.SDKErrorf(err, "", "row_seven-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "row_six", &obj.RowSix) - if err != nil { - err = core.SDKErrorf(err, "", "row_six-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "row_ten", &obj.RowTen) +// UnmarshalSalEnrichmentDataAssetCollection unmarshals an instance of SalEnrichmentDataAssetCollection from the specified map of raw messages. +func UnmarshalSalEnrichmentDataAssetCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalEnrichmentDataAssetCollection) + err = core.UnmarshalModel(m, "data_assets", &obj.DataAssets, UnmarshalSalEnrichmentDataAsset) if err != nil { - err = core.SDKErrorf(err, "", "row_ten-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "data_assets-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "row_three", &obj.RowThree) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SalEnrichmentJobRunLogs : collection of the enrichment job run log results. +type SalEnrichmentJobRunLogs struct { + // response from enrichment job run log request. + Results []string `json:"results" validate:"required"` + + // name. + TotalCount *int64 `json:"total_count,omitempty"` +} + +// UnmarshalSalEnrichmentJobRunLogs unmarshals an instance of SalEnrichmentJobRunLogs from the specified map of raw messages. +func UnmarshalSalEnrichmentJobRunLogs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalEnrichmentJobRunLogs) + err = core.UnmarshalPrimitive(m, "results", &obj.Results) if err != nil { - err = core.SDKErrorf(err, "", "row_three-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "results-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "row_two", &obj.RowTwo) + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) if err != nil { - err = core.SDKErrorf(err, "", "row_two-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// RegisterTableCreatedBody : success response. -type RegisterTableCreatedBody struct { - // Response of success. - Response *SuccessResponse `json:"response,omitempty"` +// SalEnrichmentJobRuns : Collection of job runs for a specific enrichment job. +type SalEnrichmentJobRuns struct { + // list of job runs as response. + Runs []string `json:"runs" validate:"required"` } -// UnmarshalRegisterTableCreatedBody unmarshals an instance of RegisterTableCreatedBody from the specified map of raw messages. -func UnmarshalRegisterTableCreatedBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RegisterTableCreatedBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) +// UnmarshalSalEnrichmentJobRuns unmarshals an instance of SalEnrichmentJobRuns from the specified map of raw messages. +func UnmarshalSalEnrichmentJobRuns(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalEnrichmentJobRuns) + err = core.UnmarshalPrimitive(m, "runs", &obj.Runs) if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "runs-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// RegisterTableOptions : The RegisterTable options. -type RegisterTableOptions struct { - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` - - // URL encoded schema name. - SchemaID *string `json:"schema_id" validate:"required,ne="` - - // Metadata location. - MetadataLocation *string `json:"metadata_location" validate:"required"` - - // Table name. - TableName *string `json:"table_name" validate:"required"` - - // watsonx.data CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string +// SalEnrichmentJobs : Collection of SAL integration enrichment jobs. +type SalEnrichmentJobs struct { + // list of enrichment jobs. + Jobs []string `json:"jobs" validate:"required"` } -// NewRegisterTableOptions : Instantiate RegisterTableOptions -func (*WatsonxDataV2) NewRegisterTableOptions(catalogID string, schemaID string, metadataLocation string, tableName string) *RegisterTableOptions { - return &RegisterTableOptions{ - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - MetadataLocation: core.StringPtr(metadataLocation), - TableName: core.StringPtr(tableName), +// UnmarshalSalEnrichmentJobs unmarshals an instance of SalEnrichmentJobs from the specified map of raw messages. +func UnmarshalSalEnrichmentJobs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalEnrichmentJobs) + err = core.UnmarshalPrimitive(m, "jobs", &obj.Jobs) + if err != nil { + err = core.SDKErrorf(err, "", "jobs-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetCatalogID : Allow user to set CatalogID -func (_options *RegisterTableOptions) SetCatalogID(catalogID string) *RegisterTableOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options -} - -// SetSchemaID : Allow user to set SchemaID -func (_options *RegisterTableOptions) SetSchemaID(schemaID string) *RegisterTableOptions { - _options.SchemaID = core.StringPtr(schemaID) - return _options -} - -// SetMetadataLocation : Allow user to set MetadataLocation -func (_options *RegisterTableOptions) SetMetadataLocation(metadataLocation string) *RegisterTableOptions { - _options.MetadataLocation = core.StringPtr(metadataLocation) - return _options -} - -// SetTableName : Allow user to set TableName -func (_options *RegisterTableOptions) SetTableName(tableName string) *RegisterTableOptions { - _options.TableName = core.StringPtr(tableName) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *RegisterTableOptions) SetAuthInstanceID(authInstanceID string) *RegisterTableOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} - -// SetHeaders : Allow user to set Headers -func (options *RegisterTableOptions) SetHeaders(param map[string]string) *RegisterTableOptions { - options.Headers = param - return options -} - -// RemoveEngineProperties : RemoveEngine properties. -type RemoveEngineProperties struct { - // Catalog settings. - Catalog *PrestissimoEnginePropertiesCatalog `json:"catalog,omitempty"` - - // remove engine properties configuration. - Configuration *RemoveEnginePropertiesConfiguration `json:"configuration,omitempty"` - - // JVM properties. - Jvm *RemoveEnginePropertiesPrestissimoOaiGenJvm `json:"jvm,omitempty"` +// SalEnrichmentSettings : Request payload object of SAL Integration Enrichment Global Settings. +type SalEnrichmentSettings struct { + // semantic expansion. + Expansion *SalEnrichmentSettingsExpansion `json:"expansion" validate:"required"` - // velox description. - Velox []string `json:"velox,omitempty"` + // semantic expansion. + TermAssignment *SalEnrichmentSettingsTermAssignment `json:"term_assignment" validate:"required"` } -// UnmarshalRemoveEngineProperties unmarshals an instance of RemoveEngineProperties from the specified map of raw messages. -func UnmarshalRemoveEngineProperties(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RemoveEngineProperties) - err = core.UnmarshalModel(m, "catalog", &obj.Catalog, UnmarshalPrestissimoEnginePropertiesCatalog) - if err != nil { - err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) - return +// NewSalEnrichmentSettings : Instantiate SalEnrichmentSettings (Generic Model Constructor) +func (*WatsonxDataV3) NewSalEnrichmentSettings(expansion *SalEnrichmentSettingsExpansion, termAssignment *SalEnrichmentSettingsTermAssignment) (_model *SalEnrichmentSettings, err error) { + _model = &SalEnrichmentSettings{ + Expansion: expansion, + TermAssignment: termAssignment, } - err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalRemoveEnginePropertiesConfiguration) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalModel(m, "jvm", &obj.Jvm, UnmarshalRemoveEnginePropertiesPrestissimoOaiGenJvm) + return +} + +// UnmarshalSalEnrichmentSettings unmarshals an instance of SalEnrichmentSettings from the specified map of raw messages. +func UnmarshalSalEnrichmentSettings(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalEnrichmentSettings) + err = core.UnmarshalModel(m, "expansion", &obj.Expansion, UnmarshalSalEnrichmentSettingsExpansion) if err != nil { - err = core.SDKErrorf(err, "", "jvm-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "expansion-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "velox", &obj.Velox) + err = core.UnmarshalModel(m, "term_assignment", &obj.TermAssignment, UnmarshalSalEnrichmentSettingsTermAssignment) if err != nil { - err = core.SDKErrorf(err, "", "velox-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "term_assignment-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the RemoveEngineProperties -func (removeEngineProperties *RemoveEngineProperties) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(removeEngineProperties.Catalog) { - _patch["catalog"] = removeEngineProperties.Catalog.asPatch() - } - if !core.IsNil(removeEngineProperties.Configuration) { - _patch["configuration"] = removeEngineProperties.Configuration.asPatch() - } - if !core.IsNil(removeEngineProperties.Jvm) { - _patch["jvm"] = removeEngineProperties.Jvm.asPatch() - } - if !core.IsNil(removeEngineProperties.Velox) { - _patch["velox"] = removeEngineProperties.Velox - } +// SalEnrichmentSettingsExpansion : semantic expansion. +type SalEnrichmentSettingsExpansion struct { + // if enable description generation (generate semantic description). + Description *bool `json:"description" validate:"required"` - return -} + // description generation configuration. + DescriptionConfiguration *SalEnrichmentSettingsExpansionDescriptionConfiguration `json:"description_configuration" validate:"required"` -// RemoveEnginePropertiesConfiguration : remove engine properties configuration. -type RemoveEnginePropertiesConfiguration struct { - // description for coordinator property. - Coordinator []string `json:"coordinator,omitempty"` + // if enable name expansion (generate semantic name). + Name *bool `json:"name" validate:"required"` - // description for worker property. - Worker []string `json:"worker,omitempty"` + // if enable name expansion configuration. + NameConfiguration *SalEnrichmentSettingsExpansionNameConfiguration `json:"name_configuration" validate:"required"` } -// UnmarshalRemoveEnginePropertiesConfiguration unmarshals an instance of RemoveEnginePropertiesConfiguration from the specified map of raw messages. -func UnmarshalRemoveEnginePropertiesConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RemoveEnginePropertiesConfiguration) - err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) - if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) - return +// NewSalEnrichmentSettingsExpansion : Instantiate SalEnrichmentSettingsExpansion (Generic Model Constructor) +func (*WatsonxDataV3) NewSalEnrichmentSettingsExpansion(description bool, descriptionConfiguration *SalEnrichmentSettingsExpansionDescriptionConfiguration, name bool, nameConfiguration *SalEnrichmentSettingsExpansionNameConfiguration) (_model *SalEnrichmentSettingsExpansion, err error) { + _model = &SalEnrichmentSettingsExpansion{ + Description: core.BoolPtr(description), + DescriptionConfiguration: descriptionConfiguration, + Name: core.BoolPtr(name), + NameConfiguration: nameConfiguration, } - err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the RemoveEnginePropertiesConfiguration -func (removeEnginePropertiesConfiguration *RemoveEnginePropertiesConfiguration) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(removeEnginePropertiesConfiguration.Coordinator) { - _patch["coordinator"] = removeEnginePropertiesConfiguration.Coordinator +// UnmarshalSalEnrichmentSettingsExpansion unmarshals an instance of SalEnrichmentSettingsExpansion from the specified map of raw messages. +func UnmarshalSalEnrichmentSettingsExpansion(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalEnrichmentSettingsExpansion) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "description_configuration", &obj.DescriptionConfiguration, UnmarshalSalEnrichmentSettingsExpansionDescriptionConfiguration) + if err != nil { + err = core.SDKErrorf(err, "", "description_configuration-error", common.GetComponentInfo()) + return } - if !core.IsNil(removeEnginePropertiesConfiguration.Worker) { - _patch["worker"] = removeEnginePropertiesConfiguration.Worker + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return } - + err = core.UnmarshalModel(m, "name_configuration", &obj.NameConfiguration, UnmarshalSalEnrichmentSettingsExpansionNameConfiguration) + if err != nil { + err = core.SDKErrorf(err, "", "name_configuration-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// RemoveEnginePropertiesLogConfig : JVM properties. -type RemoveEnginePropertiesLogConfig struct { - // List of coordinator properties. - Coordinator []string `json:"coordinator,omitempty"` +// SalEnrichmentSettingsExpansionDescriptionConfiguration : description generation configuration. +type SalEnrichmentSettingsExpansionDescriptionConfiguration struct { + // assignment threshold (auto accept the semantic description). + AssignmentThreshold *float64 `json:"assignment_threshold,omitempty"` - // List of worker properties. - Worker []string `json:"worker,omitempty"` + // suggestion threshold (suggestion visible as semantic description). + SuggestionThreshold *float64 `json:"suggestion_threshold,omitempty"` } -// UnmarshalRemoveEnginePropertiesLogConfig unmarshals an instance of RemoveEnginePropertiesLogConfig from the specified map of raw messages. -func UnmarshalRemoveEnginePropertiesLogConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RemoveEnginePropertiesLogConfig) - err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) +// UnmarshalSalEnrichmentSettingsExpansionDescriptionConfiguration unmarshals an instance of SalEnrichmentSettingsExpansionDescriptionConfiguration from the specified map of raw messages. +func UnmarshalSalEnrichmentSettingsExpansionDescriptionConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalEnrichmentSettingsExpansionDescriptionConfiguration) + err = core.UnmarshalPrimitive(m, "assignment_threshold", &obj.AssignmentThreshold) if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "assignment_threshold-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + err = core.UnmarshalPrimitive(m, "suggestion_threshold", &obj.SuggestionThreshold) if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "suggestion_threshold-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the RemoveEnginePropertiesLogConfig -func (removeEnginePropertiesLogConfig *RemoveEnginePropertiesLogConfig) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(removeEnginePropertiesLogConfig.Coordinator) { - _patch["coordinator"] = removeEnginePropertiesLogConfig.Coordinator - } - if !core.IsNil(removeEnginePropertiesLogConfig.Worker) { - _patch["worker"] = removeEnginePropertiesLogConfig.Worker - } +// SalEnrichmentSettingsExpansionNameConfiguration : if enable name expansion configuration. +type SalEnrichmentSettingsExpansionNameConfiguration struct { + // assignment threshold (auto accept the semantic name). + AssignmentThreshold *float64 `json:"assignment_threshold" validate:"required"` - return + // suggestion threshold (suggestion visible as semantic name). + SuggestionThreshold *float64 `json:"suggestion_threshold" validate:"required"` } -// RemoveEnginePropertiesOaiGenConfiguration : Configuration settings for removing engine properties. -type RemoveEnginePropertiesOaiGenConfiguration struct { - // List of coordinator properties. - Coordinator []string `json:"coordinator,omitempty"` - - // List of worker properties. - Worker []string `json:"worker,omitempty"` +// NewSalEnrichmentSettingsExpansionNameConfiguration : Instantiate SalEnrichmentSettingsExpansionNameConfiguration (Generic Model Constructor) +func (*WatsonxDataV3) NewSalEnrichmentSettingsExpansionNameConfiguration(assignmentThreshold float64, suggestionThreshold float64) (_model *SalEnrichmentSettingsExpansionNameConfiguration, err error) { + _model = &SalEnrichmentSettingsExpansionNameConfiguration{ + AssignmentThreshold: core.Float64Ptr(assignmentThreshold), + SuggestionThreshold: core.Float64Ptr(suggestionThreshold), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return } -// UnmarshalRemoveEnginePropertiesOaiGenConfiguration unmarshals an instance of RemoveEnginePropertiesOaiGenConfiguration from the specified map of raw messages. -func UnmarshalRemoveEnginePropertiesOaiGenConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RemoveEnginePropertiesOaiGenConfiguration) - err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) +// UnmarshalSalEnrichmentSettingsExpansionNameConfiguration unmarshals an instance of SalEnrichmentSettingsExpansionNameConfiguration from the specified map of raw messages. +func UnmarshalSalEnrichmentSettingsExpansionNameConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalEnrichmentSettingsExpansionNameConfiguration) + err = core.UnmarshalPrimitive(m, "assignment_threshold", &obj.AssignmentThreshold) if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "assignment_threshold-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + err = core.UnmarshalPrimitive(m, "suggestion_threshold", &obj.SuggestionThreshold) if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "suggestion_threshold-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the RemoveEnginePropertiesOaiGenConfiguration -func (removeEnginePropertiesOaiGenConfiguration *RemoveEnginePropertiesOaiGenConfiguration) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(removeEnginePropertiesOaiGenConfiguration.Coordinator) { - _patch["coordinator"] = removeEnginePropertiesOaiGenConfiguration.Coordinator - } - if !core.IsNil(removeEnginePropertiesOaiGenConfiguration.Worker) { - _patch["worker"] = removeEnginePropertiesOaiGenConfiguration.Worker - } +// SalEnrichmentSettingsTermAssignment : semantic expansion. +type SalEnrichmentSettingsTermAssignment struct { + // if use class based assignments. + ClassBasedAssignments *bool `json:"class_based_assignments" validate:"required"` - return -} + // if enable evaluate negative assignments. + EvaluateNegativeAssignments *bool `json:"evaluate_negative_assignments" validate:"required"` -// RemoveEnginePropertiesOaiGenJvm : JVM properties. -type RemoveEnginePropertiesOaiGenJvm struct { - // List of coordinator properties. - Coordinator []string `json:"coordinator,omitempty"` + // if enable llm based assignments. + LlmBasedAssignments *bool `json:"llm_based_assignments" validate:"required"` - // List of worker properties. - Worker []string `json:"worker,omitempty"` + // if enable machinelearning based assignments custom. + MlBasedAssignmentsCustom *bool `json:"ml_based_assignments_custom" validate:"required"` + + // if enable machinelearning based assignments default. + MlBasedAssignmentsDefault *bool `json:"ml_based_assignments_default" validate:"required"` + + // if assign by name matching. + NameMatching *bool `json:"name_matching" validate:"required"` + + // term assignment threshold. + TermAssignmentThreshold *float64 `json:"term_assignment_threshold" validate:"required"` + + // term suggestion threshold. + TermSuggestionThreshold *float64 `json:"term_suggestion_threshold" validate:"required"` } -// UnmarshalRemoveEnginePropertiesOaiGenJvm unmarshals an instance of RemoveEnginePropertiesOaiGenJvm from the specified map of raw messages. -func UnmarshalRemoveEnginePropertiesOaiGenJvm(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RemoveEnginePropertiesOaiGenJvm) - err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) - if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) - return +// NewSalEnrichmentSettingsTermAssignment : Instantiate SalEnrichmentSettingsTermAssignment (Generic Model Constructor) +func (*WatsonxDataV3) NewSalEnrichmentSettingsTermAssignment(classBasedAssignments bool, evaluateNegativeAssignments bool, llmBasedAssignments bool, mlBasedAssignmentsCustom bool, mlBasedAssignmentsDefault bool, nameMatching bool, termAssignmentThreshold float64, termSuggestionThreshold float64) (_model *SalEnrichmentSettingsTermAssignment, err error) { + _model = &SalEnrichmentSettingsTermAssignment{ + ClassBasedAssignments: core.BoolPtr(classBasedAssignments), + EvaluateNegativeAssignments: core.BoolPtr(evaluateNegativeAssignments), + LlmBasedAssignments: core.BoolPtr(llmBasedAssignments), + MlBasedAssignmentsCustom: core.BoolPtr(mlBasedAssignmentsCustom), + MlBasedAssignmentsDefault: core.BoolPtr(mlBasedAssignmentsDefault), + NameMatching: core.BoolPtr(nameMatching), + TermAssignmentThreshold: core.Float64Ptr(termAssignmentThreshold), + TermSuggestionThreshold: core.Float64Ptr(termSuggestionThreshold), } - err = core.UnmarshalPrimitive(m, "worker", &obj.Worker) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "worker-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the RemoveEnginePropertiesOaiGenJvm -func (removeEnginePropertiesOaiGenJvm *RemoveEnginePropertiesOaiGenJvm) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(removeEnginePropertiesOaiGenJvm.Coordinator) { - _patch["coordinator"] = removeEnginePropertiesOaiGenJvm.Coordinator +// UnmarshalSalEnrichmentSettingsTermAssignment unmarshals an instance of SalEnrichmentSettingsTermAssignment from the specified map of raw messages. +func UnmarshalSalEnrichmentSettingsTermAssignment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalEnrichmentSettingsTermAssignment) + err = core.UnmarshalPrimitive(m, "class_based_assignments", &obj.ClassBasedAssignments) + if err != nil { + err = core.SDKErrorf(err, "", "class_based_assignments-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "evaluate_negative_assignments", &obj.EvaluateNegativeAssignments) + if err != nil { + err = core.SDKErrorf(err, "", "evaluate_negative_assignments-error", common.GetComponentInfo()) + return } - if !core.IsNil(removeEnginePropertiesOaiGenJvm.Worker) { - _patch["worker"] = removeEnginePropertiesOaiGenJvm.Worker + err = core.UnmarshalPrimitive(m, "llm_based_assignments", &obj.LlmBasedAssignments) + if err != nil { + err = core.SDKErrorf(err, "", "llm_based_assignments-error", common.GetComponentInfo()) + return } - + err = core.UnmarshalPrimitive(m, "ml_based_assignments_custom", &obj.MlBasedAssignmentsCustom) + if err != nil { + err = core.SDKErrorf(err, "", "ml_based_assignments_custom-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "ml_based_assignments_default", &obj.MlBasedAssignmentsDefault) + if err != nil { + err = core.SDKErrorf(err, "", "ml_based_assignments_default-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name_matching", &obj.NameMatching) + if err != nil { + err = core.SDKErrorf(err, "", "name_matching-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "term_assignment_threshold", &obj.TermAssignmentThreshold) + if err != nil { + err = core.SDKErrorf(err, "", "term_assignment_threshold-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "term_suggestion_threshold", &obj.TermSuggestionThreshold) + if err != nil { + err = core.SDKErrorf(err, "", "term_suggestion_threshold-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// RemoveEnginePropertiesPrestissimoOaiGenJvm : JVM properties. -type RemoveEnginePropertiesPrestissimoOaiGenJvm struct { - // List of coordinator properties. - Coordinator []string `json:"coordinator,omitempty"` +// SalGlossaryTerms : Sal Integration Glossary terms list. +type SalGlossaryTerms struct { + // collection of glossary terms. + GlossaryTerms []GlossaryObject `json:"glossary_terms" validate:"required"` } -// UnmarshalRemoveEnginePropertiesPrestissimoOaiGenJvm unmarshals an instance of RemoveEnginePropertiesPrestissimoOaiGenJvm from the specified map of raw messages. -func UnmarshalRemoveEnginePropertiesPrestissimoOaiGenJvm(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RemoveEnginePropertiesPrestissimoOaiGenJvm) - err = core.UnmarshalPrimitive(m, "coordinator", &obj.Coordinator) +// UnmarshalSalGlossaryTerms unmarshals an instance of SalGlossaryTerms from the specified map of raw messages. +func UnmarshalSalGlossaryTerms(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalGlossaryTerms) + err = core.UnmarshalModel(m, "glossary_terms", &obj.GlossaryTerms, UnmarshalGlossaryObject) if err != nil { - err = core.SDKErrorf(err, "", "coordinator-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "glossary_terms-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the RemoveEnginePropertiesPrestissimoOaiGenJvm -func (removeEnginePropertiesPrestissimoOaiGenJvm *RemoveEnginePropertiesPrestissimoOaiGenJvm) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(removeEnginePropertiesPrestissimoOaiGenJvm.Coordinator) { - _patch["coordinator"] = removeEnginePropertiesPrestissimoOaiGenJvm.Coordinator - } +// SalGlossaryUploadProcess : Sal Integration Upload Glossary Process. +type SalGlossaryUploadProcess struct { + // glossary uploading process id. + ID *string `json:"id,omitempty"` +} +// UnmarshalSalGlossaryUploadProcess unmarshals an instance of SalGlossaryUploadProcess from the specified map of raw messages. +func UnmarshalSalGlossaryUploadProcess(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalGlossaryUploadProcess) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// ReplaceSnapshotCreatedBody : success response. -type ReplaceSnapshotCreatedBody struct { - // Response of success. - Response *SuccessResponse `json:"response,omitempty"` +// SalGlossaryUploadStatus : Sal Integration Upload Glossary. +type SalGlossaryUploadStatus struct { + // response of the uploading process status in json. + Response *string `json:"response,omitempty"` } -// UnmarshalReplaceSnapshotCreatedBody unmarshals an instance of ReplaceSnapshotCreatedBody from the specified map of raw messages. -func UnmarshalReplaceSnapshotCreatedBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ReplaceSnapshotCreatedBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) +// UnmarshalSalGlossaryUploadStatus unmarshals an instance of SalGlossaryUploadStatus from the specified map of raw messages. +func UnmarshalSalGlossaryUploadStatus(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalGlossaryUploadStatus) + err = core.UnmarshalPrimitive(m, "response", &obj.Response) if err != nil { err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) return @@ -24606,2137 +29887,2398 @@ func UnmarshalReplaceSnapshotCreatedBody(m map[string]json.RawMessage, result in return } -// RestartPrestissimoEngineOptions : The RestartPrestissimoEngine options. -type RestartPrestissimoEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// SalIntegration : Basic Semantic Automation Layer(SAL) integration settings. +type SalIntegration struct { + // IBM Knowledge Catalog(IKC) category UUID. + CategoryID *string `json:"category_id,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // SAL integration creation timestamp. + CreatedAtEpoch *string `json:"created_at_epoch,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string -} + // registered engine id of the SAL integration. + EngineID *string `json:"engine_id,omitempty"` -// NewRestartPrestissimoEngineOptions : Instantiate RestartPrestissimoEngineOptions -func (*WatsonxDataV2) NewRestartPrestissimoEngineOptions(engineID string) *RestartPrestissimoEngineOptions { - return &RestartPrestissimoEngineOptions{ - EngineID: core.StringPtr(engineID), - } -} + // exceptions happens when creating integration with IKC on remote side. + Errors []ErrorObj `json:"errors" validate:"required"` -// SetEngineID : Allow user to set EngineID -func (_options *RestartPrestissimoEngineOptions) SetEngineID(engineID string) *RestartPrestissimoEngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} + // SAL integration instance id. + InstanceID *string `json:"instance_id,omitempty"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *RestartPrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *RestartPrestissimoEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} + // status of the SAL integration. + Status *string `json:"status,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *RestartPrestissimoEngineOptions) SetHeaders(param map[string]string) *RestartPrestissimoEngineOptions { - options.Headers = param - return options -} + // COS resource CRN. + StorageResourceCrn *string `json:"storage_resource_crn,omitempty"` -// RestartPrestoEngineOptions : The RestartPrestoEngine options. -type RestartPrestoEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + // COS storage type. + StorageType *string `json:"storage_type,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // whether the integration is based on IKC trial plan, which is available on watsonx.data Saas only. + TrialPlan *bool `json:"trial_plan,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // ID of the user who enabled the SAL integration. + Username *string `json:"username,omitempty"` } -// NewRestartPrestoEngineOptions : Instantiate RestartPrestoEngineOptions -func (*WatsonxDataV2) NewRestartPrestoEngineOptions(engineID string) *RestartPrestoEngineOptions { - return &RestartPrestoEngineOptions{ - EngineID: core.StringPtr(engineID), +// UnmarshalSalIntegration unmarshals an instance of SalIntegration from the specified map of raw messages. +func UnmarshalSalIntegration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalIntegration) + err = core.UnmarshalPrimitive(m, "category_id", &obj.CategoryID) + if err != nil { + err = core.SDKErrorf(err, "", "category_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_at_epoch", &obj.CreatedAtEpoch) + if err != nil { + err = core.SDKErrorf(err, "", "created_at_epoch-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) + if err != nil { + err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "errors", &obj.Errors, UnmarshalErrorObj) + if err != nil { + err = core.SDKErrorf(err, "", "errors-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) + if err != nil { + err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "storage_resource_crn", &obj.StorageResourceCrn) + if err != nil { + err = core.SDKErrorf(err, "", "storage_resource_crn-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "storage_type", &obj.StorageType) + if err != nil { + err = core.SDKErrorf(err, "", "storage_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "trial_plan", &obj.TrialPlan) + if err != nil { + err = core.SDKErrorf(err, "", "trial_plan-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "username", &obj.Username) + if err != nil { + err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetEngineID : Allow user to set EngineID -func (_options *RestartPrestoEngineOptions) SetEngineID(engineID string) *RestartPrestoEngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} +// SalIntegrationMappingObj : Item of SAL metadata Mappings details for watsonx.data schema in IKC metadata. +type SalIntegrationMappingObj struct { + // corresponding catalog id in IKC. + WkcCatalogID *string `json:"wkc_catalog_id,omitempty"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *RestartPrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *RestartPrestoEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} + // corresponding project id in IKC. + WkcProjectID *string `json:"wkc_project_id,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *RestartPrestoEngineOptions) SetHeaders(param map[string]string) *RestartPrestoEngineOptions { - options.Headers = param - return options -} + // catalog name in Watsonx.data. + WxdCatalogName *string `json:"wxd_catalog_name,omitempty"` -// ResultExecuteQuery : ResultExecuteQuery OK. -type ResultExecuteQuery struct { - // Query result in JSON format. - Result []map[string]string `json:"result,omitempty"` + // schema name in Watsonx.data. + WxdSchemaName *string `json:"wxd_schema_name,omitempty"` } -// UnmarshalResultExecuteQuery unmarshals an instance of ResultExecuteQuery from the specified map of raw messages. -func UnmarshalResultExecuteQuery(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResultExecuteQuery) - err = core.UnmarshalPrimitive(m, "result", &obj.Result) +// UnmarshalSalIntegrationMappingObj unmarshals an instance of SalIntegrationMappingObj from the specified map of raw messages. +func UnmarshalSalIntegrationMappingObj(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalIntegrationMappingObj) + err = core.UnmarshalPrimitive(m, "wkc_catalog_id", &obj.WkcCatalogID) + if err != nil { + err = core.SDKErrorf(err, "", "wkc_catalog_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "wkc_project_id", &obj.WkcProjectID) + if err != nil { + err = core.SDKErrorf(err, "", "wkc_project_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "wxd_catalog_name", &obj.WxdCatalogName) if err != nil { - err = core.SDKErrorf(err, "", "result-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "wxd_catalog_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "wxd_schema_name", &obj.WxdSchemaName) + if err != nil { + err = core.SDKErrorf(err, "", "wxd_schema_name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// ResultPrestissimoExplainStatement : ExplainStatement OK. -type ResultPrestissimoExplainStatement struct { - // Result. - Result *string `json:"result,omitempty"` +// SalIntegrationMappings : Collection of SAL Mapping details of given watsonx.data schemas. +type SalIntegrationMappings struct { + // list of results as sal maapping in Watsonx.data vs IKC metadata. + Mappings []SalIntegrationMappingObj `json:"mappings" validate:"required"` + + // reference for next part of the query results (if results number exceed 100). + Next *string `json:"next,omitempty"` } -// UnmarshalResultPrestissimoExplainStatement unmarshals an instance of ResultPrestissimoExplainStatement from the specified map of raw messages. -func UnmarshalResultPrestissimoExplainStatement(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResultPrestissimoExplainStatement) - err = core.UnmarshalPrimitive(m, "result", &obj.Result) +// UnmarshalSalIntegrationMappings unmarshals an instance of SalIntegrationMappings from the specified map of raw messages. +func UnmarshalSalIntegrationMappings(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalIntegrationMappings) + err = core.UnmarshalModel(m, "mappings", &obj.Mappings, UnmarshalSalIntegrationMappingObj) if err != nil { - err = core.SDKErrorf(err, "", "result-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "mappings-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "next", &obj.Next) + if err != nil { + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// ResultRunPrestissimoExplainAnalyzeStatement : explainAnalyzeStatement OK. -type ResultRunPrestissimoExplainAnalyzeStatement struct { - // explainAnalyzeStatement result. - Result *string `json:"result,omitempty"` +// SalIntegrationPatch : Request payload to update semantic automation layer(SAL) integration properties. +type SalIntegrationPatch struct { + // IAM apikey. + Apikey *string `json:"apikey,omitempty"` + + // Engine ID(support presto and prestissimo) of which registering for integration. + EngineID *string `json:"engine_id,omitempty"` } -// UnmarshalResultRunPrestissimoExplainAnalyzeStatement unmarshals an instance of ResultRunPrestissimoExplainAnalyzeStatement from the specified map of raw messages. -func UnmarshalResultRunPrestissimoExplainAnalyzeStatement(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ResultRunPrestissimoExplainAnalyzeStatement) - err = core.UnmarshalPrimitive(m, "result", &obj.Result) +// UnmarshalSalIntegrationPatch unmarshals an instance of SalIntegrationPatch from the specified map of raw messages. +func UnmarshalSalIntegrationPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SalIntegrationPatch) + err = core.UnmarshalPrimitive(m, "apikey", &obj.Apikey) if err != nil { - err = core.SDKErrorf(err, "", "result-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "apikey-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) + if err != nil { + err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// ResumePrestissimoEngineOptions : The ResumePrestissimoEngine options. -type ResumePrestissimoEngineOptions struct { +// AsPatch returns a generic map representation of the SalIntegrationPatch +func (salIntegrationPatch *SalIntegrationPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(salIntegrationPatch.Apikey) { + _patch["apikey"] = salIntegrationPatch.Apikey + } + if !core.IsNil(salIntegrationPatch.EngineID) { + _patch["engine_id"] = salIntegrationPatch.EngineID + } + + return +} + +// ScalePrestissimoEngineOptions : The ScalePrestissimoEngine options. +type ScalePrestissimoEngineOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` + + // Presto engine configurations. + Coordinator *NodeDescription `json:"coordinator,omitempty"` - // CRN. + // Presto engine configurations. + Worker *NodeDescription `json:"worker,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewResumePrestissimoEngineOptions : Instantiate ResumePrestissimoEngineOptions -func (*WatsonxDataV2) NewResumePrestissimoEngineOptions(engineID string) *ResumePrestissimoEngineOptions { - return &ResumePrestissimoEngineOptions{ - EngineID: core.StringPtr(engineID), +// NewScalePrestissimoEngineOptions : Instantiate ScalePrestissimoEngineOptions +func (*WatsonxDataV3) NewScalePrestissimoEngineOptions(id string) *ScalePrestissimoEngineOptions { + return &ScalePrestissimoEngineOptions{ + ID: core.StringPtr(id), } } -// SetEngineID : Allow user to set EngineID -func (_options *ResumePrestissimoEngineOptions) SetEngineID(engineID string) *ResumePrestissimoEngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *ScalePrestissimoEngineOptions) SetID(id string) *ScalePrestissimoEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCoordinator : Allow user to set Coordinator +func (_options *ScalePrestissimoEngineOptions) SetCoordinator(coordinator *NodeDescription) *ScalePrestissimoEngineOptions { + _options.Coordinator = coordinator + return _options +} + +// SetWorker : Allow user to set Worker +func (_options *ScalePrestissimoEngineOptions) SetWorker(worker *NodeDescription) *ScalePrestissimoEngineOptions { + _options.Worker = worker return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ResumePrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *ResumePrestissimoEngineOptions { +func (_options *ScalePrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *ScalePrestissimoEngineOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *ResumePrestissimoEngineOptions) SetHeaders(param map[string]string) *ResumePrestissimoEngineOptions { +func (options *ScalePrestissimoEngineOptions) SetHeaders(param map[string]string) *ScalePrestissimoEngineOptions { options.Headers = param return options } -// ResumePrestoEngineOptions : The ResumePrestoEngine options. -type ResumePrestoEngineOptions struct { +// ScalePrestoEngineOptions : The ScalePrestoEngine options. +type ScalePrestoEngineOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` - // CRN. + // Presto engine configurations. + Coordinator *NodeDescription `json:"coordinator,omitempty"` + + // Presto engine configurations. + Worker *NodeDescription `json:"worker,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewResumePrestoEngineOptions : Instantiate ResumePrestoEngineOptions -func (*WatsonxDataV2) NewResumePrestoEngineOptions(engineID string) *ResumePrestoEngineOptions { - return &ResumePrestoEngineOptions{ - EngineID: core.StringPtr(engineID), +// NewScalePrestoEngineOptions : Instantiate ScalePrestoEngineOptions +func (*WatsonxDataV3) NewScalePrestoEngineOptions(id string) *ScalePrestoEngineOptions { + return &ScalePrestoEngineOptions{ + ID: core.StringPtr(id), } } -// SetEngineID : Allow user to set EngineID -func (_options *ResumePrestoEngineOptions) SetEngineID(engineID string) *ResumePrestoEngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *ScalePrestoEngineOptions) SetID(id string) *ScalePrestoEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetCoordinator : Allow user to set Coordinator +func (_options *ScalePrestoEngineOptions) SetCoordinator(coordinator *NodeDescription) *ScalePrestoEngineOptions { + _options.Coordinator = coordinator + return _options +} + +// SetWorker : Allow user to set Worker +func (_options *ScalePrestoEngineOptions) SetWorker(worker *NodeDescription) *ScalePrestoEngineOptions { + _options.Worker = worker return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ResumePrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *ResumePrestoEngineOptions { +func (_options *ScalePrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *ScalePrestoEngineOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *ResumePrestoEngineOptions) SetHeaders(param map[string]string) *ResumePrestoEngineOptions { +func (options *ScalePrestoEngineOptions) SetHeaders(param map[string]string) *ScalePrestoEngineOptions { options.Headers = param return options } -// ResumeSparkEngineOptions : The ResumeSparkEngine options. -type ResumeSparkEngineOptions struct { +// ScaleSparkEngineOptions : The ScaleSparkEngine options. +type ScaleSparkEngineOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` - // CRN. + // Node count. + NumberOfNodes *int64 `json:"number_of_nodes,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewResumeSparkEngineOptions : Instantiate ResumeSparkEngineOptions -func (*WatsonxDataV2) NewResumeSparkEngineOptions(engineID string) *ResumeSparkEngineOptions { - return &ResumeSparkEngineOptions{ - EngineID: core.StringPtr(engineID), +// NewScaleSparkEngineOptions : Instantiate ScaleSparkEngineOptions +func (*WatsonxDataV3) NewScaleSparkEngineOptions(id string) *ScaleSparkEngineOptions { + return &ScaleSparkEngineOptions{ + ID: core.StringPtr(id), } } -// SetEngineID : Allow user to set EngineID -func (_options *ResumeSparkEngineOptions) SetEngineID(engineID string) *ResumeSparkEngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *ScaleSparkEngineOptions) SetID(id string) *ScaleSparkEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetNumberOfNodes : Allow user to set NumberOfNodes +func (_options *ScaleSparkEngineOptions) SetNumberOfNodes(numberOfNodes int64) *ScaleSparkEngineOptions { + _options.NumberOfNodes = core.Int64Ptr(numberOfNodes) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ResumeSparkEngineOptions) SetAuthInstanceID(authInstanceID string) *ResumeSparkEngineOptions { +func (_options *ScaleSparkEngineOptions) SetAuthInstanceID(authInstanceID string) *ScaleSparkEngineOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *ResumeSparkEngineOptions) SetHeaders(param map[string]string) *ResumeSparkEngineOptions { +func (options *ScaleSparkEngineOptions) SetHeaders(param map[string]string) *ScaleSparkEngineOptions { options.Headers = param return options } -// RollbackTableOptions : The RollbackTable options. -type RollbackTableOptions struct { - // Engine name. - EngineID *string `json:"engine_id" validate:"required"` - - // Catalog ID. - CatalogID *string `json:"catalog_id" validate:"required,ne="` - - // Schema ID. - SchemaID *string `json:"schema_id" validate:"required,ne="` +// SchemaPrototype : Schema creation request details. +type SchemaPrototype struct { + // Path within bucket where schema will be created. + CustomPath *string `json:"custom_path" validate:"required"` - // Table ID. - TableID *string `json:"table_id" validate:"required,ne="` + // Host name of the HDFS bucket. Need to be provided if using HDFS. + Hostname *string `json:"hostname,omitempty"` - // Snapshot Id. - SnapshotID *string `json:"snapshot_id,omitempty"` + // Unique schema name, schemas with same names are not allowed in a catalog. + Name *string `json:"name" validate:"required"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Port of the HDFS bucket. Need to be provided if using HDFS. + Port *int64 `json:"port,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // Bucket associated to catalog where schema will be added. + StorageName *string `json:"storage_name,omitempty"` } -// NewRollbackTableOptions : Instantiate RollbackTableOptions -func (*WatsonxDataV2) NewRollbackTableOptions(engineID string, catalogID string, schemaID string, tableID string) *RollbackTableOptions { - return &RollbackTableOptions{ - EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - TableID: core.StringPtr(tableID), +// NewSchemaPrototype : Instantiate SchemaPrototype (Generic Model Constructor) +func (*WatsonxDataV3) NewSchemaPrototype(customPath string, name string) (_model *SchemaPrototype, err error) { + _model = &SchemaPrototype{ + CustomPath: core.StringPtr(customPath), + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } + return } -// SetEngineID : Allow user to set EngineID -func (_options *RollbackTableOptions) SetEngineID(engineID string) *RollbackTableOptions { - _options.EngineID = core.StringPtr(engineID) - return _options +// UnmarshalSchemaPrototype unmarshals an instance of SchemaPrototype from the specified map of raw messages. +func UnmarshalSchemaPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SchemaPrototype) + err = core.UnmarshalPrimitive(m, "custom_path", &obj.CustomPath) + if err != nil { + err = core.SDKErrorf(err, "", "custom_path-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + if err != nil { + err = core.SDKErrorf(err, "", "hostname-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + err = core.SDKErrorf(err, "", "port-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "storage_name", &obj.StorageName) + if err != nil { + err = core.SDKErrorf(err, "", "storage_name-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetCatalogID : Allow user to set CatalogID -func (_options *RollbackTableOptions) SetCatalogID(catalogID string) *RollbackTableOptions { - _options.CatalogID = core.StringPtr(catalogID) - return _options -} +// SchemaTransformation : SchemaTransformation struct +type SchemaTransformation struct { + // The original column name. + OldColumn *string `json:"old_column" validate:"required"` -// SetSchemaID : Allow user to set SchemaID -func (_options *RollbackTableOptions) SetSchemaID(schemaID string) *RollbackTableOptions { - _options.SchemaID = core.StringPtr(schemaID) - return _options + // The new column name. + NewColumn *string `json:"new_column,omitempty"` + + // The new column type. + NewType *string `json:"new_type,omitempty"` } -// SetTableID : Allow user to set TableID -func (_options *RollbackTableOptions) SetTableID(tableID string) *RollbackTableOptions { - _options.TableID = core.StringPtr(tableID) - return _options +// NewSchemaTransformation : Instantiate SchemaTransformation (Generic Model Constructor) +func (*WatsonxDataV3) NewSchemaTransformation(oldColumn string) (_model *SchemaTransformation, err error) { + _model = &SchemaTransformation{ + OldColumn: core.StringPtr(oldColumn), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return } -// SetSnapshotID : Allow user to set SnapshotID -func (_options *RollbackTableOptions) SetSnapshotID(snapshotID string) *RollbackTableOptions { - _options.SnapshotID = core.StringPtr(snapshotID) - return _options +// UnmarshalSchemaTransformation unmarshals an instance of SchemaTransformation from the specified map of raw messages. +func UnmarshalSchemaTransformation(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SchemaTransformation) + err = core.UnmarshalPrimitive(m, "old_column", &obj.OldColumn) + if err != nil { + err = core.SDKErrorf(err, "", "old_column-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "new_column", &obj.NewColumn) + if err != nil { + err = core.SDKErrorf(err, "", "new_column-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "new_type", &obj.NewType) + if err != nil { + err = core.SDKErrorf(err, "", "new_type-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *RollbackTableOptions) SetAuthInstanceID(authInstanceID string) *RollbackTableOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options +// SchemasCollection : Collection of schemas. +type SchemasCollection struct { + // List of schemas fetched from given catalog. + Schemas []string `json:"schemas" validate:"required"` } -// SetHeaders : Allow user to set Headers -func (options *RollbackTableOptions) SetHeaders(param map[string]string) *RollbackTableOptions { - options.Headers = param - return options +// UnmarshalSchemasCollection unmarshals an instance of SchemasCollection from the specified map of raw messages. +func UnmarshalSchemasCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SchemasCollection) + err = core.UnmarshalPrimitive(m, "schemas", &obj.Schemas) + if err != nil { + err = core.SDKErrorf(err, "", "schemas-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// RunExplainAnalyzeStatementOKBody : explainAnalyzeStatement OK. -type RunExplainAnalyzeStatementOKBody struct { - // Response of success. - Response *SuccessResponse `json:"response" validate:"required"` +// SecretDetails : secret details. +type SecretDetails struct { + // secret key. + Key *string `json:"key,omitempty"` - // explainAnalyzeStatement result. - Result *string `json:"result" validate:"required"` + // secret name. + SecretName *string `json:"secret_name,omitempty"` + + // secret urn. + SecretUrn *string `json:"secret_urn,omitempty"` } -// UnmarshalRunExplainAnalyzeStatementOKBody unmarshals an instance of RunExplainAnalyzeStatementOKBody from the specified map of raw messages. -func UnmarshalRunExplainAnalyzeStatementOKBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RunExplainAnalyzeStatementOKBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) +// UnmarshalSecretDetails unmarshals an instance of SecretDetails from the specified map of raw messages. +func UnmarshalSecretDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecretDetails) + err = core.UnmarshalPrimitive(m, "key", &obj.Key) if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "key-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "result", &obj.Result) + err = core.UnmarshalPrimitive(m, "secret_name", &obj.SecretName) if err != nil { - err = core.SDKErrorf(err, "", "result-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "secret_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "secret_urn", &obj.SecretUrn) + if err != nil { + err = core.SDKErrorf(err, "", "secret_urn-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// RunExplainAnalyzeStatementOptions : The RunExplainAnalyzeStatement options. -type RunExplainAnalyzeStatementOptions struct { - // Engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` - - // Presto query to show explain analyze. - Statement *string `json:"statement" validate:"required"` +// SemanticSearch : semantic search object of the returning result. +type SemanticSearch struct { + // id of the semantic search query record. + ID *string `json:"id,omitempty"` - // Verbose. - Verbose *bool `json:"verbose,omitempty"` + // last time of searching the same query string. + LastSearchTime *strfmt.DateTime `json:"last_search_time,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // search results of given query. + Results []SemanticSearchResultsItem `json:"results" validate:"required"` - // Allows users to set headers on API requests. - Headers map[string]string + // input search query. + SearchQuery *string `json:"search_query,omitempty"` } -// NewRunExplainAnalyzeStatementOptions : Instantiate RunExplainAnalyzeStatementOptions -func (*WatsonxDataV2) NewRunExplainAnalyzeStatementOptions(engineID string, statement string) *RunExplainAnalyzeStatementOptions { - return &RunExplainAnalyzeStatementOptions{ - EngineID: core.StringPtr(engineID), - Statement: core.StringPtr(statement), +// UnmarshalSemanticSearch unmarshals an instance of SemanticSearch from the specified map of raw messages. +func UnmarshalSemanticSearch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SemanticSearch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "last_search_time", &obj.LastSearchTime) + if err != nil { + err = core.SDKErrorf(err, "", "last_search_time-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "results", &obj.Results, UnmarshalSemanticSearchResultsItem) + if err != nil { + err = core.SDKErrorf(err, "", "results-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "search_query", &obj.SearchQuery) + if err != nil { + err = core.SDKErrorf(err, "", "search_query-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetEngineID : Allow user to set EngineID -func (_options *RunExplainAnalyzeStatementOptions) SetEngineID(engineID string) *RunExplainAnalyzeStatementOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} +// SemanticSearchBodySearchConfig : request payload for semantic search configurations. +type SemanticSearchBodySearchConfig struct { + // enable columns search. + ColumnSearchEnabled *bool `json:"column_search_enabled,omitempty"` -// SetStatement : Allow user to set Statement -func (_options *RunExplainAnalyzeStatementOptions) SetStatement(statement string) *RunExplainAnalyzeStatementOptions { - _options.Statement = core.StringPtr(statement) - return _options -} + // search fields. + Fields []string `json:"fields,omitempty"` -// SetVerbose : Allow user to set Verbose -func (_options *RunExplainAnalyzeStatementOptions) SetVerbose(verbose bool) *RunExplainAnalyzeStatementOptions { - _options.Verbose = core.BoolPtr(verbose) - return _options -} + // max result number limitation. + MaxResultNumber *int64 `json:"max_result_number,omitempty"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *RunExplainAnalyzeStatementOptions) SetAuthInstanceID(authInstanceID string) *RunExplainAnalyzeStatementOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options + // enable schemas search. + SchemaSearchEnabled *bool `json:"schema_search_enabled,omitempty"` } -// SetHeaders : Allow user to set Headers -func (options *RunExplainAnalyzeStatementOptions) SetHeaders(param map[string]string) *RunExplainAnalyzeStatementOptions { - options.Headers = param - return options +// UnmarshalSemanticSearchBodySearchConfig unmarshals an instance of SemanticSearchBodySearchConfig from the specified map of raw messages. +func UnmarshalSemanticSearchBodySearchConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SemanticSearchBodySearchConfig) + err = core.UnmarshalPrimitive(m, "column_search_enabled", &obj.ColumnSearchEnabled) + if err != nil { + err = core.SDKErrorf(err, "", "column_search_enabled-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "fields", &obj.Fields) + if err != nil { + err = core.SDKErrorf(err, "", "fields-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "max_result_number", &obj.MaxResultNumber) + if err != nil { + err = core.SDKErrorf(err, "", "max_result_number-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "schema_search_enabled", &obj.SchemaSearchEnabled) + if err != nil { + err = core.SDKErrorf(err, "", "schema_search_enabled-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// RunExplainStatementOKBody : ExplainStatement OK. -type RunExplainStatementOKBody struct { - // Response of success. - Response *SuccessResponse `json:"response" validate:"required"` - - // Result. - Result *string `json:"result" validate:"required"` +// SemanticSearchList : collection of query results of Semantic search history queries response object. +type SemanticSearchList struct { + // List of semantic search results. + Queries []SemanticSearch `json:"queries" validate:"required"` } -// UnmarshalRunExplainStatementOKBody unmarshals an instance of RunExplainStatementOKBody from the specified map of raw messages. -func UnmarshalRunExplainStatementOKBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(RunExplainStatementOKBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "result", &obj.Result) +// UnmarshalSemanticSearchList unmarshals an instance of SemanticSearchList from the specified map of raw messages. +func UnmarshalSemanticSearchList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SemanticSearchList) + err = core.UnmarshalModel(m, "queries", &obj.Queries, UnmarshalSemanticSearch) if err != nil { - err = core.SDKErrorf(err, "", "result-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "queries-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// RunExplainStatementOptions : The RunExplainStatement options. -type RunExplainStatementOptions struct { - // Engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// SemanticSearchResultsItem : collection of semantic search query results. +type SemanticSearchResultsItem struct { + // artifact type. + ArtifactType *string `json:"artifact_type,omitempty"` - // Presto query to determine explain plan. - Statement *string `json:"statement" validate:"required"` + // IKC asset id. + AssetID *string `json:"asset_id,omitempty"` - // Format. - Format *string `json:"format,omitempty"` + // catalog name. + CatalogName *string `json:"catalog_name,omitempty"` - // Type. - Type *string `json:"type,omitempty"` + // semantic description. + Description *string `json:"description,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // matching fields details from elasticsearch highlight. + Highlight map[string][]string `json:"highlight,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string -} + // collection of columns hit by search. + MatchedColumns []SemanticSearchResultsItemMatchedColumnsItems `json:"matched_columns" validate:"required"` -// Constants associated with the RunExplainStatementOptions.Format property. -// Format. -const ( - RunExplainStatementOptions_Format_Graphviz = "graphviz" - RunExplainStatementOptions_Format_JSON = "json" - RunExplainStatementOptions_Format_Text = "text" -) + // asset name. + Name *string `json:"name" validate:"required"` -// Constants associated with the RunExplainStatementOptions.Type property. -// Type. -const ( - RunExplainStatementOptions_Type_Distributed = "distributed" - RunExplainStatementOptions_Type_Io = "io" - RunExplainStatementOptions_Type_Logical = "logical" - RunExplainStatementOptions_Type_Validate = "validate" -) + // asset path. + Path *string `json:"path,omitempty"` -// NewRunExplainStatementOptions : Instantiate RunExplainStatementOptions -func (*WatsonxDataV2) NewRunExplainStatementOptions(engineID string, statement string) *RunExplainStatementOptions { - return &RunExplainStatementOptions{ - EngineID: core.StringPtr(engineID), - Statement: core.StringPtr(statement), - } -} + // IKC project id. + ProjectID *string `json:"project_id,omitempty"` -// SetEngineID : Allow user to set EngineID -func (_options *RunExplainStatementOptions) SetEngineID(engineID string) *RunExplainStatementOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} + // asset provider type. + ProviderType *string `json:"provider_type,omitempty"` -// SetStatement : Allow user to set Statement -func (_options *RunExplainStatementOptions) SetStatement(statement string) *RunExplainStatementOptions { - _options.Statement = core.StringPtr(statement) - return _options -} + // schema name. + SchemaName *string `json:"schema_name,omitempty"` -// SetFormat : Allow user to set Format -func (_options *RunExplainStatementOptions) SetFormat(format string) *RunExplainStatementOptions { - _options.Format = core.StringPtr(format) - return _options -} + // global search score. + SearchScore *float32 `json:"search_score" validate:"required"` -// SetType : Allow user to set Type -func (_options *RunExplainStatementOptions) SetType(typeVar string) *RunExplainStatementOptions { - _options.Type = core.StringPtr(typeVar) - return _options -} + // semantic description. + SemanticDescription *string `json:"semantic_description,omitempty"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *RunExplainStatementOptions) SetAuthInstanceID(authInstanceID string) *RunExplainStatementOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options + // semantic name. + SemanticName *string `json:"semantic_name,omitempty"` + + // status of the asset. + State *string `json:"state,omitempty"` + + // table name. + TableName *string `json:"table_name,omitempty"` + + // asset tags. + Tags []string `json:"tags" validate:"required"` + + // bussiness terms. + Terms []string `json:"terms" validate:"required"` } -// SetHeaders : Allow user to set Headers -func (options *RunExplainStatementOptions) SetHeaders(param map[string]string) *RunExplainStatementOptions { - options.Headers = param - return options +// UnmarshalSemanticSearchResultsItem unmarshals an instance of SemanticSearchResultsItem from the specified map of raw messages. +func UnmarshalSemanticSearchResultsItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SemanticSearchResultsItem) + err = core.UnmarshalPrimitive(m, "artifact_type", &obj.ArtifactType) + if err != nil { + err = core.SDKErrorf(err, "", "artifact_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "asset_id", &obj.AssetID) + if err != nil { + err = core.SDKErrorf(err, "", "asset_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "highlight", &obj.Highlight) + if err != nil { + err = core.SDKErrorf(err, "", "highlight-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "matched_columns", &obj.MatchedColumns, UnmarshalSemanticSearchResultsItemMatchedColumnsItems) + if err != nil { + err = core.SDKErrorf(err, "", "matched_columns-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "path", &obj.Path) + if err != nil { + err = core.SDKErrorf(err, "", "path-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "project_id", &obj.ProjectID) + if err != nil { + err = core.SDKErrorf(err, "", "project_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "provider_type", &obj.ProviderType) + if err != nil { + err = core.SDKErrorf(err, "", "provider_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "schema_name", &obj.SchemaName) + if err != nil { + err = core.SDKErrorf(err, "", "schema_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "search_score", &obj.SearchScore) + if err != nil { + err = core.SDKErrorf(err, "", "search_score-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "semantic_description", &obj.SemanticDescription) + if err != nil { + err = core.SDKErrorf(err, "", "semantic_description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "semantic_name", &obj.SemanticName) + if err != nil { + err = core.SDKErrorf(err, "", "semantic_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "table_name", &obj.TableName) + if err != nil { + err = core.SDKErrorf(err, "", "table_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "terms", &obj.Terms) + if err != nil { + err = core.SDKErrorf(err, "", "terms-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// RunPrestissimoExplainAnalyzeStatementOptions : The RunPrestissimoExplainAnalyzeStatement options. -type RunPrestissimoExplainAnalyzeStatementOptions struct { - // Engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// SemanticSearchResultsItemMatchedColumnsItems : SemanticSearchResultsItemMatchedColumnsItems struct +type SemanticSearchResultsItemMatchedColumnsItems struct { + // IKC asset id. + AssetID *string `json:"asset_id,omitempty"` - // Presto query to show explain analyze. - Statement *string `json:"statement" validate:"required"` + // column description. + Description *string `json:"description,omitempty"` - // Verbose. - Verbose *bool `json:"verbose,omitempty"` + // matching fields details from elasticsearch highlight. + Highlight map[string][]string `json:"highlight,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // column name. + Name *string `json:"name,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // semantic description. + SemanticDescription *string `json:"semantic_description,omitempty"` + + // semantic name. + SemanticName *string `json:"semantic_name,omitempty"` } -// NewRunPrestissimoExplainAnalyzeStatementOptions : Instantiate RunPrestissimoExplainAnalyzeStatementOptions -func (*WatsonxDataV2) NewRunPrestissimoExplainAnalyzeStatementOptions(engineID string, statement string) *RunPrestissimoExplainAnalyzeStatementOptions { - return &RunPrestissimoExplainAnalyzeStatementOptions{ - EngineID: core.StringPtr(engineID), - Statement: core.StringPtr(statement), +// UnmarshalSemanticSearchResultsItemMatchedColumnsItems unmarshals an instance of SemanticSearchResultsItemMatchedColumnsItems from the specified map of raw messages. +func UnmarshalSemanticSearchResultsItemMatchedColumnsItems(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SemanticSearchResultsItemMatchedColumnsItems) + err = core.UnmarshalPrimitive(m, "asset_id", &obj.AssetID) + if err != nil { + err = core.SDKErrorf(err, "", "asset_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "highlight", &obj.Highlight) + if err != nil { + err = core.SDKErrorf(err, "", "highlight-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "semantic_description", &obj.SemanticDescription) + if err != nil { + err = core.SDKErrorf(err, "", "semantic_description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "semantic_name", &obj.SemanticName) + if err != nil { + err = core.SDKErrorf(err, "", "semantic_name-error", common.GetComponentInfo()) + return } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetEngineID : Allow user to set EngineID -func (_options *RunPrestissimoExplainAnalyzeStatementOptions) SetEngineID(engineID string) *RunPrestissimoExplainAnalyzeStatementOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} +// SourceDetails : Details of ingestion source files. +type SourceDetails struct { + // Comma separated source file or directory path. + FilePaths *string `json:"file_paths,omitempty"` -// SetStatement : Allow user to set Statement -func (_options *RunPrestissimoExplainAnalyzeStatementOptions) SetStatement(statement string) *RunPrestissimoExplainAnalyzeStatementOptions { - _options.Statement = core.StringPtr(statement) - return _options -} + // Source file types (parquet, csv, json, orc, avro or text). + FileType *string `json:"file_type,omitempty"` -// SetVerbose : Allow user to set Verbose -func (_options *RunPrestissimoExplainAnalyzeStatementOptions) SetVerbose(verbose bool) *RunPrestissimoExplainAnalyzeStatementOptions { - _options.Verbose = core.BoolPtr(verbose) - return _options -} + // Ingestion source type. + SourceType *string `json:"source_type" validate:"required"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *RunPrestissimoExplainAnalyzeStatementOptions) SetAuthInstanceID(authInstanceID string) *RunPrestissimoExplainAnalyzeStatementOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} + // List of schema information derived from file. Updates to a schema must be added to schema_transformations. + Schema []IngestionSchemaResponse `json:"schema,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *RunPrestissimoExplainAnalyzeStatementOptions) SetHeaders(param map[string]string) *RunPrestissimoExplainAnalyzeStatementOptions { - options.Headers = param - return options -} + // List of additions/transformations applied to the schema. + SchemaTransformations []SchemaTransformation `json:"schema_transformations,omitempty"` -// RunPrestissimoExplainStatementOptions : The RunPrestissimoExplainStatement options. -type RunPrestissimoExplainStatementOptions struct { - // Engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + // Source DB Schema Name. + SchemaName *string `json:"schema_name,omitempty"` - // Presto query to determine explain plan. - Statement *string `json:"statement" validate:"required"` + // Source DB Table Name. + TableName *string `json:"table_name,omitempty"` - // Format. - Format *string `json:"format,omitempty"` + // Storage connection details. + BucketDetails *BucketDetails `json:"bucket_details,omitempty"` - // Type. - Type *string `json:"type,omitempty"` + // Iceberg source table information. + IcebergSourceTable *IcebergSourceTable `json:"iceberg_source_table,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Database credentials model. + SourceDatabase *DbConnectionModel `json:"source_database,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // Options used to read CSV or Text file. + FileFormatProperties *FileFormatProperties `json:"file_format_properties,omitempty"` + + // Determine if ingestion job is a local ingestion job. + IsLocalIngestion *bool `json:"is_local_ingestion,omitempty"` } -// Constants associated with the RunPrestissimoExplainStatementOptions.Format property. -// Format. +// Constants associated with the SourceDetails.FileType property. +// Source file types (parquet, csv, json, orc, avro or text). const ( - RunPrestissimoExplainStatementOptions_Format_Graphviz = "graphviz" - RunPrestissimoExplainStatementOptions_Format_JSON = "json" - RunPrestissimoExplainStatementOptions_Format_Text = "text" + SourceDetails_FileType_Avro = "avro" + SourceDetails_FileType_Csv = "csv" + SourceDetails_FileType_JSON = "json" + SourceDetails_FileType_Orc = "orc" + SourceDetails_FileType_Parquet = "parquet" + SourceDetails_FileType_Txt = "txt" ) -// Constants associated with the RunPrestissimoExplainStatementOptions.Type property. -// Type. +// Constants associated with the SourceDetails.SourceType property. +// Ingestion source type. const ( - RunPrestissimoExplainStatementOptions_Type_Distributed = "distributed" - RunPrestissimoExplainStatementOptions_Type_Io = "io" - RunPrestissimoExplainStatementOptions_Type_Logical = "logical" - RunPrestissimoExplainStatementOptions_Type_Validate = "validate" + SourceDetails_SourceType_Db = "db" + SourceDetails_SourceType_Iceberg = "iceberg" + SourceDetails_SourceType_Local = "local" + SourceDetails_SourceType_Storage = "storage" ) -// NewRunPrestissimoExplainStatementOptions : Instantiate RunPrestissimoExplainStatementOptions -func (*WatsonxDataV2) NewRunPrestissimoExplainStatementOptions(engineID string, statement string) *RunPrestissimoExplainStatementOptions { - return &RunPrestissimoExplainStatementOptions{ - EngineID: core.StringPtr(engineID), - Statement: core.StringPtr(statement), +// NewSourceDetails : Instantiate SourceDetails (Generic Model Constructor) +func (*WatsonxDataV3) NewSourceDetails(sourceType string) (_model *SourceDetails, err error) { + _model = &SourceDetails{ + SourceType: core.StringPtr(sourceType), } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return } -// SetEngineID : Allow user to set EngineID -func (_options *RunPrestissimoExplainStatementOptions) SetEngineID(engineID string) *RunPrestissimoExplainStatementOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetStatement : Allow user to set Statement -func (_options *RunPrestissimoExplainStatementOptions) SetStatement(statement string) *RunPrestissimoExplainStatementOptions { - _options.Statement = core.StringPtr(statement) - return _options -} - -// SetFormat : Allow user to set Format -func (_options *RunPrestissimoExplainStatementOptions) SetFormat(format string) *RunPrestissimoExplainStatementOptions { - _options.Format = core.StringPtr(format) - return _options -} - -// SetType : Allow user to set Type -func (_options *RunPrestissimoExplainStatementOptions) SetType(typeVar string) *RunPrestissimoExplainStatementOptions { - _options.Type = core.StringPtr(typeVar) - return _options +// UnmarshalSourceDetails unmarshals an instance of SourceDetails from the specified map of raw messages. +func UnmarshalSourceDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SourceDetails) + err = core.UnmarshalPrimitive(m, "file_paths", &obj.FilePaths) + if err != nil { + err = core.SDKErrorf(err, "", "file_paths-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "file_type", &obj.FileType) + if err != nil { + err = core.SDKErrorf(err, "", "file_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "source_type", &obj.SourceType) + if err != nil { + err = core.SDKErrorf(err, "", "source_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "schema", &obj.Schema, UnmarshalIngestionSchemaResponse) + if err != nil { + err = core.SDKErrorf(err, "", "schema-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "schema_transformations", &obj.SchemaTransformations, UnmarshalSchemaTransformation) + if err != nil { + err = core.SDKErrorf(err, "", "schema_transformations-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "schema_name", &obj.SchemaName) + if err != nil { + err = core.SDKErrorf(err, "", "schema_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "table_name", &obj.TableName) + if err != nil { + err = core.SDKErrorf(err, "", "table_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "bucket_details", &obj.BucketDetails, UnmarshalBucketDetails) + if err != nil { + err = core.SDKErrorf(err, "", "bucket_details-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "iceberg_source_table", &obj.IcebergSourceTable, UnmarshalIcebergSourceTable) + if err != nil { + err = core.SDKErrorf(err, "", "iceberg_source_table-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "source_database", &obj.SourceDatabase, UnmarshalDbConnectionModel) + if err != nil { + err = core.SDKErrorf(err, "", "source_database-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "file_format_properties", &obj.FileFormatProperties, UnmarshalFileFormatProperties) + if err != nil { + err = core.SDKErrorf(err, "", "file_format_properties-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "is_local_ingestion", &obj.IsLocalIngestion) + if err != nil { + err = core.SDKErrorf(err, "", "is_local_ingestion-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *RunPrestissimoExplainStatementOptions) SetAuthInstanceID(authInstanceID string) *RunPrestissimoExplainStatementOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} +// SparkApplicationDetails : Application details. +type SparkApplicationDetails struct { + // Path/URL for the application script or jar file. The file can be in object storage or in a mounted volume (volumes + // available only in software). + Application *string `json:"application" validate:"required"` -// SetHeaders : Allow user to set Headers -func (options *RunPrestissimoExplainStatementOptions) SetHeaders(param map[string]string) *RunPrestissimoExplainStatementOptions { - options.Headers = param - return options -} + // Comma separated list of zip file paths in object storage or volumes. These files will be extracted and loaded into + // the working directory of all executor nodes of the Spark cluster created to run this application. + Archives *string `json:"archives,omitempty"` -// SalIntegration : Sal Integration object. -type SalIntegration struct { - // category UUID. - CategoryID *string `json:"category_id,omitempty"` + // List of arguments. This should be set if the application script requires any arguments. + Arguments []string `json:"arguments,omitempty"` - // engine id. - EngineID *string `json:"engine_id,omitempty"` + // Main class for application jar. Set only if using a jar file for application. + Class *string `json:"class,omitempty"` - // errors. - Errors []ErrorObj `json:"errors,omitempty"` + // Default Spark configuration properties to be updated. To remove a property, set its value to null. + Conf map[string]string `json:"conf,omitempty"` - // governance scope UUID. - GovernanceScopeID *string `json:"governance_scope_id,omitempty"` + // Default Spark configuration properties to be updated. To remove a property, set its value to null. + Env map[string]string `json:"env,omitempty"` - // governance scope type. - GovernanceScopeType *string `json:"governance_scope_type,omitempty"` + // Comma separated list of file paths in object storage or volumes. These files will be loaded into the working + // directory of all executor nodes of the Spark cluster created to run this application. + Files *string `json:"files,omitempty"` - // instance_id. - InstanceID *string `json:"instance_id,omitempty"` + // Comma separated list for file paths for jars in object storage or volumes. These files will be loaded into the + // classpath of executor and driver nodes of the Spark application cluster. This should be set only if the application + // is a jar file and if you want to satisfy third party library dependencies of the application via these jars. + Jars *string `json:"jars,omitempty"` - // status of the integration. - Status *string `json:"status,omitempty"` + // Display name of the spark application. + Name *string `json:"name,omitempty"` - // COS resource CRN. - StorageResourceCrn *string `json:"storage_resource_crn,omitempty"` + // Comma separated list of package identifiers that recognizable by maven. These packages will be downloaded from + // default maven repo or any additional maven repositories that you may have specified in the request. Applicable only + // for java/scala applications. + Packages *string `json:"packages,omitempty"` - // COS storage type. - StorageType *string `json:"storage_type,omitempty"` + // Comma separated list of maven repository urls. In addition to default maven repo, the repositories specified here + // will be used to search for any specified packages. Applicable only for java/scala applications. + Repositories *string `json:"repositories,omitempty"` - // sal integration creation timestamp. - Timestamp *string `json:"timestamp,omitempty"` + // Application runtime configuration. + Runtime *SparkApplicationRuntime `json:"runtime,omitempty"` - // whether the integration is trial plan. - TrialPlan *bool `json:"trial_plan,omitempty"` + // Spark Version. + SparkVersion *string `json:"spark_version,omitempty"` +} - // user name. - Username *string `json:"username,omitempty"` +// NewSparkApplicationDetails : Instantiate SparkApplicationDetails (Generic Model Constructor) +func (*WatsonxDataV3) NewSparkApplicationDetails(application string) (_model *SparkApplicationDetails, err error) { + _model = &SparkApplicationDetails{ + Application: core.StringPtr(application), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return } -// UnmarshalSalIntegration unmarshals an instance of SalIntegration from the specified map of raw messages. -func UnmarshalSalIntegration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegration) - err = core.UnmarshalPrimitive(m, "category_id", &obj.CategoryID) +// UnmarshalSparkApplicationDetails unmarshals an instance of SparkApplicationDetails from the specified map of raw messages. +func UnmarshalSparkApplicationDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkApplicationDetails) + err = core.UnmarshalPrimitive(m, "application", &obj.Application) if err != nil { - err = core.SDKErrorf(err, "", "category_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "application-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) + err = core.UnmarshalPrimitive(m, "archives", &obj.Archives) if err != nil { - err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "archives-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "errors", &obj.Errors, UnmarshalErrorObj) + err = core.UnmarshalPrimitive(m, "arguments", &obj.Arguments) if err != nil { - err = core.SDKErrorf(err, "", "errors-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "arguments-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "governance_scope_id", &obj.GovernanceScopeID) + err = core.UnmarshalPrimitive(m, "class", &obj.Class) if err != nil { - err = core.SDKErrorf(err, "", "governance_scope_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "class-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "governance_scope_type", &obj.GovernanceScopeType) + err = core.UnmarshalPrimitive(m, "conf", &obj.Conf) if err != nil { - err = core.SDKErrorf(err, "", "governance_scope_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "conf-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) + err = core.UnmarshalPrimitive(m, "env", &obj.Env) if err != nil { - err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "env-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalPrimitive(m, "files", &obj.Files) if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "files-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "storage_resource_crn", &obj.StorageResourceCrn) + err = core.UnmarshalPrimitive(m, "jars", &obj.Jars) if err != nil { - err = core.SDKErrorf(err, "", "storage_resource_crn-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "jars-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "storage_type", &obj.StorageType) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "storage_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "timestamp", &obj.Timestamp) + err = core.UnmarshalPrimitive(m, "packages", &obj.Packages) if err != nil { - err = core.SDKErrorf(err, "", "timestamp-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "packages-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "trial_plan", &obj.TrialPlan) + err = core.UnmarshalPrimitive(m, "repositories", &obj.Repositories) if err != nil { - err = core.SDKErrorf(err, "", "trial_plan-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "repositories-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "username", &obj.Username) + err = core.UnmarshalModel(m, "runtime", &obj.Runtime, UnmarshalSparkApplicationRuntime) + if err != nil { + err = core.SDKErrorf(err, "", "runtime-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "spark_version", &obj.SparkVersion) if err != nil { - err = core.SDKErrorf(err, "", "username-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "spark_version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SalIntegrationEnrichmentAssets : sal integration enrichment assets. -type SalIntegrationEnrichmentAssets struct { - // Encrichment asset. - EnrichmentAsset *EnrichmentAsset `json:"enrichment_asset,omitempty"` +// SparkApplicationRuntime : Application runtime configuration. +type SparkApplicationRuntime struct { + // Spark Version. + SparkVersion *string `json:"spark_version,omitempty"` } -// UnmarshalSalIntegrationEnrichmentAssets unmarshals an instance of SalIntegrationEnrichmentAssets from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentAssets(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentAssets) - err = core.UnmarshalModel(m, "enrichment_asset", &obj.EnrichmentAsset, UnmarshalEnrichmentAsset) +// UnmarshalSparkApplicationRuntime unmarshals an instance of SparkApplicationRuntime from the specified map of raw messages. +func UnmarshalSparkApplicationRuntime(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkApplicationRuntime) + err = core.UnmarshalPrimitive(m, "spark_version", &obj.SparkVersion) if err != nil { - err = core.SDKErrorf(err, "", "enrichment_asset-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "spark_version-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SalIntegrationEnrichmentDataAsset : semantic enrichment data asset. -type SalIntegrationEnrichmentDataAsset struct { - // name. - Asset *string `json:"asset,omitempty"` +// SparkApplicationStateDetail : State details. +type SparkApplicationStateDetail struct { + // State details code. + Code *string `json:"code,omitempty"` + + // State details message. + Message *string `json:"message,omitempty"` + + // State details type. + Type *string `json:"type,omitempty"` } -// UnmarshalSalIntegrationEnrichmentDataAsset unmarshals an instance of SalIntegrationEnrichmentDataAsset from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentDataAsset(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentDataAsset) - err = core.UnmarshalPrimitive(m, "asset", &obj.Asset) +// UnmarshalSparkApplicationStateDetail unmarshals an instance of SparkApplicationStateDetail from the specified map of raw messages. +func UnmarshalSparkApplicationStateDetail(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkApplicationStateDetail) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) if err != nil { - err = core.SDKErrorf(err, "", "asset-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationEnrichmentJobRun : semantic enrichment job run. -type SalIntegrationEnrichmentJobRun struct { - // job run response. - Response *string `json:"response,omitempty"` -} - -// UnmarshalSalIntegrationEnrichmentJobRun unmarshals an instance of SalIntegrationEnrichmentJobRun from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentJobRun(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentJobRun) - err = core.UnmarshalPrimitive(m, "response", &obj.Response) + err = core.UnmarshalPrimitive(m, "message", &obj.Message) if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SalIntegrationEnrichmentJobRunLogs : semantic enrichment job run logs. -type SalIntegrationEnrichmentJobRunLogs struct { - // results. - Results []string `json:"results,omitempty"` +// SparkEndpoints : Spark engine endpoints. +type SparkEndpoints struct { + // Application API. This property is available only for external Spark engines. + ApplicationsApi *string `json:"applications_api,omitempty"` + + // History server endpoint. This property is available only for external Spark engines. + HistoryServerEndpoint *string `json:"history_server_endpoint,omitempty"` - // name. - TotalCount *int64 `json:"total_count,omitempty"` + // Details UI for Analytics Engine instance being used as external Spark engine. This property is available only for + // external Spark engines. + SparkAccessEndpoint *string `json:"spark_access_endpoint,omitempty"` + + // Spark jobs V4 endpoint. This property is available only for external Spark engines. + SparkJobsV4Endpoint *string `json:"spark_jobs_v4_endpoint,omitempty"` + + // Spark kernel endpoint. This property is available only for external Spark engines. + SparkKernelEndpoint *string `json:"spark_kernel_endpoint,omitempty"` + + // View history server. This property is available only for external Spark engines. + ViewHistoryServer *string `json:"view_history_server,omitempty"` + + // Native Spark engine application endpoint. This property is available only for native Spark engines. + WxdApplicationEndpoint *string `json:"wxd_application_endpoint,omitempty"` + + // Native Spark engine endpoint. This property is available only for native Spark engines. + WxdEngineEndpoint *string `json:"wxd_engine_endpoint,omitempty"` + + // Native Spark engine history server management endpoint. This property is available only for native Spark engines. + WxdHistoryServerEndpoint *string `json:"wxd_history_server_endpoint,omitempty"` + + // Native Spark engine history UI URL. This property is available only for native Spark engines. + WxdHistoryServerUiEndpoint *string `json:"wxd_history_server_ui_endpoint,omitempty"` } -// UnmarshalSalIntegrationEnrichmentJobRunLogs unmarshals an instance of SalIntegrationEnrichmentJobRunLogs from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentJobRunLogs(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentJobRunLogs) - err = core.UnmarshalPrimitive(m, "results", &obj.Results) +// UnmarshalSparkEndpoints unmarshals an instance of SparkEndpoints from the specified map of raw messages. +func UnmarshalSparkEndpoints(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEndpoints) + err = core.UnmarshalPrimitive(m, "applications_api", &obj.ApplicationsApi) if err != nil { - err = core.SDKErrorf(err, "", "results-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "applications_api-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + err = core.UnmarshalPrimitive(m, "history_server_endpoint", &obj.HistoryServerEndpoint) if err != nil { - err = core.SDKErrorf(err, "", "total_count-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "history_server_endpoint-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationEnrichmentJobs : Sal Integration Mappings object. -type SalIntegrationEnrichmentJobs struct { - // catalog name. - Jobs *SalIntegrationEnrichmentJobsProperties `json:"jobs,omitempty"` -} - -// UnmarshalSalIntegrationEnrichmentJobs unmarshals an instance of SalIntegrationEnrichmentJobs from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentJobs(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentJobs) - err = core.UnmarshalModel(m, "jobs", &obj.Jobs, UnmarshalSalIntegrationEnrichmentJobsProperties) + err = core.UnmarshalPrimitive(m, "spark_access_endpoint", &obj.SparkAccessEndpoint) if err != nil { - err = core.SDKErrorf(err, "", "jobs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "spark_access_endpoint-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationEnrichmentJobsProperties : catalog name. -type SalIntegrationEnrichmentJobsProperties struct { - // Array of result items. - Results []SalIntegrationEnrichmentJobsResultItem `json:"results,omitempty"` - - // Total number of rows. - TotalRows *int64 `json:"total_rows,omitempty"` -} - -// UnmarshalSalIntegrationEnrichmentJobsProperties unmarshals an instance of SalIntegrationEnrichmentJobsProperties from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentJobsProperties(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentJobsProperties) - err = core.UnmarshalModel(m, "results", &obj.Results, UnmarshalSalIntegrationEnrichmentJobsResultItem) + err = core.UnmarshalPrimitive(m, "spark_jobs_v4_endpoint", &obj.SparkJobsV4Endpoint) if err != nil { - err = core.SDKErrorf(err, "", "results-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "spark_jobs_v4_endpoint-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "total_rows", &obj.TotalRows) + err = core.UnmarshalPrimitive(m, "spark_kernel_endpoint", &obj.SparkKernelEndpoint) if err != nil { - err = core.SDKErrorf(err, "", "total_rows-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "spark_kernel_endpoint-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationEnrichmentJobsResultItem : A single result item containing entity and metadata. -type SalIntegrationEnrichmentJobsResultItem struct { - // Entity details including job information. - Entity *SalIntegrationEnrichmentJobsResultItemEntity `json:"entity,omitempty"` - - // Metadata information about the job. - Metadata *SalIntegrationEnrichmentJobsResultItemMetadata `json:"metadata,omitempty"` -} - -// UnmarshalSalIntegrationEnrichmentJobsResultItem unmarshals an instance of SalIntegrationEnrichmentJobsResultItem from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentJobsResultItem(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentJobsResultItem) - err = core.UnmarshalModel(m, "entity", &obj.Entity, UnmarshalSalIntegrationEnrichmentJobsResultItemEntity) + err = core.UnmarshalPrimitive(m, "view_history_server", &obj.ViewHistoryServer) if err != nil { - err = core.SDKErrorf(err, "", "entity-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "view_history_server-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "metadata", &obj.Metadata, UnmarshalSalIntegrationEnrichmentJobsResultItemMetadata) + err = core.UnmarshalPrimitive(m, "wxd_application_endpoint", &obj.WxdApplicationEndpoint) if err != nil { - err = core.SDKErrorf(err, "", "metadata-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "wxd_application_endpoint-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationEnrichmentJobsResultItemEntity : Entity details including job information. -type SalIntegrationEnrichmentJobsResultItemEntity struct { - // Details about the job. - Job *SalIntegrationEnrichmentJobsResultItemEntityJob `json:"job,omitempty"` -} - -// UnmarshalSalIntegrationEnrichmentJobsResultItemEntity unmarshals an instance of SalIntegrationEnrichmentJobsResultItemEntity from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentJobsResultItemEntity(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentJobsResultItemEntity) - err = core.UnmarshalModel(m, "job", &obj.Job, UnmarshalSalIntegrationEnrichmentJobsResultItemEntityJob) + err = core.UnmarshalPrimitive(m, "wxd_engine_endpoint", &obj.WxdEngineEndpoint) + if err != nil { + err = core.SDKErrorf(err, "", "wxd_engine_endpoint-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "wxd_history_server_endpoint", &obj.WxdHistoryServerEndpoint) if err != nil { - err = core.SDKErrorf(err, "", "job-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "wxd_history_server_endpoint-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "wxd_history_server_ui_endpoint", &obj.WxdHistoryServerUiEndpoint) + if err != nil { + err = core.SDKErrorf(err, "", "wxd_history_server_ui_endpoint-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SalIntegrationEnrichmentJobsResultItemEntityJob : Details about the job. -type SalIntegrationEnrichmentJobsResultItemEntityJob struct { - // Reference ID for the asset. - AssetRef *string `json:"asset_ref,omitempty"` +// SparkEngine : Information on the Spark engine. +type SparkEngine struct { + // Actions. + Actions []string `json:"actions" validate:"required"` - // Type of the asset reference. - AssetRefType *string `json:"asset_ref_type,omitempty"` + // Catalogs to be Associated to the engine. + AssociatedCatalogs []string `json:"associated_catalogs" validate:"required"` - // Configuration settings for the job. - Configuration *SalIntegrationEnrichmentJobsResultItemEntityJobConfiguration `json:"configuration,omitempty"` + // watsonx.data build version. + BuildVersion *string `json:"build_version,omitempty"` - // Flag indicating if notifications are enabled for the job. - EnableNotifications *bool `json:"enable_notifications,omitempty"` + // Spark engine configuration details. + Configuration *SparkEngineDetails `json:"configuration,omitempty"` - // List of future scheduled run times. - FutureScheduledRuns []string `json:"future_scheduled_runs,omitempty"` + // Created time in epoch format. + CreatedAt *int64 `json:"created_at,omitempty"` - // Initiator of the last run. - LastRunInitiator *string `json:"last_run_initiator,omitempty"` + // Username of the user who created the watsonx.data instance. + CreatedBy *string `json:"created_by,omitempty"` - // Status of the last run. - LastRunStatus *string `json:"last_run_status,omitempty"` + // Information on the Spark engine. + Description *string `json:"description,omitempty"` - // Timestamp of the last run status. - LastRunStatusTimestamp *int64 `json:"last_run_status_timestamp,omitempty"` + // Engine display name. + DisplayName *string `json:"display_name,omitempty"` - // Time of the last run. - LastRunTime *string `json:"last_run_time,omitempty"` + // Engine id. + ID *string `json:"id,omitempty"` - // Name of the project associated with the job. - ProjectName *string `json:"project_name,omitempty"` + // Mode of spark engine. + Mode *string `json:"mode,omitempty"` - // ID of the creator of the schedule. - ScheduleCreatorID *string `json:"schedule_creator_id,omitempty"` + // Origin - created or registered. + Origin *string `json:"origin" validate:"required"` - // ID of the schedule. - ScheduleID *string `json:"schedule_id,omitempty"` + // Status of engine. + Status *string `json:"status,omitempty"` - // Information about the schedule. - ScheduleInfo *ScheduleInfo `json:"schedule_info,omitempty"` + // Tags. + Tags []string `json:"tags" validate:"required"` - // Credentials support information for the task. - TaskCredentialsSupport *SalIntegrationEnrichmentJobsResultItemEntityTaskCredentialsSupport `json:"task_credentials_support,omitempty"` + // Type of spark engine. + Type *string `json:"type" validate:"required"` } -// UnmarshalSalIntegrationEnrichmentJobsResultItemEntityJob unmarshals an instance of SalIntegrationEnrichmentJobsResultItemEntityJob from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentJobsResultItemEntityJob(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentJobsResultItemEntityJob) - err = core.UnmarshalPrimitive(m, "asset_ref", &obj.AssetRef) +// Constants associated with the SparkEngine.Origin property. +// Origin - created or registered. +const ( + SparkEngine_Origin_Discover = "discover" + SparkEngine_Origin_External = "external" + SparkEngine_Origin_Native = "native" +) + +// Constants associated with the SparkEngine.Type property. +// Type of spark engine. +const ( + SparkEngine_Type_Gluten = "gluten" + SparkEngine_Type_Spark = "spark" +) + +// UnmarshalSparkEngine unmarshals an instance of SparkEngine from the specified map of raw messages. +func UnmarshalSparkEngine(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEngine) + err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) + if err != nil { + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "associated_catalogs", &obj.AssociatedCatalogs) if err != nil { - err = core.SDKErrorf(err, "", "asset_ref-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "associated_catalogs-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "asset_ref_type", &obj.AssetRefType) + err = core.UnmarshalPrimitive(m, "build_version", &obj.BuildVersion) if err != nil { - err = core.SDKErrorf(err, "", "asset_ref_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "build_version-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalSalIntegrationEnrichmentJobsResultItemEntityJobConfiguration) + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalSparkEngineDetails) if err != nil { err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "enable_notifications", &obj.EnableNotifications) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "enable_notifications-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "future_scheduled_runs", &obj.FutureScheduledRuns) + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) if err != nil { - err = core.SDKErrorf(err, "", "future_scheduled_runs-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "mode-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "last_run_initiator", &obj.LastRunInitiator) + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) if err != nil { - err = core.SDKErrorf(err, "", "last_run_initiator-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "last_run_status", &obj.LastRunStatus) + err = core.UnmarshalPrimitive(m, "status", &obj.Status) if err != nil { - err = core.SDKErrorf(err, "", "last_run_status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "last_run_status_timestamp", &obj.LastRunStatusTimestamp) + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { - err = core.SDKErrorf(err, "", "last_run_status_timestamp-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "last_run_time", &obj.LastRunTime) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "last_run_time-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "project_name", &obj.ProjectName) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SparkEngineApplicationCallback : Spark Engine Application Callback. +type SparkEngineApplicationCallback struct { + // callback url. + URL *string `json:"url,omitempty"` +} + +// UnmarshalSparkEngineApplicationCallback unmarshals an instance of SparkEngineApplicationCallback from the specified map of raw messages. +func UnmarshalSparkEngineApplicationCallback(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEngineApplicationCallback) + err = core.UnmarshalPrimitive(m, "url", &obj.URL) if err != nil { - err = core.SDKErrorf(err, "", "project_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "url-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "schedule_creator_id", &obj.ScheduleCreatorID) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SparkEngineApplicationCollection : Engine Application Detail. +type SparkEngineApplicationCollection struct { + // Application body. + Applications []SparkEngineApplicationSummary `json:"applications" validate:"required"` + + // Link to a page of results. + First *PaginationLink `json:"first,omitempty"` + + // The number of items returned per page. + Limit *int64 `json:"limit" validate:"required"` + + // Link to a page of results. + Next *PaginationLink `json:"next,omitempty"` +} + +// UnmarshalSparkEngineApplicationCollection unmarshals an instance of SparkEngineApplicationCollection from the specified map of raw messages. +func UnmarshalSparkEngineApplicationCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEngineApplicationCollection) + err = core.UnmarshalModel(m, "applications", &obj.Applications, UnmarshalSparkEngineApplicationSummary) if err != nil { - err = core.SDKErrorf(err, "", "schedule_creator_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "applications-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "schedule_id", &obj.ScheduleID) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPaginationLink) if err != nil { - err = core.SDKErrorf(err, "", "schedule_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "first-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "schedule_info", &obj.ScheduleInfo, UnmarshalScheduleInfo) + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) if err != nil { - err = core.SDKErrorf(err, "", "schedule_info-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "limit-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "task_credentials_support", &obj.TaskCredentialsSupport, UnmarshalSalIntegrationEnrichmentJobsResultItemEntityTaskCredentialsSupport) + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPaginationLink) if err != nil { - err = core.SDKErrorf(err, "", "task_credentials_support-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "next-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SalIntegrationEnrichmentJobsResultItemEntityJobConfiguration : Configuration settings for the job. -type SalIntegrationEnrichmentJobsResultItemEntityJobConfiguration struct { - // The environment type. - EnvType *string `json:"env_type,omitempty"` +// Retrieve the value to be passed to a request to access the next page of results +func (resp *SparkEngineApplicationCollection) GetNextStart() (*string, error) { + if core.IsNil(resp.Next) { + return nil, nil + } + start, err := core.GetQueryParam(resp.Next.Href, "start") + if err != nil { + err = core.SDKErrorf(err, "", "read-query-param-error", common.GetComponentInfo()) + return nil, err + } else if start == nil { + return nil, nil + } + return start, nil +} + +// SparkEngineApplicationResponse : Engine Application Status. +// This type supports additional properties of type interface{}. +type SparkEngineApplicationResponse struct { + // Application details. + ApplicationDetails *SparkApplicationDetails `json:"application_details,omitempty"` + + // Time when the application is automatically stopped. This property is available only in SAAS. + AutoTerminationTime *string `json:"auto_termination_time,omitempty"` + + // Time when the application request was accepted. Software only. + CreationTime *string `json:"creation_time,omitempty"` + + // Deployment mode. + DeployMode *string `json:"deploy_mode,omitempty"` + + // End Time. + EndTime *string `json:"end_time,omitempty"` + + // Failed time. + FailedTime *string `json:"failed_time,omitempty"` + + // Time when the application finished running or was stopped. This property is available only after the application + // finishes running. + FinishTime *string `json:"finish_time,omitempty"` + + // Application ID. + ID *string `json:"id" validate:"required"` + + // Initialization scripts to run before the application starts. + InitScripts []string `json:"init_scripts,omitempty"` + + // Maximum number of retries for the application. Supported only in watsonx.data software. + MaxRetries *string `json:"max_retries,omitempty"` + + // Minimum retry interval in seconds between retry attempts. Supported only in watsonx.data software. + MinRetryIntervalInSeconds *string `json:"min_retry_interval_in_seconds,omitempty"` + + // Current retry attempt number. + RetryAttempt *string `json:"retry_attempt,omitempty"` + + // Application runtime configuration. + Runtime *SparkApplicationRuntime `json:"runtime,omitempty"` + + // Spark application ID. + SparkApplicationID *string `json:"spark_application_id,omitempty"` + + // Spark application name. + SparkApplicationName *string `json:"spark_application_name,omitempty"` + + // Spark UI Endpoint. + SparkUi *string `json:"spark_ui,omitempty"` + + // Included if spark_version was specified in application creation request or a default value was set in spark engine + // details. + SparkVersion *string `json:"spark_version,omitempty"` + + // Time when the application started running. This property is available only if/after the application starts running. + StartTime *string `json:"start_time,omitempty"` - // Environment variables for the job. - EnvVariables []string `json:"env_variables,omitempty"` -} + // Application state. + State *string `json:"state" validate:"required"` -// UnmarshalSalIntegrationEnrichmentJobsResultItemEntityJobConfiguration unmarshals an instance of SalIntegrationEnrichmentJobsResultItemEntityJobConfiguration from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentJobsResultItemEntityJobConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentJobsResultItemEntityJobConfiguration) - err = core.UnmarshalPrimitive(m, "env_type", &obj.EnvType) - if err != nil { - err = core.SDKErrorf(err, "", "env_type-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "env_variables", &obj.EnvVariables) - if err != nil { - err = core.SDKErrorf(err, "", "env_variables-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} + // Application state details. + StateDetails []SparkApplicationStateDetail `json:"state_details,omitempty"` -// SalIntegrationEnrichmentJobsResultItemEntityTaskCredentialsSupport : Credentials support information for the task. -type SalIntegrationEnrichmentJobsResultItemEntityTaskCredentialsSupport struct { - // The account ID associated with the task. - AccountID *string `json:"account_id,omitempty"` + // Time when the request was accepted. SAAS only. + SubmissionTime *string `json:"submission_time,omitempty"` - // Indicates if task credentials are enabled. - TaskCredentialsEnabled *bool `json:"task_credentials_enabled,omitempty"` + // Image template id based on spark version. Software only. + TemplateID *string `json:"template_id,omitempty"` + + // Wxd history_server endpoint. + WxdApplicationUiEndpoint *string `json:"wxd_application_ui_endpoint,omitempty"` - // The user ID associated with the task. - UserID *string `json:"user_id,omitempty"` + // Allows users to set arbitrary properties of type interface{}. + additionalProperties map[string]interface{} } -// UnmarshalSalIntegrationEnrichmentJobsResultItemEntityTaskCredentialsSupport unmarshals an instance of SalIntegrationEnrichmentJobsResultItemEntityTaskCredentialsSupport from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentJobsResultItemEntityTaskCredentialsSupport(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentJobsResultItemEntityTaskCredentialsSupport) - err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) - if err != nil { - err = core.SDKErrorf(err, "", "account_id-error", common.GetComponentInfo()) - return +// SetProperty allows the user to set an arbitrary property on an instance of SparkEngineApplicationResponse. +func (o *SparkEngineApplicationResponse) SetProperty(key string, value interface{}) { + if o.additionalProperties == nil { + o.additionalProperties = make(map[string]interface{}) } - err = core.UnmarshalPrimitive(m, "task_credentials_enabled", &obj.TaskCredentialsEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "task_credentials_enabled-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "user_id", &obj.UserID) - if err != nil { - err = core.SDKErrorf(err, "", "user_id-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return + o.additionalProperties[key] = value } -// SalIntegrationEnrichmentJobsResultItemMetadata : Metadata information about the job. -type SalIntegrationEnrichmentJobsResultItemMetadata struct { - // The ID of the asset. - AssetID *string `json:"asset_id,omitempty"` - - // Name of the job. - Name *string `json:"name,omitempty"` +// SetProperties allows the user to set a map of arbitrary properties on an instance of SparkEngineApplicationResponse. +func (o *SparkEngineApplicationResponse) SetProperties(m map[string]interface{}) { + o.additionalProperties = make(map[string]interface{}) + for k, v := range m { + o.additionalProperties[k] = v + } +} - // ID of the owner of the job. - OwnerID *string `json:"owner_id,omitempty"` +// GetProperty allows the user to retrieve an arbitrary property from an instance of SparkEngineApplicationResponse. +func (o *SparkEngineApplicationResponse) GetProperty(key string) interface{} { + return o.additionalProperties[key] +} - // Version of the job. - Version *int64 `json:"version,omitempty"` +// GetProperties allows the user to retrieve the map of arbitrary properties from an instance of SparkEngineApplicationResponse. +func (o *SparkEngineApplicationResponse) GetProperties() map[string]interface{} { + return o.additionalProperties } -// UnmarshalSalIntegrationEnrichmentJobsResultItemMetadata unmarshals an instance of SalIntegrationEnrichmentJobsResultItemMetadata from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentJobsResultItemMetadata(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentJobsResultItemMetadata) - err = core.UnmarshalPrimitive(m, "asset_id", &obj.AssetID) - if err != nil { - err = core.SDKErrorf(err, "", "asset_id-error", common.GetComponentInfo()) - return +// MarshalJSON performs custom serialization for instances of SparkEngineApplicationResponse +func (o *SparkEngineApplicationResponse) MarshalJSON() (buffer []byte, err error) { + m := make(map[string]interface{}) + if len(o.additionalProperties) > 0 { + for k, v := range o.additionalProperties { + m[k] = v + } } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) - if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) - return + if o.ApplicationDetails != nil { + m["application_details"] = o.ApplicationDetails } - err = core.UnmarshalPrimitive(m, "owner_id", &obj.OwnerID) - if err != nil { - err = core.SDKErrorf(err, "", "owner_id-error", common.GetComponentInfo()) - return + if o.AutoTerminationTime != nil { + m["auto_termination_time"] = o.AutoTerminationTime } - err = core.UnmarshalPrimitive(m, "version", &obj.Version) - if err != nil { - err = core.SDKErrorf(err, "", "version-error", common.GetComponentInfo()) - return + if o.CreationTime != nil { + m["creation_time"] = o.CreationTime } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationEnrichmentSettings : Sal Integration Enrichment Settings objects. -type SalIntegrationEnrichmentSettings struct { - // semantic expansion. - SemanticExpansion *SalIntegrationEnrichmentSettingsSemanticExpansion `json:"semantic_expansion,omitempty"` - - // semantic expansion. - TermAssignment *SalIntegrationEnrichmentSettingsTermAssignment `json:"term_assignment,omitempty"` -} - -// UnmarshalSalIntegrationEnrichmentSettings unmarshals an instance of SalIntegrationEnrichmentSettings from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentSettings(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentSettings) - err = core.UnmarshalModel(m, "semantic_expansion", &obj.SemanticExpansion, UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansion) - if err != nil { - err = core.SDKErrorf(err, "", "semantic_expansion-error", common.GetComponentInfo()) - return + if o.DeployMode != nil { + m["deploy_mode"] = o.DeployMode } - err = core.UnmarshalModel(m, "term_assignment", &obj.TermAssignment, UnmarshalSalIntegrationEnrichmentSettingsTermAssignment) + if o.EndTime != nil { + m["end_time"] = o.EndTime + } + if o.FailedTime != nil { + m["failed_time"] = o.FailedTime + } + if o.FinishTime != nil { + m["finish_time"] = o.FinishTime + } + if o.ID != nil { + m["id"] = o.ID + } + if o.InitScripts != nil { + m["init_scripts"] = o.InitScripts + } + if o.MaxRetries != nil { + m["max_retries"] = o.MaxRetries + } + if o.MinRetryIntervalInSeconds != nil { + m["min_retry_interval_in_seconds"] = o.MinRetryIntervalInSeconds + } + if o.RetryAttempt != nil { + m["retry_attempt"] = o.RetryAttempt + } + if o.Runtime != nil { + m["runtime"] = o.Runtime + } + if o.SparkApplicationID != nil { + m["spark_application_id"] = o.SparkApplicationID + } + if o.SparkApplicationName != nil { + m["spark_application_name"] = o.SparkApplicationName + } + if o.SparkUi != nil { + m["spark_ui"] = o.SparkUi + } + if o.SparkVersion != nil { + m["spark_version"] = o.SparkVersion + } + if o.StartTime != nil { + m["start_time"] = o.StartTime + } + if o.State != nil { + m["state"] = o.State + } + if o.StateDetails != nil { + m["state_details"] = o.StateDetails + } + if o.SubmissionTime != nil { + m["submission_time"] = o.SubmissionTime + } + if o.TemplateID != nil { + m["template_id"] = o.TemplateID + } + if o.WxdApplicationUiEndpoint != nil { + m["wxd_application_ui_endpoint"] = o.WxdApplicationUiEndpoint + } + buffer, err = json.Marshal(m) if err != nil { - err = core.SDKErrorf(err, "", "term_assignment-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-marshal", common.GetComponentInfo()) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SalIntegrationEnrichmentSettingsSemanticExpansion : semantic expansion. -type SalIntegrationEnrichmentSettingsSemanticExpansion struct { - // description generation. - DescriptionGeneration *bool `json:"description_generation,omitempty"` - - // description generation configuration. - DescriptionGenerationConfiguration *SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration `json:"description_generation_configuration,omitempty"` - - // name expansion. - NameExpansion *bool `json:"name_expansion,omitempty"` - - // name expansion configuration. - NameExpansionConfiguration *SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration `json:"name_expansion_configuration,omitempty"` -} - -// UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansion unmarshals an instance of SalIntegrationEnrichmentSettingsSemanticExpansion from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansion(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentSettingsSemanticExpansion) - err = core.UnmarshalPrimitive(m, "description_generation", &obj.DescriptionGeneration) - if err != nil { - err = core.SDKErrorf(err, "", "description_generation-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "description_generation_configuration", &obj.DescriptionGenerationConfiguration, UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) +// UnmarshalSparkEngineApplicationResponse unmarshals an instance of SparkEngineApplicationResponse from the specified map of raw messages. +func UnmarshalSparkEngineApplicationResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEngineApplicationResponse) + err = core.UnmarshalModel(m, "application_details", &obj.ApplicationDetails, UnmarshalSparkApplicationDetails) if err != nil { - err = core.SDKErrorf(err, "", "description_generation_configuration-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "application_details-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name_expansion", &obj.NameExpansion) + delete(m, "application_details") + err = core.UnmarshalPrimitive(m, "auto_termination_time", &obj.AutoTerminationTime) if err != nil { - err = core.SDKErrorf(err, "", "name_expansion-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auto_termination_time-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "name_expansion_configuration", &obj.NameExpansionConfiguration, UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) + delete(m, "auto_termination_time") + err = core.UnmarshalPrimitive(m, "creation_time", &obj.CreationTime) if err != nil { - err = core.SDKErrorf(err, "", "name_expansion_configuration-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "creation_time-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration : description generation configuration. -type SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration struct { - // assignment threshold. - AssignmentThreshold *float64 `json:"assignment_threshold,omitempty"` - - // suggestion threshold. - SuggestionThreshold *float64 `json:"suggestion_threshold,omitempty"` -} - -// UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration unmarshals an instance of SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) - err = core.UnmarshalPrimitive(m, "assignment_threshold", &obj.AssignmentThreshold) + delete(m, "creation_time") + err = core.UnmarshalPrimitive(m, "deploy_mode", &obj.DeployMode) if err != nil { - err = core.SDKErrorf(err, "", "assignment_threshold-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "deploy_mode-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "suggestion_threshold", &obj.SuggestionThreshold) + delete(m, "deploy_mode") + err = core.UnmarshalPrimitive(m, "end_time", &obj.EndTime) if err != nil { - err = core.SDKErrorf(err, "", "suggestion_threshold-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "end_time-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration : name expansion configuration. -type SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration struct { - // assignment threshold. - AssignmentThreshold *float64 `json:"assignment_threshold,omitempty"` - - // suggestion threshold. - SuggestionThreshold *float64 `json:"suggestion_threshold,omitempty"` -} - -// UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration unmarshals an instance of SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) - err = core.UnmarshalPrimitive(m, "assignment_threshold", &obj.AssignmentThreshold) + delete(m, "end_time") + err = core.UnmarshalPrimitive(m, "failed_time", &obj.FailedTime) if err != nil { - err = core.SDKErrorf(err, "", "assignment_threshold-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "failed_time-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "suggestion_threshold", &obj.SuggestionThreshold) + delete(m, "failed_time") + err = core.UnmarshalPrimitive(m, "finish_time", &obj.FinishTime) if err != nil { - err = core.SDKErrorf(err, "", "suggestion_threshold-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "finish_time-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationEnrichmentSettingsTermAssignment : semantic expansion. -type SalIntegrationEnrichmentSettingsTermAssignment struct { - // class based assignments. - ClassBasedAssignments *bool `json:"class_based_assignments,omitempty"` - - // evaluate negative assignments. - EvaluateNegativeAssignments *bool `json:"evaluate_negative_assignments,omitempty"` - - // llm based assignments. - LlmBasedAssignments *bool `json:"llm_based_assignments,omitempty"` - - // ml based assignments custom. - MlBasedAssignmentsCustom *bool `json:"ml_based_assignments_custom,omitempty"` - - // ml based assignments default. - MlBasedAssignmentsDefault *bool `json:"ml_based_assignments_default,omitempty"` - - // name matching. - NameMatching *bool `json:"name_matching,omitempty"` - - // term assignment threshold. - TermAssignmentThreshold *float64 `json:"term_assignment_threshold,omitempty"` - - // term suggestion threshold. - TermSuggestionThreshold *float64 `json:"term_suggestion_threshold,omitempty"` -} - -// UnmarshalSalIntegrationEnrichmentSettingsTermAssignment unmarshals an instance of SalIntegrationEnrichmentSettingsTermAssignment from the specified map of raw messages. -func UnmarshalSalIntegrationEnrichmentSettingsTermAssignment(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationEnrichmentSettingsTermAssignment) - err = core.UnmarshalPrimitive(m, "class_based_assignments", &obj.ClassBasedAssignments) + delete(m, "finish_time") + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "class_based_assignments-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "evaluate_negative_assignments", &obj.EvaluateNegativeAssignments) + delete(m, "id") + err = core.UnmarshalPrimitive(m, "init_scripts", &obj.InitScripts) if err != nil { - err = core.SDKErrorf(err, "", "evaluate_negative_assignments-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "init_scripts-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "llm_based_assignments", &obj.LlmBasedAssignments) + delete(m, "init_scripts") + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) if err != nil { - err = core.SDKErrorf(err, "", "llm_based_assignments-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "ml_based_assignments_custom", &obj.MlBasedAssignmentsCustom) + delete(m, "max_retries") + err = core.UnmarshalPrimitive(m, "min_retry_interval_in_seconds", &obj.MinRetryIntervalInSeconds) if err != nil { - err = core.SDKErrorf(err, "", "ml_based_assignments_custom-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "min_retry_interval_in_seconds-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "ml_based_assignments_default", &obj.MlBasedAssignmentsDefault) + delete(m, "min_retry_interval_in_seconds") + err = core.UnmarshalPrimitive(m, "retry_attempt", &obj.RetryAttempt) if err != nil { - err = core.SDKErrorf(err, "", "ml_based_assignments_default-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "retry_attempt-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name_matching", &obj.NameMatching) + delete(m, "retry_attempt") + err = core.UnmarshalModel(m, "runtime", &obj.Runtime, UnmarshalSparkApplicationRuntime) if err != nil { - err = core.SDKErrorf(err, "", "name_matching-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "runtime-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "term_assignment_threshold", &obj.TermAssignmentThreshold) + delete(m, "runtime") + err = core.UnmarshalPrimitive(m, "spark_application_id", &obj.SparkApplicationID) if err != nil { - err = core.SDKErrorf(err, "", "term_assignment_threshold-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "spark_application_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "term_suggestion_threshold", &obj.TermSuggestionThreshold) + delete(m, "spark_application_id") + err = core.UnmarshalPrimitive(m, "spark_application_name", &obj.SparkApplicationName) if err != nil { - err = core.SDKErrorf(err, "", "term_suggestion_threshold-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "spark_application_name-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationGlossaryTerms : Sal integration glossary terms. -type SalIntegrationGlossaryTerms struct { - // glossary object. - GlossaryTerm *GlossaryObject `json:"glossary_term,omitempty"` -} - -// UnmarshalSalIntegrationGlossaryTerms unmarshals an instance of SalIntegrationGlossaryTerms from the specified map of raw messages. -func UnmarshalSalIntegrationGlossaryTerms(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationGlossaryTerms) - err = core.UnmarshalModel(m, "glossary_term", &obj.GlossaryTerm, UnmarshalGlossaryObject) + delete(m, "spark_application_name") + err = core.UnmarshalPrimitive(m, "spark_ui", &obj.SparkUi) if err != nil { - err = core.SDKErrorf(err, "", "glossary_term-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "spark_ui-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationMappings : Sal Integration Mappings object. -type SalIntegrationMappings struct { - // catalog name. - WkcCatalogID *string `json:"wkc_catalog_id,omitempty"` - - // operation type. - WkcProjectID *string `json:"wkc_project_id,omitempty"` -} - -// UnmarshalSalIntegrationMappings unmarshals an instance of SalIntegrationMappings from the specified map of raw messages. -func UnmarshalSalIntegrationMappings(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationMappings) - err = core.UnmarshalPrimitive(m, "wkc_catalog_id", &obj.WkcCatalogID) + delete(m, "spark_ui") + err = core.UnmarshalPrimitive(m, "spark_version", &obj.SparkVersion) if err != nil { - err = core.SDKErrorf(err, "", "wkc_catalog_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "spark_version-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "wkc_project_id", &obj.WkcProjectID) + delete(m, "spark_version") + err = core.UnmarshalPrimitive(m, "start_time", &obj.StartTime) if err != nil { - err = core.SDKErrorf(err, "", "wkc_project_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "start_time-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationPatch : update sal integration. -type SalIntegrationPatch struct { - // op. - Op *string `json:"op,omitempty"` - - // path. - Path *string `json:"path,omitempty"` - - // path. - Value *string `json:"value,omitempty"` -} - -// UnmarshalSalIntegrationPatch unmarshals an instance of SalIntegrationPatch from the specified map of raw messages. -func UnmarshalSalIntegrationPatch(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationPatch) - err = core.UnmarshalPrimitive(m, "op", &obj.Op) + delete(m, "start_time") + err = core.UnmarshalPrimitive(m, "state", &obj.State) if err != nil { - err = core.SDKErrorf(err, "", "op-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "path", &obj.Path) + delete(m, "state") + err = core.UnmarshalModel(m, "state_details", &obj.StateDetails, UnmarshalSparkApplicationStateDetail) if err != nil { - err = core.SDKErrorf(err, "", "path-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "state_details-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "value", &obj.Value) + delete(m, "state_details") + err = core.UnmarshalPrimitive(m, "submission_time", &obj.SubmissionTime) if err != nil { - err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "submission_time-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// AsPatch returns a generic map representation of the SalIntegrationPatch -func (salIntegrationPatch *SalIntegrationPatch) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(salIntegrationPatch.Op) { - _patch["op"] = salIntegrationPatch.Op - } - if !core.IsNil(salIntegrationPatch.Path) { - _patch["path"] = salIntegrationPatch.Path - } - if !core.IsNil(salIntegrationPatch.Value) { - _patch["value"] = salIntegrationPatch.Value - } - - return -} - -// SalIntegrationUploadGlossary : Sal Integration Upload Glossary. -type SalIntegrationUploadGlossary struct { - // catalog name. - ProcessID *string `json:"process_id,omitempty"` -} - -// UnmarshalSalIntegrationUploadGlossary unmarshals an instance of SalIntegrationUploadGlossary from the specified map of raw messages. -func UnmarshalSalIntegrationUploadGlossary(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationUploadGlossary) - err = core.UnmarshalPrimitive(m, "process_id", &obj.ProcessID) + delete(m, "submission_time") + err = core.UnmarshalPrimitive(m, "template_id", &obj.TemplateID) if err != nil { - err = core.SDKErrorf(err, "", "process_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "template_id-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SalIntegrationUploadGlossaryStatus : Sal Integration Upload Glossary Status. -type SalIntegrationUploadGlossaryStatus struct { - // catalog status. - Response *string `json:"response,omitempty"` -} - -// UnmarshalSalIntegrationUploadGlossaryStatus unmarshals an instance of SalIntegrationUploadGlossaryStatus from the specified map of raw messages. -func UnmarshalSalIntegrationUploadGlossaryStatus(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SalIntegrationUploadGlossaryStatus) - err = core.UnmarshalPrimitive(m, "response", &obj.Response) + delete(m, "template_id") + err = core.UnmarshalPrimitive(m, "wxd_application_ui_endpoint", &obj.WxdApplicationUiEndpoint) if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "wxd_application_ui_endpoint-error", common.GetComponentInfo()) return } + delete(m, "wxd_application_ui_endpoint") + for k := range m { + var v interface{} + e := core.UnmarshalPrimitive(m, k, &v) + if e != nil { + err = core.SDKErrorf(e, "", "additional-properties-error", common.GetComponentInfo()) + return + } + obj.SetProperty(k, v) + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// ScalePrestissimoEngineOptions : The ScalePrestissimoEngine options. -type ScalePrestissimoEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` - - // coordinator/worker property settings. - Coordinator *PrestissimoNodeDescriptionBody `json:"coordinator,omitempty"` +// SparkEngineApplicationSummary : Engine Application Status. +// This type supports additional properties of type interface{}. +type SparkEngineApplicationSummary struct { + // Time when the application is automatically stopped. This property is available only in SAAS. + AutoTerminationTime *string `json:"auto_termination_time,omitempty"` - // coordinator/worker property settings. - Worker *PrestissimoNodeDescriptionBody `json:"worker,omitempty"` + // Time when the application request was accepted. Software only. + CreationTime *string `json:"creation_time,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Deployment mode. + DeployMode *string `json:"deploy_mode,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string -} + // End Time. + EndTime *string `json:"end_time,omitempty"` -// NewScalePrestissimoEngineOptions : Instantiate ScalePrestissimoEngineOptions -func (*WatsonxDataV2) NewScalePrestissimoEngineOptions(engineID string) *ScalePrestissimoEngineOptions { - return &ScalePrestissimoEngineOptions{ - EngineID: core.StringPtr(engineID), - } -} + // Failed time. + FailedTime *string `json:"failed_time,omitempty"` -// SetEngineID : Allow user to set EngineID -func (_options *ScalePrestissimoEngineOptions) SetEngineID(engineID string) *ScalePrestissimoEngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} + // Time when the application finished running or was stopped. This property is available only after the application + // finishes running. + FinishTime *string `json:"finish_time,omitempty"` -// SetCoordinator : Allow user to set Coordinator -func (_options *ScalePrestissimoEngineOptions) SetCoordinator(coordinator *PrestissimoNodeDescriptionBody) *ScalePrestissimoEngineOptions { - _options.Coordinator = coordinator - return _options -} + // Application ID. + ID *string `json:"id" validate:"required"` -// SetWorker : Allow user to set Worker -func (_options *ScalePrestissimoEngineOptions) SetWorker(worker *PrestissimoNodeDescriptionBody) *ScalePrestissimoEngineOptions { - _options.Worker = worker - return _options -} + // Unique key to ensure idempotent operation. + IdempotencyKey *string `json:"idempotency_key,omitempty"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ScalePrestissimoEngineOptions) SetAuthInstanceID(authInstanceID string) *ScalePrestissimoEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} + // Initialization scripts to run before the application starts. + InitScripts []string `json:"init_scripts,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *ScalePrestissimoEngineOptions) SetHeaders(param map[string]string) *ScalePrestissimoEngineOptions { - options.Headers = param - return options -} + // Maximum number of retries for the application. Supported only in watsonx.data software. + MaxRetries *string `json:"max_retries,omitempty"` -// ScalePrestoEngineOptions : The ScalePrestoEngine options. -type ScalePrestoEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + // Minimum retry interval in seconds between retry attempts. Supported only in watsonx.data software. + MinRetryIntervalInSeconds *string `json:"min_retry_interval_in_seconds,omitempty"` - // NodeDescription. - Coordinator *NodeDescription `json:"coordinator,omitempty"` + // Current retry attempt number. Supported only in watsonx.data software. + RetryAttempt *string `json:"retry_attempt,omitempty"` - // NodeDescription. - Worker *NodeDescription `json:"worker,omitempty"` + // Application runtime configuration. + Runtime *SparkApplicationRuntime `json:"runtime,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Spark application ID. + SparkApplicationID *string `json:"spark_application_id,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string -} + // Spark application name. + SparkApplicationName *string `json:"spark_application_name,omitempty"` -// NewScalePrestoEngineOptions : Instantiate ScalePrestoEngineOptions -func (*WatsonxDataV2) NewScalePrestoEngineOptions(engineID string) *ScalePrestoEngineOptions { - return &ScalePrestoEngineOptions{ - EngineID: core.StringPtr(engineID), - } -} + // Spark UI Endpoint. + SparkUi *string `json:"spark_ui,omitempty"` -// SetEngineID : Allow user to set EngineID -func (_options *ScalePrestoEngineOptions) SetEngineID(engineID string) *ScalePrestoEngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} + // Included if spark_version was specified in application creation request or a default value was set in spark engine + // details. + SparkVersion *string `json:"spark_version,omitempty"` -// SetCoordinator : Allow user to set Coordinator -func (_options *ScalePrestoEngineOptions) SetCoordinator(coordinator *NodeDescription) *ScalePrestoEngineOptions { - _options.Coordinator = coordinator - return _options -} + // Time when the application started running. This property is available only if/after the application starts running. + StartTime *string `json:"start_time,omitempty"` -// SetWorker : Allow user to set Worker -func (_options *ScalePrestoEngineOptions) SetWorker(worker *NodeDescription) *ScalePrestoEngineOptions { - _options.Worker = worker - return _options -} + // Application state. + State *string `json:"state" validate:"required"` -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ScalePrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *ScalePrestoEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} + // Application state details. + StateDetails []SparkApplicationStateDetail `json:"state_details,omitempty"` -// SetHeaders : Allow user to set Headers -func (options *ScalePrestoEngineOptions) SetHeaders(param map[string]string) *ScalePrestoEngineOptions { - options.Headers = param - return options -} + // Time when the request was accepted. SAAS only. + SubmissionTime *string `json:"submission_time,omitempty"` -// ScaleSparkEngineOptions : The ScaleSparkEngine options. -type ScaleSparkEngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + // Image template id based on spark version. Software only. + TemplateID *string `json:"template_id,omitempty"` - // Node count. - NumberOfNodes *int64 `json:"number_of_nodes,omitempty"` + // Timeout for the application in seconds. + TimeoutInSeconds *string `json:"timeout_in_seconds,omitempty"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Wxd history_server endpoint. + WxdApplicationUiEndpoint *string `json:"wxd_application_ui_endpoint,omitempty"` - // Allows users to set headers on API requests. - Headers map[string]string + // Allows users to set arbitrary properties of type interface{}. + additionalProperties map[string]interface{} } -// NewScaleSparkEngineOptions : Instantiate ScaleSparkEngineOptions -func (*WatsonxDataV2) NewScaleSparkEngineOptions(engineID string) *ScaleSparkEngineOptions { - return &ScaleSparkEngineOptions{ - EngineID: core.StringPtr(engineID), +// SetProperty allows the user to set an arbitrary property on an instance of SparkEngineApplicationSummary. +func (o *SparkEngineApplicationSummary) SetProperty(key string, value interface{}) { + if o.additionalProperties == nil { + o.additionalProperties = make(map[string]interface{}) } + o.additionalProperties[key] = value } -// SetEngineID : Allow user to set EngineID -func (_options *ScaleSparkEngineOptions) SetEngineID(engineID string) *ScaleSparkEngineOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetNumberOfNodes : Allow user to set NumberOfNodes -func (_options *ScaleSparkEngineOptions) SetNumberOfNodes(numberOfNodes int64) *ScaleSparkEngineOptions { - _options.NumberOfNodes = core.Int64Ptr(numberOfNodes) - return _options -} - -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *ScaleSparkEngineOptions) SetAuthInstanceID(authInstanceID string) *ScaleSparkEngineOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options +// SetProperties allows the user to set a map of arbitrary properties on an instance of SparkEngineApplicationSummary. +func (o *SparkEngineApplicationSummary) SetProperties(m map[string]interface{}) { + o.additionalProperties = make(map[string]interface{}) + for k, v := range m { + o.additionalProperties[k] = v + } } -// SetHeaders : Allow user to set Headers -func (options *ScaleSparkEngineOptions) SetHeaders(param map[string]string) *ScaleSparkEngineOptions { - options.Headers = param - return options +// GetProperty allows the user to retrieve an arbitrary property from an instance of SparkEngineApplicationSummary. +func (o *SparkEngineApplicationSummary) GetProperty(key string) interface{} { + return o.additionalProperties[key] } -// ScheduleInfo : Information about the schedule. -type ScheduleInfo struct { - // Frequency of schedule execution (e.g., daily, weekly, monthly). - Frequency *string `json:"frequency,omitempty"` +// GetProperties allows the user to retrieve the map of arbitrary properties from an instance of SparkEngineApplicationSummary. +func (o *SparkEngineApplicationSummary) GetProperties() map[string]interface{} { + return o.additionalProperties } -// UnmarshalScheduleInfo unmarshals an instance of ScheduleInfo from the specified map of raw messages. -func UnmarshalScheduleInfo(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ScheduleInfo) - err = core.UnmarshalPrimitive(m, "frequency", &obj.Frequency) +// MarshalJSON performs custom serialization for instances of SparkEngineApplicationSummary +func (o *SparkEngineApplicationSummary) MarshalJSON() (buffer []byte, err error) { + m := make(map[string]interface{}) + if len(o.additionalProperties) > 0 { + for k, v := range o.additionalProperties { + m[k] = v + } + } + if o.AutoTerminationTime != nil { + m["auto_termination_time"] = o.AutoTerminationTime + } + if o.CreationTime != nil { + m["creation_time"] = o.CreationTime + } + if o.DeployMode != nil { + m["deploy_mode"] = o.DeployMode + } + if o.EndTime != nil { + m["end_time"] = o.EndTime + } + if o.FailedTime != nil { + m["failed_time"] = o.FailedTime + } + if o.FinishTime != nil { + m["finish_time"] = o.FinishTime + } + if o.ID != nil { + m["id"] = o.ID + } + if o.IdempotencyKey != nil { + m["idempotency_key"] = o.IdempotencyKey + } + if o.InitScripts != nil { + m["init_scripts"] = o.InitScripts + } + if o.MaxRetries != nil { + m["max_retries"] = o.MaxRetries + } + if o.MinRetryIntervalInSeconds != nil { + m["min_retry_interval_in_seconds"] = o.MinRetryIntervalInSeconds + } + if o.RetryAttempt != nil { + m["retry_attempt"] = o.RetryAttempt + } + if o.Runtime != nil { + m["runtime"] = o.Runtime + } + if o.SparkApplicationID != nil { + m["spark_application_id"] = o.SparkApplicationID + } + if o.SparkApplicationName != nil { + m["spark_application_name"] = o.SparkApplicationName + } + if o.SparkUi != nil { + m["spark_ui"] = o.SparkUi + } + if o.SparkVersion != nil { + m["spark_version"] = o.SparkVersion + } + if o.StartTime != nil { + m["start_time"] = o.StartTime + } + if o.State != nil { + m["state"] = o.State + } + if o.StateDetails != nil { + m["state_details"] = o.StateDetails + } + if o.SubmissionTime != nil { + m["submission_time"] = o.SubmissionTime + } + if o.TemplateID != nil { + m["template_id"] = o.TemplateID + } + if o.TimeoutInSeconds != nil { + m["timeout_in_seconds"] = o.TimeoutInSeconds + } + if o.WxdApplicationUiEndpoint != nil { + m["wxd_application_ui_endpoint"] = o.WxdApplicationUiEndpoint + } + buffer, err = json.Marshal(m) if err != nil { - err = core.SDKErrorf(err, "", "frequency-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-marshal", common.GetComponentInfo()) } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SchemaResponse : Summary of the schema response. -type SchemaResponse struct { - // The bucket linked to the catalog. - Bucket *string `json:"bucket,omitempty"` - - // The catalog that this schema is associated to. - Catalog *string `json:"catalog,omitempty"` - - // Response message string. - Message *string `json:"message,omitempty"` - - // Message code string. - MessageCode *string `json:"message_code,omitempty"` - - // Owner of the bucket. - Owner *string `json:"owner,omitempty"` - - // Summary of the schema response. - Schema *SchemaResponseSummary `json:"schema,omitempty"` - - // Name of the schema. - SchemaName *string `json:"schema_name,omitempty"` -} - -// UnmarshalSchemaResponse unmarshals an instance of SchemaResponse from the specified map of raw messages. -func UnmarshalSchemaResponse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SchemaResponse) - err = core.UnmarshalPrimitive(m, "bucket", &obj.Bucket) +// UnmarshalSparkEngineApplicationSummary unmarshals an instance of SparkEngineApplicationSummary from the specified map of raw messages. +func UnmarshalSparkEngineApplicationSummary(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEngineApplicationSummary) + err = core.UnmarshalPrimitive(m, "auto_termination_time", &obj.AutoTerminationTime) if err != nil { - err = core.SDKErrorf(err, "", "bucket-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auto_termination_time-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "catalog", &obj.Catalog) + delete(m, "auto_termination_time") + err = core.UnmarshalPrimitive(m, "creation_time", &obj.CreationTime) if err != nil { - err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "creation_time-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) + delete(m, "creation_time") + err = core.UnmarshalPrimitive(m, "deploy_mode", &obj.DeployMode) if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "deploy_mode-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "message_code", &obj.MessageCode) + delete(m, "deploy_mode") + err = core.UnmarshalPrimitive(m, "end_time", &obj.EndTime) if err != nil { - err = core.SDKErrorf(err, "", "message_code-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "end_time-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) + delete(m, "end_time") + err = core.UnmarshalPrimitive(m, "failed_time", &obj.FailedTime) if err != nil { - err = core.SDKErrorf(err, "", "owner-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "failed_time-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "schema", &obj.Schema, UnmarshalSchemaResponseSummary) + delete(m, "failed_time") + err = core.UnmarshalPrimitive(m, "finish_time", &obj.FinishTime) if err != nil { - err = core.SDKErrorf(err, "", "schema-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "finish_time-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "schema_name", &obj.SchemaName) + delete(m, "finish_time") + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "schema_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SchemaResponseCollection : Schema response for list all schemas. -type SchemaResponseCollection struct { - // Response message string. - Message *string `json:"message,omitempty"` - - // Message code string. - MessageCode *string `json:"message_code,omitempty"` - - // A list of all schemas. - Schemas []SchemaResponseSummary `json:"schemas,omitempty"` -} - -// UnmarshalSchemaResponseCollection unmarshals an instance of SchemaResponseCollection from the specified map of raw messages. -func UnmarshalSchemaResponseCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SchemaResponseCollection) - err = core.UnmarshalPrimitive(m, "message", &obj.Message) + delete(m, "id") + err = core.UnmarshalPrimitive(m, "idempotency_key", &obj.IdempotencyKey) if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "idempotency_key-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "message_code", &obj.MessageCode) + delete(m, "idempotency_key") + err = core.UnmarshalPrimitive(m, "init_scripts", &obj.InitScripts) if err != nil { - err = core.SDKErrorf(err, "", "message_code-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "init_scripts-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "schemas", &obj.Schemas, UnmarshalSchemaResponseSummary) + delete(m, "init_scripts") + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) if err != nil { - err = core.SDKErrorf(err, "", "schemas-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "max_retries-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SchemaResponseSummary : Summary of the schema response. -type SchemaResponseSummary struct { - // The bucket linked to the catalog. - Bucket *string `json:"bucket,omitempty"` - - // The catalog that this schema is associated to. - Catalog *string `json:"catalog,omitempty"` - - // Owner of the bucket. - Owner *string `json:"owner,omitempty"` - - // Name of the schema. - SchemaName *string `json:"schema_name,omitempty"` -} - -// UnmarshalSchemaResponseSummary unmarshals an instance of SchemaResponseSummary from the specified map of raw messages. -func UnmarshalSchemaResponseSummary(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SchemaResponseSummary) - err = core.UnmarshalPrimitive(m, "bucket", &obj.Bucket) + delete(m, "max_retries") + err = core.UnmarshalPrimitive(m, "min_retry_interval_in_seconds", &obj.MinRetryIntervalInSeconds) + if err != nil { + err = core.SDKErrorf(err, "", "min_retry_interval_in_seconds-error", common.GetComponentInfo()) + return + } + delete(m, "min_retry_interval_in_seconds") + err = core.UnmarshalPrimitive(m, "retry_attempt", &obj.RetryAttempt) + if err != nil { + err = core.SDKErrorf(err, "", "retry_attempt-error", common.GetComponentInfo()) + return + } + delete(m, "retry_attempt") + err = core.UnmarshalModel(m, "runtime", &obj.Runtime, UnmarshalSparkApplicationRuntime) + if err != nil { + err = core.SDKErrorf(err, "", "runtime-error", common.GetComponentInfo()) + return + } + delete(m, "runtime") + err = core.UnmarshalPrimitive(m, "spark_application_id", &obj.SparkApplicationID) + if err != nil { + err = core.SDKErrorf(err, "", "spark_application_id-error", common.GetComponentInfo()) + return + } + delete(m, "spark_application_id") + err = core.UnmarshalPrimitive(m, "spark_application_name", &obj.SparkApplicationName) + if err != nil { + err = core.SDKErrorf(err, "", "spark_application_name-error", common.GetComponentInfo()) + return + } + delete(m, "spark_application_name") + err = core.UnmarshalPrimitive(m, "spark_ui", &obj.SparkUi) + if err != nil { + err = core.SDKErrorf(err, "", "spark_ui-error", common.GetComponentInfo()) + return + } + delete(m, "spark_ui") + err = core.UnmarshalPrimitive(m, "spark_version", &obj.SparkVersion) + if err != nil { + err = core.SDKErrorf(err, "", "spark_version-error", common.GetComponentInfo()) + return + } + delete(m, "spark_version") + err = core.UnmarshalPrimitive(m, "start_time", &obj.StartTime) + if err != nil { + err = core.SDKErrorf(err, "", "start_time-error", common.GetComponentInfo()) + return + } + delete(m, "start_time") + err = core.UnmarshalPrimitive(m, "state", &obj.State) if err != nil { - err = core.SDKErrorf(err, "", "bucket-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "catalog", &obj.Catalog) + delete(m, "state") + err = core.UnmarshalModel(m, "state_details", &obj.StateDetails, UnmarshalSparkApplicationStateDetail) if err != nil { - err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "state_details-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) + delete(m, "state_details") + err = core.UnmarshalPrimitive(m, "submission_time", &obj.SubmissionTime) if err != nil { - err = core.SDKErrorf(err, "", "owner-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "submission_time-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "schema_name", &obj.SchemaName) + delete(m, "submission_time") + err = core.UnmarshalPrimitive(m, "template_id", &obj.TemplateID) if err != nil { - err = core.SDKErrorf(err, "", "schema_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "template_id-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// ServicesDetails : Details of engines or services for a specific target type. -type ServicesDetails struct { - // List of engines or services details. - EnginesServices []ConnectionPropertiesDetails `json:"engines_services" validate:"required"` -} - -// UnmarshalServicesDetails unmarshals an instance of ServicesDetails from the specified map of raw messages. -func UnmarshalServicesDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(ServicesDetails) - err = core.UnmarshalModel(m, "engines_services", &obj.EnginesServices, UnmarshalConnectionPropertiesDetails) + delete(m, "template_id") + err = core.UnmarshalPrimitive(m, "timeout_in_seconds", &obj.TimeoutInSeconds) + if err != nil { + err = core.SDKErrorf(err, "", "timeout_in_seconds-error", common.GetComponentInfo()) + return + } + delete(m, "timeout_in_seconds") + err = core.UnmarshalPrimitive(m, "wxd_application_ui_endpoint", &obj.WxdApplicationUiEndpoint) if err != nil { - err = core.SDKErrorf(err, "", "engines_services-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "wxd_application_ui_endpoint-error", common.GetComponentInfo()) return } + delete(m, "wxd_application_ui_endpoint") + for k := range m { + var v interface{} + e := core.UnmarshalPrimitive(m, k, &v) + if e != nil { + err = core.SDKErrorf(e, "", "additional-properties-error", common.GetComponentInfo()) + return + } + obj.SetProperty(k, v) + } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkApplicationConfig : Spark applications details configuration. -type SparkApplicationConfig struct { - // spark_sample_config_properpty. - SparkSampleConfigProperpty *string `json:"spark_sample_config_properpty,omitempty"` +// SparkEngineCollection : Collection of Spark engines. +type SparkEngineCollection struct { + // List of spark engines. + SparkEngines []SparkEngine `json:"spark_engines" validate:"required"` } -// UnmarshalSparkApplicationConfig unmarshals an instance of SparkApplicationConfig from the specified map of raw messages. -func UnmarshalSparkApplicationConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkApplicationConfig) - err = core.UnmarshalPrimitive(m, "spark_sample_config_properpty", &obj.SparkSampleConfigProperpty) +// UnmarshalSparkEngineCollection unmarshals an instance of SparkEngineCollection from the specified map of raw messages. +func UnmarshalSparkEngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEngineCollection) + err = core.UnmarshalModel(m, "spark_engines", &obj.SparkEngines, UnmarshalSparkEngine) if err != nil { - err = core.SDKErrorf(err, "", "spark_sample_config_properpty-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "spark_engines-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkApplicationDetails : Application details. -type SparkApplicationDetails struct { - // Application. - Application *string `json:"application,omitempty"` +// SparkEngineDetails : Spark engine configuration details. +type SparkEngineDetails struct { + // Api key to be used for connecting with external Analytics engine instance. Applicable only for external engine. + ApiKey *string `json:"api_key,omitempty"` - // List of arguments. - Arguments []string `json:"arguments,omitempty"` + // External engine connection string. Applicable only for external engine. + ConnectionString *string `json:"connection_string,omitempty"` - // Class. - Class *string `json:"class,omitempty"` + // Default Spark configuration properties to be applied for all applications running on this Spark engine. + DefaultConfig map[string]string `json:"default_config,omitempty"` - // Spark applications details configuration. - Conf *SparkApplicationConfig `json:"conf,omitempty"` + // Default spark version for applications run on this Spark engine. + DefaultVersion *string `json:"default_version,omitempty"` - // Spark applications details env samples. - Env *SparkApplicationEnv `json:"env,omitempty"` + // Spark engine endpoints. + Endpoints *SparkEndpoints `json:"endpoints,omitempty"` - // Files. - Files *string `json:"files,omitempty"` + // Engine home properties for Spark engine configuration. + EngineHome *SparkEngineHome `json:"engine_home,omitempty"` - // Jars. - Jars *string `json:"jars,omitempty"` + // spark engine sub type. + EngineSubType *string `json:"engine_sub_type,omitempty"` - // Display name of the spark application. - Name *string `json:"name,omitempty"` + // Id of Analytics engine instance used as external engine. + InstanceID *string `json:"instance_id,omitempty"` - // Packages. - Packages *string `json:"packages,omitempty"` + // How is the spark instance managed. + ManagedBy *string `json:"managed_by,omitempty"` - // Repositories. - Repositories *string `json:"repositories,omitempty"` + // Resource limit enabled flag. + ResourceLimitEnabled *bool `json:"resource_limit_enabled,omitempty"` - // Spark Version. - SparkVersion *string `json:"spark_version,omitempty"` + // Native spark engine resource quota. + ResourceLimits *SparkEngineResourceLimit `json:"resource_limits,omitempty"` + + // Native spark engine resource utilisation. + ResourceUtilisation *SparkEngineResourceUtilisation `json:"resource_utilisation,omitempty"` + + // Spark instance scale configuration. + ScaleConfig *SparkScaleConfig `json:"scale_config,omitempty"` + + // Spark vscode configuration. + VscodeConfig *SparkVscodeConfig `json:"vscode_config,omitempty"` } -// UnmarshalSparkApplicationDetails unmarshals an instance of SparkApplicationDetails from the specified map of raw messages. -func UnmarshalSparkApplicationDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkApplicationDetails) - err = core.UnmarshalPrimitive(m, "application", &obj.Application) +// UnmarshalSparkEngineDetails unmarshals an instance of SparkEngineDetails from the specified map of raw messages. +func UnmarshalSparkEngineDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEngineDetails) + err = core.UnmarshalPrimitive(m, "api_key", &obj.ApiKey) if err != nil { - err = core.SDKErrorf(err, "", "application-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "api_key-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "arguments", &obj.Arguments) + err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) if err != nil { - err = core.SDKErrorf(err, "", "arguments-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "class", &obj.Class) + err = core.UnmarshalPrimitive(m, "default_config", &obj.DefaultConfig) if err != nil { - err = core.SDKErrorf(err, "", "class-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default_config-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "conf", &obj.Conf, UnmarshalSparkApplicationConfig) + err = core.UnmarshalPrimitive(m, "default_version", &obj.DefaultVersion) if err != nil { - err = core.SDKErrorf(err, "", "conf-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default_version-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "env", &obj.Env, UnmarshalSparkApplicationEnv) + err = core.UnmarshalModel(m, "endpoints", &obj.Endpoints, UnmarshalSparkEndpoints) if err != nil { - err = core.SDKErrorf(err, "", "env-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "endpoints-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "files", &obj.Files) + err = core.UnmarshalModel(m, "engine_home", &obj.EngineHome, UnmarshalSparkEngineHome) if err != nil { - err = core.SDKErrorf(err, "", "files-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "engine_home-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "jars", &obj.Jars) + err = core.UnmarshalPrimitive(m, "engine_sub_type", &obj.EngineSubType) if err != nil { - err = core.SDKErrorf(err, "", "jars-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "engine_sub_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "packages", &obj.Packages) + err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) if err != nil { - err = core.SDKErrorf(err, "", "packages-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "repositories", &obj.Repositories) + err = core.UnmarshalPrimitive(m, "resource_limit_enabled", &obj.ResourceLimitEnabled) if err != nil { - err = core.SDKErrorf(err, "", "repositories-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_limit_enabled-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "spark_version", &obj.SparkVersion) + err = core.UnmarshalModel(m, "resource_limits", &obj.ResourceLimits, UnmarshalSparkEngineResourceLimit) if err != nil { - err = core.SDKErrorf(err, "", "spark_version-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_limits-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SparkApplicationEnv : Spark applications details env samples. -type SparkApplicationEnv struct { - // sample. - SampleEnvKey *string `json:"sample_env_key,omitempty"` -} - -// UnmarshalSparkApplicationEnv unmarshals an instance of SparkApplicationEnv from the specified map of raw messages. -func UnmarshalSparkApplicationEnv(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkApplicationEnv) - err = core.UnmarshalPrimitive(m, "sample_env_key", &obj.SampleEnvKey) + err = core.UnmarshalModel(m, "resource_utilisation", &obj.ResourceUtilisation, UnmarshalSparkEngineResourceUtilisation) if err != nil { - err = core.SDKErrorf(err, "", "sample_env_key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_utilisation-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SparkDefaultConfig : Spark Default Config details. -type SparkDefaultConfig struct { - // config1. - Config1 *string `json:"config1,omitempty"` - - // config2. - Config2 *string `json:"config2,omitempty"` -} - -// UnmarshalSparkDefaultConfig unmarshals an instance of SparkDefaultConfig from the specified map of raw messages. -func UnmarshalSparkDefaultConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkDefaultConfig) - err = core.UnmarshalPrimitive(m, "config1", &obj.Config1) + err = core.UnmarshalModel(m, "scale_config", &obj.ScaleConfig, UnmarshalSparkScaleConfig) if err != nil { - err = core.SDKErrorf(err, "", "config1-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "scale_config-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "config2", &obj.Config2) + err = core.UnmarshalModel(m, "vscode_config", &obj.VscodeConfig, UnmarshalSparkVscodeConfig) if err != nil { - err = core.SDKErrorf(err, "", "config2-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "vscode_config-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkEndpoints : Application Endpoints. -type SparkEndpoints struct { - // Application API. - ApplicationsApi *string `json:"applications_api,omitempty"` - - // History server endpoint. - HistoryServerEndpoint *string `json:"history_server_endpoint,omitempty"` - - // Spark kernel endpoint. - SparkAccessEndpoint *string `json:"spark_access_endpoint,omitempty"` - - // Spark jobs V4 endpoint. - SparkJobsV4Endpoint *string `json:"spark_jobs_v4_endpoint,omitempty"` - - // Spark kernel endpoint. - SparkKernelEndpoint *string `json:"spark_kernel_endpoint,omitempty"` - - // View history server. - ViewHistoryServer *string `json:"view_history_server,omitempty"` +// SparkEngineHome : Engine home properties for Spark engine configuration. +type SparkEngineHome struct { + // Path in specified storage where engine home data will be stored. This is relevant for SAAS. + Path *string `json:"path,omitempty"` - // Wxd application endpoint. - WxdApplicationEndpoint *string `json:"wxd_application_endpoint,omitempty"` + // Name of the registered object storage instance to be used as Spark engine home. This is available only in SAAS. + StorageName *string `json:"storage_name,omitempty"` - // Wxd engine endpoint. - WxdEngineEndpoint *string `json:"wxd_engine_endpoint,omitempty"` + // Qualified name of the persistent volume to be used as Spark engine home. This is available only in CPD. + Volume *string `json:"volume,omitempty"` - // Wxd history_server endpoint. - WxdHistoryServerEndpoint *string `json:"wxd_history_server_endpoint,omitempty"` + // ID of the persistent volume to be used as Spark engine home. This is available only in CPD. To be specified when + // creating a new Spark engine with existing volume. + VolumeID *string `json:"volume_id,omitempty"` - // Wxd history_server endpoint. - WxdHistoryServerUiEndpoint *string `json:"wxd_history_server_ui_endpoint,omitempty"` + // Name of the persistent volume to be created. This is available only in CPD. To be specified when creating a new + // Spark engine along with a new volume. + VolumeName *string `json:"volume_name,omitempty"` } -// UnmarshalSparkEndpoints unmarshals an instance of SparkEndpoints from the specified map of raw messages. -func UnmarshalSparkEndpoints(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkEndpoints) - err = core.UnmarshalPrimitive(m, "applications_api", &obj.ApplicationsApi) - if err != nil { - err = core.SDKErrorf(err, "", "applications_api-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "history_server_endpoint", &obj.HistoryServerEndpoint) - if err != nil { - err = core.SDKErrorf(err, "", "history_server_endpoint-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "spark_access_endpoint", &obj.SparkAccessEndpoint) - if err != nil { - err = core.SDKErrorf(err, "", "spark_access_endpoint-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "spark_jobs_v4_endpoint", &obj.SparkJobsV4Endpoint) - if err != nil { - err = core.SDKErrorf(err, "", "spark_jobs_v4_endpoint-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "spark_kernel_endpoint", &obj.SparkKernelEndpoint) +// UnmarshalSparkEngineHome unmarshals an instance of SparkEngineHome from the specified map of raw messages. +func UnmarshalSparkEngineHome(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEngineHome) + err = core.UnmarshalPrimitive(m, "path", &obj.Path) if err != nil { - err = core.SDKErrorf(err, "", "spark_kernel_endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "path-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "view_history_server", &obj.ViewHistoryServer) + err = core.UnmarshalPrimitive(m, "storage_name", &obj.StorageName) if err != nil { - err = core.SDKErrorf(err, "", "view_history_server-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "storage_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "wxd_application_endpoint", &obj.WxdApplicationEndpoint) + err = core.UnmarshalPrimitive(m, "volume", &obj.Volume) if err != nil { - err = core.SDKErrorf(err, "", "wxd_application_endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "volume-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "wxd_engine_endpoint", &obj.WxdEngineEndpoint) + err = core.UnmarshalPrimitive(m, "volume_id", &obj.VolumeID) if err != nil { - err = core.SDKErrorf(err, "", "wxd_engine_endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "volume_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "wxd_history_server_endpoint", &obj.WxdHistoryServerEndpoint) + err = core.UnmarshalPrimitive(m, "volume_name", &obj.VolumeName) if err != nil { - err = core.SDKErrorf(err, "", "wxd_history_server_endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "volume_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "wxd_history_server_ui_endpoint", &obj.WxdHistoryServerUiEndpoint) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SparkEngineHomePatch : Engine home properties for Spark engine configuration for Patch. +type SparkEngineHomePatch struct { + // Name of the registered object storage instance to be used as Spark engine home. This is available only in SAAS. + StorageName *string `json:"storage_name,omitempty"` +} + +// UnmarshalSparkEngineHomePatch unmarshals an instance of SparkEngineHomePatch from the specified map of raw messages. +func UnmarshalSparkEngineHomePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEngineHomePatch) + err = core.UnmarshalPrimitive(m, "storage_name", &obj.StorageName) if err != nil { - err = core.SDKErrorf(err, "", "wxd_history_server_ui_endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "storage_name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkEngine : EngineDetail. -type SparkEngine struct { - // Actions. - Actions []string `json:"actions,omitempty"` - - // Associated catalogs. - AssociatedCatalogs []string `json:"associated_catalogs,omitempty"` - - // watsonx.data build version. - BuildVersion *string `json:"build_version,omitempty"` +// asPatch returns a generic map representation of the SparkEngineHomePatch +func (sparkEngineHomePatch *SparkEngineHomePatch) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(sparkEngineHomePatch.StorageName) { + _patch["storage_name"] = sparkEngineHomePatch.StorageName + } - // Created user name. - CreatedBy *string `json:"created_by,omitempty"` + return +} - // Created time in epoch format. - CreatedOn *int64 `json:"created_on,omitempty"` +// SparkEnginePatch : Information to update spark engine. +type SparkEnginePatch struct { + // Engine details. + Configuration *SparkEnginePatchEngineDetails `json:"configuration,omitempty"` - // Engine description. + // Update the information related engine. Description *string `json:"description,omitempty"` - // External engine details. - EngineDetails *SparkEngineDetails `json:"engine_details,omitempty"` - - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` - - // Engine programmatic name. - EngineID *string `json:"engine_id,omitempty"` - - // Origin - created or registered. - Origin *string `json:"origin,omitempty"` - - // Engine status. - Status *string `json:"status,omitempty"` - - // Tags. - Tags []string `json:"tags,omitempty"` - - // Type like spark, netezza,.. - Type *string `json:"type,omitempty"` -} - -// Constants associated with the SparkEngine.Origin property. -// Origin - created or registered. -const ( - SparkEngine_Origin_Discover = "discover" - SparkEngine_Origin_External = "external" - SparkEngine_Origin_Native = "native" -) - -// Constants associated with the SparkEngine.Type property. -// Type like spark, netezza,.. -const ( - SparkEngine_Type_Spark = "spark" -) + // Display name to identify engine. + DisplayName *string `json:"display_name,omitempty"` -// UnmarshalSparkEngine unmarshals an instance of SparkEngine from the specified map of raw messages. -func UnmarshalSparkEngine(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkEngine) - err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) - if err != nil { - err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "associated_catalogs", &obj.AssociatedCatalogs) - if err != nil { - err = core.SDKErrorf(err, "", "associated_catalogs-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "build_version", &obj.BuildVersion) - if err != nil { - err = core.SDKErrorf(err, "", "build_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) - if err != nil { - err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + // Tags. + Tags []string `json:"tags,omitempty"` +} + +// UnmarshalSparkEnginePatch unmarshals an instance of SparkEnginePatch from the specified map of raw messages. +func UnmarshalSparkEnginePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEnginePatch) + err = core.UnmarshalModel(m, "configuration", &obj.Configuration, UnmarshalSparkEnginePatchEngineDetails) if err != nil { - err = core.SDKErrorf(err, "", "created_on-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "configuration-error", common.GetComponentInfo()) return } err = core.UnmarshalPrimitive(m, "description", &obj.Description) @@ -26744,899 +32286,1175 @@ func UnmarshalSparkEngine(m map[string]json.RawMessage, result interface{}) (err err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "engine_details", &obj.EngineDetails, UnmarshalSparkEngineDetails) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) if err != nil { - err = core.SDKErrorf(err, "", "engine_details-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_display_name", &obj.EngineDisplayName) + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { - err = core.SDKErrorf(err, "", "engine_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_id", &obj.EngineID) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the SparkEnginePatch +func (sparkEnginePatch *SparkEnginePatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(sparkEnginePatch.Configuration) { + _patch["configuration"] = sparkEnginePatch.Configuration.asPatch() + } + if !core.IsNil(sparkEnginePatch.Description) { + _patch["description"] = sparkEnginePatch.Description + } + if !core.IsNil(sparkEnginePatch.DisplayName) { + _patch["display_name"] = sparkEnginePatch.DisplayName + } + if !core.IsNil(sparkEnginePatch.Tags) { + _patch["tags"] = sparkEnginePatch.Tags + } + + return +} + +// SparkEnginePatchEngineDetails : Engine details. +type SparkEnginePatchEngineDetails struct { + // Default Spark configuration properties to be updated. To remove a property, set its value to null. + DefaultConfig map[string]string `json:"default_config,omitempty"` + + // The default spark version for the native engine. + DefaultVersion *string `json:"default_version,omitempty"` + + // Engine home properties for Spark engine configuration for Patch. + EngineHome *SparkEngineHomePatch `json:"engine_home,omitempty"` + + // Resource limit enabled flag. + ResourceLimitEnabled *bool `json:"resource_limit_enabled,omitempty"` + + // Native spark engine resource quota. + ResourceLimits *SparkEngineResourceLimit `json:"resource_limits,omitempty"` +} + +// UnmarshalSparkEnginePatchEngineDetails unmarshals an instance of SparkEnginePatchEngineDetails from the specified map of raw messages. +func UnmarshalSparkEnginePatchEngineDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEnginePatchEngineDetails) + err = core.UnmarshalPrimitive(m, "default_config", &obj.DefaultConfig) if err != nil { - err = core.SDKErrorf(err, "", "engine_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default_config-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + err = core.UnmarshalPrimitive(m, "default_version", &obj.DefaultVersion) if err != nil { - err = core.SDKErrorf(err, "", "origin-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "default_version-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "status", &obj.Status) + err = core.UnmarshalModel(m, "engine_home", &obj.EngineHome, UnmarshalSparkEngineHomePatch) if err != nil { - err = core.SDKErrorf(err, "", "status-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "engine_home-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + err = core.UnmarshalPrimitive(m, "resource_limit_enabled", &obj.ResourceLimitEnabled) if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_limit_enabled-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalModel(m, "resource_limits", &obj.ResourceLimits, UnmarshalSparkEngineResourceLimit) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "resource_limits-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkEngineApplicationStatus : Engine Application Status. -type SparkEngineApplicationStatus struct { - // Application details. - ApplicationDetails *SparkApplicationDetails `json:"application_details,omitempty"` - - // Application ID. - ApplicationID *string `json:"application_id,omitempty"` - - // Auto Termination Time. - AutoTerminationTime *string `json:"auto_termination_time,omitempty"` - - // Creation time. - CreationTime *string `json:"creation_time,omitempty"` +// asPatch returns a generic map representation of the SparkEnginePatchEngineDetails +func (sparkEnginePatchEngineDetails *SparkEnginePatchEngineDetails) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(sparkEnginePatchEngineDetails.DefaultConfig) { + _patch["default_config"] = sparkEnginePatchEngineDetails.DefaultConfig + } + if !core.IsNil(sparkEnginePatchEngineDetails.DefaultVersion) { + _patch["default_version"] = sparkEnginePatchEngineDetails.DefaultVersion + } + if !core.IsNil(sparkEnginePatchEngineDetails.EngineHome) { + _patch["engine_home"] = sparkEnginePatchEngineDetails.EngineHome.asPatch() + } + if !core.IsNil(sparkEnginePatchEngineDetails.ResourceLimitEnabled) { + _patch["resource_limit_enabled"] = sparkEnginePatchEngineDetails.ResourceLimitEnabled + } + if !core.IsNil(sparkEnginePatchEngineDetails.ResourceLimits) { + _patch["resource_limits"] = sparkEnginePatchEngineDetails.ResourceLimits.asPatch() + } - // Deployment mode. - DeployMode *string `json:"deploy_mode,omitempty"` + return +} - // End Time. - EndTime *string `json:"end_time,omitempty"` +// SparkEngineResourceLimit : Native spark engine resource quota. +type SparkEngineResourceLimit struct { + // CPU. + Cores *string `json:"cores,omitempty"` - // Failed time. - FailedTime *string `json:"failed_time,omitempty"` + // Memory in GiB. + Memory *string `json:"memory,omitempty"` +} - // Finish time. - FinishTime *string `json:"finish_time,omitempty"` +// UnmarshalSparkEngineResourceLimit unmarshals an instance of SparkEngineResourceLimit from the specified map of raw messages. +func UnmarshalSparkEngineResourceLimit(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEngineResourceLimit) + err = core.UnmarshalPrimitive(m, "cores", &obj.Cores) + if err != nil { + err = core.SDKErrorf(err, "", "cores-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // Application ID. - ID *string `json:"id,omitempty"` +// asPatch returns a generic map representation of the SparkEngineResourceLimit +func (sparkEngineResourceLimit *SparkEngineResourceLimit) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(sparkEngineResourceLimit.Cores) { + _patch["cores"] = sparkEngineResourceLimit.Cores + } + if !core.IsNil(sparkEngineResourceLimit.Memory) { + _patch["memory"] = sparkEngineResourceLimit.Memory + } - // Job endpoint. - JobEndpoint *string `json:"job_endpoint,omitempty"` + return +} - // Return code. - ReturnCode *string `json:"return_code,omitempty"` +// SparkEngineResourceUtilisation : Native spark engine resource utilisation. +type SparkEngineResourceUtilisation struct { + // CPU. + Cores *string `json:"cores,omitempty"` - // application run time. - Runtime *SparkEngineApplicationStatusRuntime `json:"runtime,omitempty"` + // Memory. + Memory *string `json:"memory,omitempty"` +} - // Service Instance ID for POST. - ServiceInstanceID *string `json:"service_instance_id,omitempty"` +// UnmarshalSparkEngineResourceUtilisation unmarshals an instance of SparkEngineResourceUtilisation from the specified map of raw messages. +func UnmarshalSparkEngineResourceUtilisation(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkEngineResourceUtilisation) + err = core.UnmarshalPrimitive(m, "cores", &obj.Cores) + if err != nil { + err = core.SDKErrorf(err, "", "cores-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} - // Spark application ID. - SparkApplicationID *string `json:"spark_application_id,omitempty"` +// SparkHistoryServer : Native spark history server. +type SparkHistoryServer struct { + // The time when the Spark history server will automatically stop. Applicable only in SAAS. + AutoTerminationTime *string `json:"auto_termination_time,omitempty"` - // Spark application name. - SparkApplicationName *string `json:"spark_application_name,omitempty"` + // CPU cores allocated for the history server. Available when the history server is running. + Cores *string `json:"cores,omitempty"` - // Spark Version. - SparkVersion *string `json:"spark_version,omitempty"` + // Memory allocated for the history server. Kubernetes memory units are used. Available when the history server is + // running. + Memory *string `json:"memory,omitempty"` - // Start time. + // History server start time. StartTime *string `json:"start_time,omitempty"` - // Application state. - State *string `json:"state,omitempty"` - - // Application state details. - StateDetails []SparkEngineApplicationStatusStateDetailsItems `json:"state_details,omitempty"` - - // Application submission time. - SubmissionTime *string `json:"submission_time,omitempty"` - - // Template ID. - TemplateID *string `json:"template_id,omitempty"` - - // Engine Type. - Type *string `json:"type,omitempty"` - - // Spark application volumes to mount. - Volumes []SparkVolumeDetails `json:"volumes,omitempty"` - - // Wxd history_server endpoint. - WxdApplicationUiEndpoint *string `json:"wxd_application_ui_endpoint,omitempty"` + // History server state. + State *string `json:"state" validate:"required"` } -// Constants associated with the SparkEngineApplicationStatus.Type property. -// Engine Type. -const ( - SparkEngineApplicationStatus_Type_Emr = "emr" - SparkEngineApplicationStatus_Type_Iae = "iae" -) - -// UnmarshalSparkEngineApplicationStatus unmarshals an instance of SparkEngineApplicationStatus from the specified map of raw messages. -func UnmarshalSparkEngineApplicationStatus(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkEngineApplicationStatus) - err = core.UnmarshalModel(m, "application_details", &obj.ApplicationDetails, UnmarshalSparkApplicationDetails) - if err != nil { - err = core.SDKErrorf(err, "", "application_details-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "application_id", &obj.ApplicationID) - if err != nil { - err = core.SDKErrorf(err, "", "application_id-error", common.GetComponentInfo()) - return - } +// UnmarshalSparkHistoryServer unmarshals an instance of SparkHistoryServer from the specified map of raw messages. +func UnmarshalSparkHistoryServer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkHistoryServer) err = core.UnmarshalPrimitive(m, "auto_termination_time", &obj.AutoTerminationTime) if err != nil { err = core.SDKErrorf(err, "", "auto_termination_time-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "creation_time", &obj.CreationTime) - if err != nil { - err = core.SDKErrorf(err, "", "creation_time-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "deploy_mode", &obj.DeployMode) + err = core.UnmarshalPrimitive(m, "cores", &obj.Cores) if err != nil { - err = core.SDKErrorf(err, "", "deploy_mode-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "cores-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "end_time", &obj.EndTime) + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) if err != nil { - err = core.SDKErrorf(err, "", "end_time-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "failed_time", &obj.FailedTime) + err = core.UnmarshalPrimitive(m, "start_time", &obj.StartTime) if err != nil { - err = core.SDKErrorf(err, "", "failed_time-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "start_time-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "finish_time", &obj.FinishTime) + err = core.UnmarshalPrimitive(m, "state", &obj.State) if err != nil { - err = core.SDKErrorf(err, "", "finish_time-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "id", &obj.ID) - if err != nil { - err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) - return + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SparkScaleConfig : Spark instance scale configuration. +type SparkScaleConfig struct { + // Enable/disable autoscaling. + AutoScaleEnabled *bool `json:"auto_scale_enabled,omitempty"` + + // Current node count. + CurrentNumberOfNodes *int64 `json:"current_number_of_nodes,omitempty"` + + // Maximum node count. + MaximumNumberOfNodes *int64 `json:"maximum_number_of_nodes,omitempty"` + + // Minimum node count. + MinimumNumberOfNodes *int64 `json:"minimum_number_of_nodes,omitempty"` + + // Spark instance node type. + NodeType *string `json:"node_type" validate:"required"` + + // Node count. + NumberOfNodes *int64 `json:"number_of_nodes,omitempty"` +} + +// Constants associated with the SparkScaleConfig.NodeType property. +// Spark instance node type. +const ( + SparkScaleConfig_NodeType_Large = "large" + SparkScaleConfig_NodeType_Medium = "medium" + SparkScaleConfig_NodeType_Small = "small" +) + +// NewSparkScaleConfig : Instantiate SparkScaleConfig (Generic Model Constructor) +func (*WatsonxDataV3) NewSparkScaleConfig(nodeType string) (_model *SparkScaleConfig, err error) { + _model = &SparkScaleConfig{ + NodeType: core.StringPtr(nodeType), } - err = core.UnmarshalPrimitive(m, "job_endpoint", &obj.JobEndpoint) + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "job_endpoint-error", common.GetComponentInfo()) - return + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } - err = core.UnmarshalPrimitive(m, "return_code", &obj.ReturnCode) + return +} + +// UnmarshalSparkScaleConfig unmarshals an instance of SparkScaleConfig from the specified map of raw messages. +func UnmarshalSparkScaleConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkScaleConfig) + err = core.UnmarshalPrimitive(m, "auto_scale_enabled", &obj.AutoScaleEnabled) if err != nil { - err = core.SDKErrorf(err, "", "return_code-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auto_scale_enabled-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "runtime", &obj.Runtime, UnmarshalSparkEngineApplicationStatusRuntime) + err = core.UnmarshalPrimitive(m, "current_number_of_nodes", &obj.CurrentNumberOfNodes) if err != nil { - err = core.SDKErrorf(err, "", "runtime-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "current_number_of_nodes-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "service_instance_id", &obj.ServiceInstanceID) + err = core.UnmarshalPrimitive(m, "maximum_number_of_nodes", &obj.MaximumNumberOfNodes) if err != nil { - err = core.SDKErrorf(err, "", "service_instance_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "maximum_number_of_nodes-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "spark_application_id", &obj.SparkApplicationID) + err = core.UnmarshalPrimitive(m, "minimum_number_of_nodes", &obj.MinimumNumberOfNodes) if err != nil { - err = core.SDKErrorf(err, "", "spark_application_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "minimum_number_of_nodes-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "spark_application_name", &obj.SparkApplicationName) + err = core.UnmarshalPrimitive(m, "node_type", &obj.NodeType) if err != nil { - err = core.SDKErrorf(err, "", "spark_application_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "node_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "spark_version", &obj.SparkVersion) + err = core.UnmarshalPrimitive(m, "number_of_nodes", &obj.NumberOfNodes) if err != nil { - err = core.SDKErrorf(err, "", "spark_version-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "number_of_nodes-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "start_time", &obj.StartTime) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SparkVolumeDetails : Spark application volume. +type SparkVolumeDetails struct { + // Path in the spark cluster for the mounted volume. + MountPath *string `json:"mount_path,omitempty"` + + // volume name. + Name *string `json:"name,omitempty"` + + // Read only flag. + ReadOnly *bool `json:"read_only,omitempty"` + + // Path in the volume to be mounted. + SourceSubPath *string `json:"source_sub_path,omitempty"` +} + +// UnmarshalSparkVolumeDetails unmarshals an instance of SparkVolumeDetails from the specified map of raw messages. +func UnmarshalSparkVolumeDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkVolumeDetails) + err = core.UnmarshalPrimitive(m, "mount_path", &obj.MountPath) if err != nil { - err = core.SDKErrorf(err, "", "start_time-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "mount_path-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "state", &obj.State) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "state_details", &obj.StateDetails, UnmarshalSparkEngineApplicationStatusStateDetailsItems) + err = core.UnmarshalPrimitive(m, "read_only", &obj.ReadOnly) if err != nil { - err = core.SDKErrorf(err, "", "state_details-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "read_only-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "submission_time", &obj.SubmissionTime) + err = core.UnmarshalPrimitive(m, "source_sub_path", &obj.SourceSubPath) if err != nil { - err = core.SDKErrorf(err, "", "submission_time-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "source_sub_path-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "template_id", &obj.TemplateID) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SparkVscodeConfig : Spark vscode configuration. +type SparkVscodeConfig struct { + // WxD crn. + Crn *string `json:"crn,omitempty"` + + // WxD environment type. + EnvironmentType *string `json:"environment_type,omitempty"` + + // WxD hostname. + Host *string `json:"host,omitempty"` + + // WxD user name. + UserName *string `json:"user_name,omitempty"` +} + +// UnmarshalSparkVscodeConfig unmarshals an instance of SparkVscodeConfig from the specified map of raw messages. +func UnmarshalSparkVscodeConfig(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SparkVscodeConfig) + err = core.UnmarshalPrimitive(m, "crn", &obj.Crn) if err != nil { - err = core.SDKErrorf(err, "", "template_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "crn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "environment_type", &obj.EnvironmentType) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "environment_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "volumes", &obj.Volumes, UnmarshalSparkVolumeDetails) + err = core.UnmarshalPrimitive(m, "host", &obj.Host) if err != nil { - err = core.SDKErrorf(err, "", "volumes-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "host-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "wxd_application_ui_endpoint", &obj.WxdApplicationUiEndpoint) + err = core.UnmarshalPrimitive(m, "user_name", &obj.UserName) if err != nil { - err = core.SDKErrorf(err, "", "wxd_application_ui_endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "user_name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkEngineApplicationStatusCollection : Engine Application Detail. -type SparkEngineApplicationStatusCollection struct { - // Application body. - Applications []SparkEngineApplicationStatus `json:"applications,omitempty"` +// StartSparkEngineHistoryServerOptions : The StartSparkEngineHistoryServer options. +type StartSparkEngineHistoryServerOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` + + // CPU cores to be allocated to the history server. + Cores *string `json:"cores,omitempty"` + + // Memory to be allocated for the history server. Kuberneted memory unit (G) must also be specified. + Memory *string `json:"memory,omitempty"` + + // watsonx.data instance ID. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalSparkEngineApplicationStatusCollection unmarshals an instance of SparkEngineApplicationStatusCollection from the specified map of raw messages. -func UnmarshalSparkEngineApplicationStatusCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkEngineApplicationStatusCollection) - err = core.UnmarshalModel(m, "applications", &obj.Applications, UnmarshalSparkEngineApplicationStatus) - if err != nil { - err = core.SDKErrorf(err, "", "applications-error", common.GetComponentInfo()) - return +// NewStartSparkEngineHistoryServerOptions : Instantiate StartSparkEngineHistoryServerOptions +func (*WatsonxDataV3) NewStartSparkEngineHistoryServerOptions(id string) *StartSparkEngineHistoryServerOptions { + return &StartSparkEngineHistoryServerOptions{ + ID: core.StringPtr(id), } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// SparkEngineApplicationStatusRuntime : application run time. -type SparkEngineApplicationStatusRuntime struct { - // Spark Version. - SparkVersion *string `json:"spark_version,omitempty"` +// SetID : Allow user to set ID +func (_options *StartSparkEngineHistoryServerOptions) SetID(id string) *StartSparkEngineHistoryServerOptions { + _options.ID = core.StringPtr(id) + return _options } -// UnmarshalSparkEngineApplicationStatusRuntime unmarshals an instance of SparkEngineApplicationStatusRuntime from the specified map of raw messages. -func UnmarshalSparkEngineApplicationStatusRuntime(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkEngineApplicationStatusRuntime) - err = core.UnmarshalPrimitive(m, "spark_version", &obj.SparkVersion) - if err != nil { - err = core.SDKErrorf(err, "", "spark_version-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetCores : Allow user to set Cores +func (_options *StartSparkEngineHistoryServerOptions) SetCores(cores string) *StartSparkEngineHistoryServerOptions { + _options.Cores = core.StringPtr(cores) + return _options } -// SparkEngineApplicationStatusStateDetailsItems : State details. -type SparkEngineApplicationStatusStateDetailsItems struct { - // State details code. - Code *string `json:"code,omitempty"` +// SetMemory : Allow user to set Memory +func (_options *StartSparkEngineHistoryServerOptions) SetMemory(memory string) *StartSparkEngineHistoryServerOptions { + _options.Memory = core.StringPtr(memory) + return _options +} - // State details message. - Message *string `json:"message,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *StartSparkEngineHistoryServerOptions) SetAuthInstanceID(authInstanceID string) *StartSparkEngineHistoryServerOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // State details type. - Type *string `json:"type,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *StartSparkEngineHistoryServerOptions) SetHeaders(param map[string]string) *StartSparkEngineHistoryServerOptions { + options.Headers = param + return options } -// UnmarshalSparkEngineApplicationStatusStateDetailsItems unmarshals an instance of SparkEngineApplicationStatusStateDetailsItems from the specified map of raw messages. -func UnmarshalSparkEngineApplicationStatusStateDetailsItems(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkEngineApplicationStatusStateDetailsItems) - err = core.UnmarshalPrimitive(m, "code", &obj.Code) +// StorageCatalog : storage catalog. +type StorageCatalog struct { + // catalog base path. + BasePath *string `json:"base_path,omitempty"` + + // catalog name. + CatalogName *string `json:"catalog_name,omitempty"` + + // catalog tags. + CatalogTags []string `json:"catalog_tags" validate:"required"` + + // catalog type. + CatalogType *string `json:"catalog_type,omitempty"` +} + +// UnmarshalStorageCatalog unmarshals an instance of StorageCatalog from the specified map of raw messages. +func UnmarshalStorageCatalog(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StorageCatalog) + err = core.UnmarshalPrimitive(m, "base_path", &obj.BasePath) if err != nil { - err = core.SDKErrorf(err, "", "code-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "base_path-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "message", &obj.Message) + err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "catalog_tags", &obj.CatalogTags) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "catalog_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "catalog_type", &obj.CatalogType) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkEngineCollection : List spark engines. -type SparkEngineCollection struct { - // List spark engines. - SparkEngines []SparkEngine `json:"spark_engines,omitempty"` +// StorageCatalogPrototype : storage catalog. +type StorageCatalogPrototype struct { + // catalog base path. + BasePath *string `json:"base_path,omitempty"` + + // catalog name. + CatalogName *string `json:"catalog_name,omitempty"` + + // catalog tags. + CatalogTags []string `json:"catalog_tags" validate:"required"` + + // catalog type. + CatalogType *string `json:"catalog_type,omitempty"` } -// UnmarshalSparkEngineCollection unmarshals an instance of SparkEngineCollection from the specified map of raw messages. -func UnmarshalSparkEngineCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkEngineCollection) - err = core.UnmarshalModel(m, "spark_engines", &obj.SparkEngines, UnmarshalSparkEngine) +// NewStorageCatalogPrototype : Instantiate StorageCatalogPrototype (Generic Model Constructor) +func (*WatsonxDataV3) NewStorageCatalogPrototype(catalogTags []string) (_model *StorageCatalogPrototype, err error) { + _model = &StorageCatalogPrototype{ + CatalogTags: catalogTags, + } + err = core.ValidateStruct(_model, "required parameters") if err != nil { - err = core.SDKErrorf(err, "", "spark_engines-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return +} + +// UnmarshalStorageCatalogPrototype unmarshals an instance of StorageCatalogPrototype from the specified map of raw messages. +func UnmarshalStorageCatalogPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StorageCatalogPrototype) + err = core.UnmarshalPrimitive(m, "base_path", &obj.BasePath) + if err != nil { + err = core.SDKErrorf(err, "", "base_path-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "catalog_name", &obj.CatalogName) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "catalog_tags", &obj.CatalogTags) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_tags-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "catalog_type", &obj.CatalogType) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_type-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkEngineDetails : External engine details. -type SparkEngineDetails struct { - // api key to work with the saas IAE instance. - ApiKey *string `json:"api_key,omitempty"` +// StorageDetails : storage details. +type StorageDetails struct { + // Access key ID, encrypted during storage registration. + AccessKey *string `json:"access_key,omitempty"` - // External engine connection string. - ConnectionString *string `json:"connection_string,omitempty"` + // secret details. + AccessKeyVault *StorageDetailsAccesskeyVault `json:"access_key_vault,omitempty"` - // Spark Default Config details. - DefaultConfig *SparkDefaultConfig `json:"default_config,omitempty"` + // actual storage name. + AccountName *string `json:"account_name,omitempty"` - // The default spark version for the native engine. - DefaultVersion *string `json:"default_version,omitempty"` + // Application Id for storage registration. + ApplicationID *string `json:"application_id,omitempty"` - // Application Endpoints. - Endpoints *SparkEndpoints `json:"endpoints,omitempty"` + // auth mode. + AuthMode *string `json:"auth_mode,omitempty"` - // Default bucket for spark. - EngineHomeBucketDisplayName *string `json:"engine_home_bucket_display_name,omitempty"` + // actual container name. + ContainerName *string `json:"container_name,omitempty"` - // Default bucket for spark. - EngineHomeBucketName *string `json:"engine_home_bucket_name,omitempty"` + // Directory Id for storage registration. + DirectoryID *string `json:"directory_id,omitempty"` - // Path for spark. - EngineHomePath *string `json:"engine_home_path,omitempty"` + // Cos endpoint. + Endpoint *string `json:"endpoint,omitempty"` - // Default volume for spark. - EngineHomeVolume *string `json:"engine_home_volume,omitempty"` + // Key file, encrypted during storage registration. + KeyFile *string `json:"key_file,omitempty"` - // Default volume for spark. - EngineHomeVolumeID *string `json:"engine_home_volume_id,omitempty"` + // actual storage name. + Name *string `json:"name,omitempty"` - // Name of the volume. - EngineHomeVolumeName *string `json:"engine_home_volume_name,omitempty"` + // storage provider. + Provider *string `json:"provider,omitempty"` - // Storage class of the volume. - EngineHomeVolumeStorageClass *string `json:"engine_home_volume_storage_class,omitempty"` + // Region where the storage is located. + Region *string `json:"region,omitempty"` - // Storage size of the volume. - EngineHomeVolumeStorageSize *string `json:"engine_home_volume_storage_size,omitempty"` + // arn role. + RoleArn *string `json:"role_arn,omitempty"` - // Instance to access the instance. - InstanceID *string `json:"instance_id,omitempty"` + // sas token, encrypted during storage registration. + SasToken *string `json:"sas_token,omitempty"` - // spark engine sub type. - EngineSubType *string `json:"engine_sub_type,omitempty"` + // Secret access key, encrypted during storage registration. + SecretKey *string `json:"secret_key,omitempty"` - // How is the spark instance managed. - ManagedBy *string `json:"managed_by,omitempty"` + // secret details. + SecretKeyVault *StorageDetailsAccesskeyVault `json:"secret_key_vault,omitempty"` - // Spark instance scale configuration. - ScaleConfig *SparkScaleConfig `json:"scale_config,omitempty"` + // vault enabled or not. + VaultEnabled *bool `json:"vault_enabled,omitempty"` } -// UnmarshalSparkEngineDetails unmarshals an instance of SparkEngineDetails from the specified map of raw messages. -func UnmarshalSparkEngineDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkEngineDetails) - err = core.UnmarshalPrimitive(m, "api_key", &obj.ApiKey) +// UnmarshalStorageDetails unmarshals an instance of StorageDetails from the specified map of raw messages. +func UnmarshalStorageDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StorageDetails) + err = core.UnmarshalPrimitive(m, "access_key", &obj.AccessKey) if err != nil { - err = core.SDKErrorf(err, "", "api_key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "access_key-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) + err = core.UnmarshalModel(m, "access_key_vault", &obj.AccessKeyVault, UnmarshalStorageDetailsAccesskeyVault) if err != nil { - err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "access_key_vault-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "default_config", &obj.DefaultConfig, UnmarshalSparkDefaultConfig) + err = core.UnmarshalPrimitive(m, "account_name", &obj.AccountName) if err != nil { - err = core.SDKErrorf(err, "", "default_config-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "account_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "default_version", &obj.DefaultVersion) + err = core.UnmarshalPrimitive(m, "application_id", &obj.ApplicationID) if err != nil { - err = core.SDKErrorf(err, "", "default_version-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "application_id-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "endpoints", &obj.Endpoints, UnmarshalSparkEndpoints) + err = core.UnmarshalPrimitive(m, "auth_mode", &obj.AuthMode) if err != nil { - err = core.SDKErrorf(err, "", "endpoints-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "auth_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "container_name", &obj.ContainerName) + if err != nil { + err = core.SDKErrorf(err, "", "container_name-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "directory_id", &obj.DirectoryID) + if err != nil { + err = core.SDKErrorf(err, "", "directory_id-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) + if err != nil { + err = core.SDKErrorf(err, "", "endpoint-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "key_file", &obj.KeyFile) + if err != nil { + err = core.SDKErrorf(err, "", "key_file-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_bucket_display_name", &obj.EngineHomeBucketDisplayName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_bucket_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_bucket_name", &obj.EngineHomeBucketName) + err = core.UnmarshalPrimitive(m, "provider", &obj.Provider) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_bucket_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "provider-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_path", &obj.EngineHomePath) + err = core.UnmarshalPrimitive(m, "region", &obj.Region) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_path-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_volume", &obj.EngineHomeVolume) + err = core.UnmarshalPrimitive(m, "role_arn", &obj.RoleArn) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_volume-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "role_arn-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_volume_id", &obj.EngineHomeVolumeID) + err = core.UnmarshalPrimitive(m, "sas_token", &obj.SasToken) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_volume_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "sas_token-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_volume_name", &obj.EngineHomeVolumeName) + err = core.UnmarshalPrimitive(m, "secret_key", &obj.SecretKey) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_volume_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "secret_key-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_volume_storage_class", &obj.EngineHomeVolumeStorageClass) + err = core.UnmarshalModel(m, "secret_key_vault", &obj.SecretKeyVault, UnmarshalStorageDetailsAccesskeyVault) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_volume_storage_class-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "secret_key_vault-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_volume_storage_size", &obj.EngineHomeVolumeStorageSize) + err = core.UnmarshalPrimitive(m, "vault_enabled", &obj.VaultEnabled) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_volume_storage_size-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "vault_enabled-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the StorageDetails +func (storageDetails *StorageDetails) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(storageDetails.AccessKey) { + _patch["access_key"] = storageDetails.AccessKey + } + if !core.IsNil(storageDetails.AccessKeyVault) { + _patch["access_key_vault"] = storageDetails.AccessKeyVault.asPatch() + } + if !core.IsNil(storageDetails.AccountName) { + _patch["account_name"] = storageDetails.AccountName + } + if !core.IsNil(storageDetails.ApplicationID) { + _patch["application_id"] = storageDetails.ApplicationID + } + if !core.IsNil(storageDetails.AuthMode) { + _patch["auth_mode"] = storageDetails.AuthMode + } + if !core.IsNil(storageDetails.ContainerName) { + _patch["container_name"] = storageDetails.ContainerName + } + if !core.IsNil(storageDetails.DirectoryID) { + _patch["directory_id"] = storageDetails.DirectoryID + } + if !core.IsNil(storageDetails.Endpoint) { + _patch["endpoint"] = storageDetails.Endpoint + } + if !core.IsNil(storageDetails.KeyFile) { + _patch["key_file"] = storageDetails.KeyFile + } + if !core.IsNil(storageDetails.Name) { + _patch["name"] = storageDetails.Name + } + if !core.IsNil(storageDetails.Provider) { + _patch["provider"] = storageDetails.Provider + } + if !core.IsNil(storageDetails.Region) { + _patch["region"] = storageDetails.Region + } + if !core.IsNil(storageDetails.RoleArn) { + _patch["role_arn"] = storageDetails.RoleArn + } + if !core.IsNil(storageDetails.SasToken) { + _patch["sas_token"] = storageDetails.SasToken + } + if !core.IsNil(storageDetails.SecretKey) { + _patch["secret_key"] = storageDetails.SecretKey + } + if !core.IsNil(storageDetails.SecretKeyVault) { + _patch["secret_key_vault"] = storageDetails.SecretKeyVault.asPatch() + } + if !core.IsNil(storageDetails.VaultEnabled) { + _patch["vault_enabled"] = storageDetails.VaultEnabled + } + + return +} + +// StorageDetailsAccesskeyVault : secret details. +type StorageDetailsAccesskeyVault struct { + // secret key. + Key *string `json:"key,omitempty"` + + // secret name. + SecretName *string `json:"secret_name,omitempty"` + + // secret urn. + SecretUrn *string `json:"secret_urn,omitempty"` +} + +// UnmarshalStorageDetailsAccesskeyVault unmarshals an instance of StorageDetailsAccesskeyVault from the specified map of raw messages. +func UnmarshalStorageDetailsAccesskeyVault(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StorageDetailsAccesskeyVault) + err = core.UnmarshalPrimitive(m, "key", &obj.Key) if err != nil { - err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "key-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_sub_type", &obj.EngineSubType) + err = core.UnmarshalPrimitive(m, "secret_name", &obj.SecretName) if err != nil { - err = core.SDKErrorf(err, "", "engine_sub_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "secret_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) + err = core.UnmarshalPrimitive(m, "secret_urn", &obj.SecretUrn) if err != nil { - err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "secret_urn-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "scale_config", &obj.ScaleConfig, UnmarshalSparkScaleConfig) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// asPatch returns a generic map representation of the StorageDetailsAccesskeyVault +func (storageDetailsAccesskeyVault *StorageDetailsAccesskeyVault) asPatch() (_patch map[string]interface{}) { + _patch = map[string]interface{}{} + if !core.IsNil(storageDetailsAccesskeyVault.Key) { + _patch["key"] = storageDetailsAccesskeyVault.Key + } + if !core.IsNil(storageDetailsAccesskeyVault.SecretName) { + _patch["secret_name"] = storageDetailsAccesskeyVault.SecretName + } + if !core.IsNil(storageDetailsAccesskeyVault.SecretUrn) { + _patch["secret_urn"] = storageDetailsAccesskeyVault.SecretUrn + } + + return +} + +// StorageObjectProperties : muliple storage object properties. +type StorageObjectProperties struct { + // muliple storage object properties. + ObjectProperties []StorageRegistrationObjectSizeCollection `json:"object_properties" validate:"required"` +} + +// UnmarshalStorageObjectProperties unmarshals an instance of StorageObjectProperties from the specified map of raw messages. +func UnmarshalStorageObjectProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StorageObjectProperties) + err = core.UnmarshalModel(m, "object_properties", &obj.ObjectProperties, UnmarshalStorageRegistrationObjectSizeCollection) if err != nil { - err = core.SDKErrorf(err, "", "scale_config-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "object_properties-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkEngineDetailsPrototype : Node details. -type SparkEngineDetailsPrototype struct { - // api key to work with the saas IAE instance. - ApiKey *string `json:"api_key,omitempty"` +// StorageRegistration : Storage. +type StorageRegistration struct { + // Actions. + Actions []string `json:"actions" validate:"required"` - // External engine connection string. - ConnectionString *string `json:"connection_string,omitempty"` + // associated catalogs. + AssociatedCatalogs []StorageCatalog `json:"associated_catalogs" validate:"required"` - // Spark Default Config details. - DefaultConfig *SparkDefaultConfig `json:"default_config,omitempty"` + // storage details. + Connection *StorageDetails `json:"connection,omitempty"` - // The default spark version for the native engine. - DefaultVersion *string `json:"default_version,omitempty"` + // Creation date. + CreatedAt *string `json:"created_at" validate:"required"` + + // Username of the user who created the storage. + CreatedBy *string `json:"created_by" validate:"required"` - // Default bucket name for spark. - EngineHomeBucketDisplayName *string `json:"engine_home_bucket_display_name,omitempty"` + // storage description. + Description *string `json:"description" validate:"required"` + + // Storage display name. + DisplayName *string `json:"display_name" validate:"required"` - // Default bucket for spark. - EngineHomeBucketName *string `json:"engine_home_bucket_name,omitempty"` + // storage ID auto generated during storage registration. + ID *string `json:"id,omitempty"` - // Path for spark. - EngineHomePath *string `json:"engine_home_path,omitempty"` + // managed by. + ManagedBy *string `json:"managed_by" validate:"required"` - // Default volume for spark. - EngineHomeVolumeID *string `json:"engine_home_volume_id,omitempty"` + // Region where the storage is located. + Region *string `json:"region,omitempty"` - // Name of the volume. - EngineHomeVolumeName *string `json:"engine_home_volume_name,omitempty"` + // Mark storage as active or inactive. + State *string `json:"state" validate:"required"` - // Storage class of the volume. - EngineHomeVolumeStorageClass *string `json:"engine_home_volume_storage_class,omitempty"` + // parameter to show whether the bucket is of acl or qhmm use. + StorageUse *string `json:"storage_use,omitempty"` - // Storage size of the volume. - EngineHomeVolumeStorageSize *string `json:"engine_home_volume_storage_size,omitempty"` + // Boolean value to specify whether updating HMAC credentials for internal system storage. + SystemStorageUpdateCredentials *bool `json:"system_storage_update_credentials,omitempty"` - // spark engine sub type. - EngineSubType *string `json:"engine_sub_type,omitempty"` + // tags. + Tags []string `json:"tags" validate:"required"` - // Instance to access the instance. - InstanceID *string `json:"instance_id,omitempty"` + // storage catalog. + AssociatedCatalog *StorageCatalogPrototype `json:"associated_catalog,omitempty"` - // How is the spark instance managed. - ManagedBy *string `json:"managed_by,omitempty"` + // storage type. + Type *string `json:"type" validate:"required"` - // Spark instance scale configuration. - ScaleConfig *SparkScaleConfig `json:"scale_config,omitempty"` + // Boolean value to specify whether vault enabled or not. + VaultEnabled *bool `json:"vault_enabled,omitempty"` } -// UnmarshalSparkEngineDetailsPrototype unmarshals an instance of SparkEngineDetailsPrototype from the specified map of raw messages. -func UnmarshalSparkEngineDetailsPrototype(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkEngineDetailsPrototype) - err = core.UnmarshalPrimitive(m, "api_key", &obj.ApiKey) +// Constants associated with the StorageRegistration.ManagedBy property. +// managed by. +const ( + StorageRegistration_ManagedBy_Customer = "customer" + StorageRegistration_ManagedBy_Ibm = "ibm" +) + +// Constants associated with the StorageRegistration.State property. +// Mark storage as active or inactive. +const ( + StorageRegistration_State_Active = "active" + StorageRegistration_State_Inactive = "inactive" +) + +// Constants associated with the StorageRegistration.Type property. +// storage type. +const ( + StorageRegistration_Type_AdlsGen1 = "adls_gen1" + StorageRegistration_Type_AdlsGen2 = "adls_gen2" + StorageRegistration_Type_AmazonS3 = "amazon_s3" + StorageRegistration_Type_AwsS3 = "aws_s3" + StorageRegistration_Type_GoogleCs = "google_cs" + StorageRegistration_Type_IbmCeph = "ibm_ceph" + StorageRegistration_Type_IbmCos = "ibm_cos" + StorageRegistration_Type_IbmStorageScale = "ibm_storage_scale" + StorageRegistration_Type_Minio = "minio" + StorageRegistration_Type_Ozone = "ozone" + StorageRegistration_Type_S3 = "s3" +) + +// UnmarshalStorageRegistration unmarshals an instance of StorageRegistration from the specified map of raw messages. +func UnmarshalStorageRegistration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StorageRegistration) + err = core.UnmarshalPrimitive(m, "actions", &obj.Actions) if err != nil { - err = core.SDKErrorf(err, "", "api_key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "actions-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "connection_string", &obj.ConnectionString) + err = core.UnmarshalModel(m, "associated_catalogs", &obj.AssociatedCatalogs, UnmarshalStorageCatalog) if err != nil { - err = core.SDKErrorf(err, "", "connection_string-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "associated_catalogs-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "default_config", &obj.DefaultConfig, UnmarshalSparkDefaultConfig) + err = core.UnmarshalModel(m, "connection", &obj.Connection, UnmarshalStorageDetails) if err != nil { - err = core.SDKErrorf(err, "", "default_config-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "connection-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "default_version", &obj.DefaultVersion) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) if err != nil { - err = core.SDKErrorf(err, "", "default_version-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_at-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_bucket_display_name", &obj.EngineHomeBucketDisplayName) + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_bucket_display_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "created_by-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_bucket_name", &obj.EngineHomeBucketName) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_bucket_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_path", &obj.EngineHomePath) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_path-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_volume_id", &obj.EngineHomeVolumeID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_volume_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "id-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_volume_name", &obj.EngineHomeVolumeName) + err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_volume_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_volume_storage_class", &obj.EngineHomeVolumeStorageClass) + err = core.UnmarshalPrimitive(m, "region", &obj.Region) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_volume_storage_class-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "region-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_home_volume_storage_size", &obj.EngineHomeVolumeStorageSize) + err = core.UnmarshalPrimitive(m, "state", &obj.State) if err != nil { - err = core.SDKErrorf(err, "", "engine_home_volume_storage_size-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "engine_sub_type", &obj.EngineSubType) + err = core.UnmarshalPrimitive(m, "storage_use", &obj.StorageUse) if err != nil { - err = core.SDKErrorf(err, "", "engine_sub_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "storage_use-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) + err = core.UnmarshalPrimitive(m, "system_storage_update_credentials", &obj.SystemStorageUpdateCredentials) if err != nil { - err = core.SDKErrorf(err, "", "instance_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "system_storage_update_credentials-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "managed_by", &obj.ManagedBy) + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) if err != nil { - err = core.SDKErrorf(err, "", "managed_by-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "scale_config", &obj.ScaleConfig, UnmarshalSparkScaleConfig) + err = core.UnmarshalModel(m, "associated_catalog", &obj.AssociatedCatalog, UnmarshalStorageCatalogPrototype) if err != nil { - err = core.SDKErrorf(err, "", "scale_config-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "associated_catalog-error", common.GetComponentInfo()) return } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// SparkEngineResourceLimit : Native spark engine resource quota. -type SparkEngineResourceLimit struct { - // CPU. - Cores *string `json:"cores,omitempty"` - - // Memory in GiB. - Memory *string `json:"memory,omitempty"` -} - -// UnmarshalSparkEngineResourceLimit unmarshals an instance of SparkEngineResourceLimit from the specified map of raw messages. -func UnmarshalSparkEngineResourceLimit(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkEngineResourceLimit) - err = core.UnmarshalPrimitive(m, "cores", &obj.Cores) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "cores-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + err = core.UnmarshalPrimitive(m, "vault_enabled", &obj.VaultEnabled) if err != nil { - err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "vault_enabled-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// asPatch returns a generic map representation of the SparkEngineResourceLimit -func (sparkEngineResourceLimit *SparkEngineResourceLimit) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(sparkEngineResourceLimit.Cores) { - _patch["cores"] = sparkEngineResourceLimit.Cores - } - if !core.IsNil(sparkEngineResourceLimit.Memory) { - _patch["memory"] = sparkEngineResourceLimit.Memory - } +// StorageRegistrationCollection : List storage registrations. +type StorageRegistrationCollection struct { + // Storages. + StorageRegistrations []StorageRegistration `json:"storage_registrations" validate:"required"` +} +// UnmarshalStorageRegistrationCollection unmarshals an instance of StorageRegistrationCollection from the specified map of raw messages. +func UnmarshalStorageRegistrationCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StorageRegistrationCollection) + err = core.UnmarshalModel(m, "storage_registrations", &obj.StorageRegistrations, UnmarshalStorageRegistration) + if err != nil { + err = core.SDKErrorf(err, "", "storage_registrations-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkHistoryServer : Native spark history server. -type SparkHistoryServer struct { - // History server start time. - AutoTerminationTime *string `json:"auto_termination_time,omitempty"` - - // History server cores. - Cores *string `json:"cores,omitempty"` - - // History server memory. - Memory *string `json:"memory,omitempty"` - - // History server start time. - StartTime *string `json:"start_time,omitempty"` - - // History server state. - State *string `json:"state,omitempty"` +// StorageRegistrationObjectCollection : List storage objects. +type StorageRegistrationObjectCollection struct { + // storage object. + Objects []string `json:"objects" validate:"required"` } -// UnmarshalSparkHistoryServer unmarshals an instance of SparkHistoryServer from the specified map of raw messages. -func UnmarshalSparkHistoryServer(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkHistoryServer) - err = core.UnmarshalPrimitive(m, "auto_termination_time", &obj.AutoTerminationTime) - if err != nil { - err = core.SDKErrorf(err, "", "auto_termination_time-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "cores", &obj.Cores) - if err != nil { - err = core.SDKErrorf(err, "", "cores-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) - if err != nil { - err = core.SDKErrorf(err, "", "memory-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "start_time", &obj.StartTime) - if err != nil { - err = core.SDKErrorf(err, "", "start_time-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "state", &obj.State) +// UnmarshalStorageRegistrationObjectCollection unmarshals an instance of StorageRegistrationObjectCollection from the specified map of raw messages. +func UnmarshalStorageRegistrationObjectCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StorageRegistrationObjectCollection) + err = core.UnmarshalPrimitive(m, "objects", &obj.Objects) if err != nil { - err = core.SDKErrorf(err, "", "state-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "objects-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkScaleConfig : Spark instance scale configuration. -type SparkScaleConfig struct { - // Enable/disable autoscaling. - AutoScaleEnabled *bool `json:"auto_scale_enabled,omitempty"` +// StorageRegistrationObjectSizeCollection : Storage object size. +type StorageRegistrationObjectSizeCollection struct { + // content type. + ContentType *string `json:"content_type,omitempty"` - // Current node count. - CurrentNumberOfNodes *int64 `json:"current_number_of_nodes,omitempty"` + // file type. + FileType *string `json:"file_type,omitempty"` - // Maximum node count. - MaximumNumberOfNodes *int64 `json:"maximum_number_of_nodes,omitempty"` + // storage last modified. + LastModified *string `json:"last_modified,omitempty"` - // Minimum node count. - MinimumNumberOfNodes *int64 `json:"minimum_number_of_nodes,omitempty"` + // Additional metadata associated with the object. + Metadata map[string]string `json:"metadata,omitempty"` - // Spark instance node type. - NodeType *string `json:"node_type,omitempty"` + // storage last modified. + Path *string `json:"path,omitempty"` - // Node count. - NumberOfNodes *int64 `json:"number_of_nodes,omitempty"` + // size of the storage objects. + Size *string `json:"size,omitempty"` } -// UnmarshalSparkScaleConfig unmarshals an instance of SparkScaleConfig from the specified map of raw messages. -func UnmarshalSparkScaleConfig(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkScaleConfig) - err = core.UnmarshalPrimitive(m, "auto_scale_enabled", &obj.AutoScaleEnabled) +// UnmarshalStorageRegistrationObjectSizeCollection unmarshals an instance of StorageRegistrationObjectSizeCollection from the specified map of raw messages. +func UnmarshalStorageRegistrationObjectSizeCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StorageRegistrationObjectSizeCollection) + err = core.UnmarshalPrimitive(m, "content_type", &obj.ContentType) if err != nil { - err = core.SDKErrorf(err, "", "auto_scale_enabled-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "content_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "current_number_of_nodes", &obj.CurrentNumberOfNodes) + err = core.UnmarshalPrimitive(m, "file_type", &obj.FileType) if err != nil { - err = core.SDKErrorf(err, "", "current_number_of_nodes-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "file_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "maximum_number_of_nodes", &obj.MaximumNumberOfNodes) + err = core.UnmarshalPrimitive(m, "last_modified", &obj.LastModified) if err != nil { - err = core.SDKErrorf(err, "", "maximum_number_of_nodes-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "last_modified-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "minimum_number_of_nodes", &obj.MinimumNumberOfNodes) + err = core.UnmarshalPrimitive(m, "metadata", &obj.Metadata) if err != nil { - err = core.SDKErrorf(err, "", "minimum_number_of_nodes-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "metadata-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "node_type", &obj.NodeType) + err = core.UnmarshalPrimitive(m, "path", &obj.Path) if err != nil { - err = core.SDKErrorf(err, "", "node_type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "path-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "number_of_nodes", &obj.NumberOfNodes) + err = core.UnmarshalPrimitive(m, "size", &obj.Size) if err != nil { - err = core.SDKErrorf(err, "", "number_of_nodes-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "size-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// SparkVolumeDetails : Spark application volume. -type SparkVolumeDetails struct { - // Path in the spark cluster for the mounted volume. - MountPath *string `json:"mount_path,omitempty"` +// StorageRegistrationPatch : Update storage parameters. +type StorageRegistrationPatch struct { + // storage details. + Connection *StorageDetails `json:"connection,omitempty"` - // volume name. - Name *string `json:"name,omitempty"` + // Modified description. + Description *string `json:"description,omitempty"` - // Read only flag. - ReadOnly *bool `json:"read_only,omitempty"` + // Storage display name. + DisplayName *string `json:"display_name,omitempty"` - // Path in the volume to be mounted. - SourceSubPath *string `json:"source_sub_path,omitempty"` + // Boolean value to specify whether the patch is for updating HMAC credentials for internal system storage. + SystemStorageUpdateCredentials *bool `json:"system_storage_update_credentials,omitempty"` + + // Tags. + Tags []string `json:"tags,omitempty"` } -// UnmarshalSparkVolumeDetails unmarshals an instance of SparkVolumeDetails from the specified map of raw messages. -func UnmarshalSparkVolumeDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SparkVolumeDetails) - err = core.UnmarshalPrimitive(m, "mount_path", &obj.MountPath) +// UnmarshalStorageRegistrationPatch unmarshals an instance of StorageRegistrationPatch from the specified map of raw messages. +func UnmarshalStorageRegistrationPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StorageRegistrationPatch) + err = core.UnmarshalModel(m, "connection", &obj.Connection, UnmarshalStorageDetails) if err != nil { - err = core.SDKErrorf(err, "", "mount_path-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "connection-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "name", &obj.Name) + err = core.UnmarshalPrimitive(m, "description", &obj.Description) if err != nil { - err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "read_only", &obj.ReadOnly) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) if err != nil { - err = core.SDKErrorf(err, "", "read_only-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "display_name-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "source_sub_path", &obj.SourceSubPath) + err = core.UnmarshalPrimitive(m, "system_storage_update_credentials", &obj.SystemStorageUpdateCredentials) if err != nil { - err = core.SDKErrorf(err, "", "source_sub_path-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "system_storage_update_credentials-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// StartSparkEngineHistoryServerOptions : The StartSparkEngineHistoryServer options. -type StartSparkEngineHistoryServerOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` - - // CPU count. - Cores *string `json:"cores,omitempty"` - - // Memory in GiB. - Memory *string `json:"memory,omitempty"` - - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - - // Allows users to set headers on API requests. - Headers map[string]string -} - -// NewStartSparkEngineHistoryServerOptions : Instantiate StartSparkEngineHistoryServerOptions -func (*WatsonxDataV2) NewStartSparkEngineHistoryServerOptions(engineID string) *StartSparkEngineHistoryServerOptions { - return &StartSparkEngineHistoryServerOptions{ - EngineID: core.StringPtr(engineID), +// AsPatch returns a generic map representation of the StorageRegistrationPatch +func (storageRegistrationPatch *StorageRegistrationPatch) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(storageRegistrationPatch.Connection) { + _patch["connection"] = storageRegistrationPatch.Connection.asPatch() + } + if !core.IsNil(storageRegistrationPatch.Description) { + _patch["description"] = storageRegistrationPatch.Description + } + if !core.IsNil(storageRegistrationPatch.DisplayName) { + _patch["display_name"] = storageRegistrationPatch.DisplayName + } + if !core.IsNil(storageRegistrationPatch.SystemStorageUpdateCredentials) { + _patch["system_storage_update_credentials"] = storageRegistrationPatch.SystemStorageUpdateCredentials + } + if !core.IsNil(storageRegistrationPatch.Tags) { + _patch["tags"] = storageRegistrationPatch.Tags } -} - -// SetEngineID : Allow user to set EngineID -func (_options *StartSparkEngineHistoryServerOptions) SetEngineID(engineID string) *StartSparkEngineHistoryServerOptions { - _options.EngineID = core.StringPtr(engineID) - return _options -} - -// SetCores : Allow user to set Cores -func (_options *StartSparkEngineHistoryServerOptions) SetCores(cores string) *StartSparkEngineHistoryServerOptions { - _options.Cores = core.StringPtr(cores) - return _options -} -// SetMemory : Allow user to set Memory -func (_options *StartSparkEngineHistoryServerOptions) SetMemory(memory string) *StartSparkEngineHistoryServerOptions { - _options.Memory = core.StringPtr(memory) - return _options + return } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *StartSparkEngineHistoryServerOptions) SetAuthInstanceID(authInstanceID string) *StartSparkEngineHistoryServerOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options -} +// Subject : subject can be user or group who can access on the provided resource. +type Subject struct { + // Subject type can be user or group. + Type *string `json:"type" validate:"required"` -// SetHeaders : Allow user to set Headers -func (options *StartSparkEngineHistoryServerOptions) SetHeaders(param map[string]string) *StartSparkEngineHistoryServerOptions { - options.Headers = param - return options + // value can be user name or group id. + Value *string `json:"value" validate:"required"` } -// StorageDetails : storage details. -type StorageDetails struct { - // Access key ID, encrypted during bucket registration. - AccessKey *string `json:"access_key,omitempty"` - - // Application Id for bucket registration. - ApplicationID *string `json:"application_id,omitempty"` - - // Auth mode types. - AuthMode *string `json:"auth_mode" validate:"required"` - - // actual container name. - ContainerName *string `json:"container_name" validate:"required"` - - // Directory Id for bucket registration. - DirectoryID *string `json:"directory_id,omitempty"` - - // ADLS endpoint. - Endpoint *string `json:"endpoint" validate:"required"` - - // sas token, encrypted during bucket registration. - SasToken *string `json:"sas_token,omitempty"` - - // Secret access key, encrypted during bucket registration. - SecretKey *string `json:"secret_key,omitempty"` - - // actual storage name. - StorageAccountName *string `json:"storage_account_name" validate:"required"` -} +// Constants associated with the Subject.Type property. +// Subject type can be user or group. +const ( + Subject_Type_Group = "group" + Subject_Type_User = "user" +) -// NewStorageDetails : Instantiate StorageDetails (Generic Model Constructor) -func (*WatsonxDataV2) NewStorageDetails(authMode string, containerName string, endpoint string, storageAccountName string) (_model *StorageDetails, err error) { - _model = &StorageDetails{ - AuthMode: core.StringPtr(authMode), - ContainerName: core.StringPtr(containerName), - Endpoint: core.StringPtr(endpoint), - StorageAccountName: core.StringPtr(storageAccountName), +// NewSubject : Instantiate Subject (Generic Model Constructor) +func (*WatsonxDataV3) NewSubject(typeVar string, value string) (_model *Subject, err error) { + _model = &Subject{ + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), } err = core.ValidateStruct(_model, "required parameters") if err != nil { @@ -27645,52 +33463,102 @@ func (*WatsonxDataV2) NewStorageDetails(authMode string, containerName string, e return } -// UnmarshalStorageDetails unmarshals an instance of StorageDetails from the specified map of raw messages. -func UnmarshalStorageDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(StorageDetails) - err = core.UnmarshalPrimitive(m, "access_key", &obj.AccessKey) - if err != nil { - err = core.SDKErrorf(err, "", "access_key-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "application_id", &obj.ApplicationID) +// UnmarshalSubject unmarshals an instance of Subject from the specified map of raw messages. +func UnmarshalSubject(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Subject) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "application_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "auth_mode", &obj.AuthMode) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { - err = core.SDKErrorf(err, "", "auth_mode-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "container_name", &obj.ContainerName) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubjectBulkUpdate : The object includes subjects (users and user groups) along with the permissions that need to be updated. +type SubjectBulkUpdate struct { + // the permissions the given user or group has, on the provided resource. + Permissions []string `json:"permissions,omitempty"` + + // subject can be user or group who can access on the provided resource. + Subject *Subject `json:"subject,omitempty"` +} + +// UnmarshalSubjectBulkUpdate unmarshals an instance of SubjectBulkUpdate from the specified map of raw messages. +func UnmarshalSubjectBulkUpdate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubjectBulkUpdate) + err = core.UnmarshalPrimitive(m, "permissions", &obj.Permissions) if err != nil { - err = core.SDKErrorf(err, "", "container_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "permissions-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "directory_id", &obj.DirectoryID) + err = core.UnmarshalModel(m, "subject", &obj.Subject, UnmarshalSubject) if err != nil { - err = core.SDKErrorf(err, "", "directory_id-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subject-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubjectBulkUpdateData : subject can be user or group who can access on the provided resource. +type SubjectBulkUpdateData struct { + // Subject type can be user or group. + Type *string `json:"type" validate:"required"` + + // value can be user name or group id. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the SubjectBulkUpdateData.Type property. +// Subject type can be user or group. +const ( + SubjectBulkUpdateData_Type_Group = "group" + SubjectBulkUpdateData_Type_User = "user" +) + +// UnmarshalSubjectBulkUpdateData unmarshals an instance of SubjectBulkUpdateData from the specified map of raw messages. +func UnmarshalSubjectBulkUpdateData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubjectBulkUpdateData) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) if err != nil { - err = core.SDKErrorf(err, "", "endpoint-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "sas_token", &obj.SasToken) + err = core.UnmarshalPrimitive(m, "value", &obj.Value) if err != nil { - err = core.SDKErrorf(err, "", "sas_token-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "value-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "secret_key", &obj.SecretKey) + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubjectRevoke : The object includes subjects (users and user groups) whose permissions need to be revoked. +type SubjectRevoke struct { + // the permissions to be revoked for the given user or group on the provided resource. + Permissions []string `json:"permissions,omitempty"` + + // subject can be user or group who can access on the provided resource. + Subject *Subject `json:"subject,omitempty"` +} + +// UnmarshalSubjectRevoke unmarshals an instance of SubjectRevoke from the specified map of raw messages. +func UnmarshalSubjectRevoke(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubjectRevoke) + err = core.UnmarshalPrimitive(m, "permissions", &obj.Permissions) if err != nil { - err = core.SDKErrorf(err, "", "secret_key-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "permissions-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "storage_account_name", &obj.StorageAccountName) + err = core.UnmarshalModel(m, "subject", &obj.Subject, UnmarshalSubject) if err != nil { - err = core.SDKErrorf(err, "", "storage_account_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "subject-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -27723,52 +33591,31 @@ func UnmarshalSuccessResponse(m map[string]json.RawMessage, result interface{}) return } -// SyncCatalogs : catalogs definition. -type SyncCatalogs struct { - // Auto add new table. - AutoAddNewTables *bool `json:"auto_add_new_tables,omitempty"` - - // Sync iceberg metadata. - SyncIcebergMd *bool `json:"sync_iceberg_md,omitempty"` +// SuccessResponsePrototype : success response prototype. +type SuccessResponsePrototype struct { + // Response of success. + Response *SuccessResponse `json:"response,omitempty"` } -// UnmarshalSyncCatalogs unmarshals an instance of SyncCatalogs from the specified map of raw messages. -func UnmarshalSyncCatalogs(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(SyncCatalogs) - err = core.UnmarshalPrimitive(m, "auto_add_new_tables", &obj.AutoAddNewTables) - if err != nil { - err = core.SDKErrorf(err, "", "auto_add_new_tables-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "sync_iceberg_md", &obj.SyncIcebergMd) +// UnmarshalSuccessResponsePrototype unmarshals an instance of SuccessResponsePrototype from the specified map of raw messages. +func UnmarshalSuccessResponsePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SuccessResponsePrototype) + err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) if err != nil { - err = core.SDKErrorf(err, "", "sync_iceberg_md-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// AsPatch returns a generic map representation of the SyncCatalogs -func (syncCatalogs *SyncCatalogs) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(syncCatalogs.AutoAddNewTables) { - _patch["auto_add_new_tables"] = syncCatalogs.AutoAddNewTables - } - if !core.IsNil(syncCatalogs.SyncIcebergMd) { - _patch["sync_iceberg_md"] = syncCatalogs.SyncIcebergMd - } - - return -} - -// Table : GetColumns OK. +// Table : Table details. type Table struct { - // Columns. - Columns []Column `json:"columns,omitempty"` + // List of columns. + Columns []Column `json:"columns" validate:"required"` // Table name. - TableName *string `json:"table_name,omitempty"` + Name *string `json:"name,omitempty"` } // UnmarshalTable unmarshals an instance of Table from the specified map of raw messages. @@ -27779,9 +33626,9 @@ func UnmarshalTable(m map[string]json.RawMessage, result interface{}) (err error err = core.SDKErrorf(err, "", "columns-error", common.GetComponentInfo()) return } - err = core.UnmarshalPrimitive(m, "table_name", &obj.TableName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "table_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -27791,107 +33638,15 @@ func UnmarshalTable(m map[string]json.RawMessage, result interface{}) (err error // TableCollection : tables list. type TableCollection struct { // List of the tables present in the schema. - Tables []string `json:"tables,omitempty"` + Tables []string `json:"tables" validate:"required"` } // UnmarshalTableCollection unmarshals an instance of TableCollection from the specified map of raw messages. func UnmarshalTableCollection(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(TableCollection) - err = core.UnmarshalPrimitive(m, "tables", &obj.Tables) - if err != nil { - err = core.SDKErrorf(err, "", "tables-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// TableColumDetail : TableColumDetail struct -type TableColumDetail struct { - // Bucket linked to the catalog. - Bucket *string `json:"bucket,omitempty"` - - // Catalog that this table belongs to. - Catalog *string `json:"catalog,omitempty"` - - // List of all column information about the table. - Columns []TableColumDetailColumnsItems `json:"columns,omitempty"` - - // Name of the user who created the table. - Owner *string `json:"owner,omitempty"` - - // Schema that this table belongs to. - Schema *string `json:"schema,omitempty"` - - // Name of the table. - Table *string `json:"table,omitempty"` -} - -// UnmarshalTableColumDetail unmarshals an instance of TableColumDetail from the specified map of raw messages. -func UnmarshalTableColumDetail(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TableColumDetail) - err = core.UnmarshalPrimitive(m, "bucket", &obj.Bucket) - if err != nil { - err = core.SDKErrorf(err, "", "bucket-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "catalog", &obj.Catalog) - if err != nil { - err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "columns", &obj.Columns, UnmarshalTableColumDetailColumnsItems) - if err != nil { - err = core.SDKErrorf(err, "", "columns-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) - if err != nil { - err = core.SDKErrorf(err, "", "owner-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "schema", &obj.Schema) - if err != nil { - err = core.SDKErrorf(err, "", "schema-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "table", &obj.Table) - if err != nil { - err = core.SDKErrorf(err, "", "table-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// TableColumDetailColumnsItems : TableColumDetailColumnsItems struct -type TableColumDetailColumnsItems struct { - // Name of the column. - Column *string `json:"column,omitempty"` - - // column idx_integer. - Index *int64 `json:"index,omitempty"` - - // data type for the column. - Type *string `json:"type,omitempty"` -} - -// UnmarshalTableColumDetailColumnsItems unmarshals an instance of TableColumDetailColumnsItems from the specified map of raw messages. -func UnmarshalTableColumDetailColumnsItems(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TableColumDetailColumnsItems) - err = core.UnmarshalPrimitive(m, "column", &obj.Column) - if err != nil { - err = core.SDKErrorf(err, "", "column-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "index", &obj.Index) - if err != nil { - err = core.SDKErrorf(err, "", "index-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "type", &obj.Type) + err = core.UnmarshalPrimitive(m, "tables", &obj.Tables) if err != nil { - err = core.SDKErrorf(err, "", "type-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "tables-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -27901,15 +33656,15 @@ func UnmarshalTableColumDetailColumnsItems(m map[string]json.RawMessage, result // TablePatch : UpdateTable body. type TablePatch struct { // New table name. - TableName *string `json:"table_name,omitempty"` + Name *string `json:"name,omitempty"` } // UnmarshalTablePatch unmarshals an instance of TablePatch from the specified map of raw messages. func UnmarshalTablePatch(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(TablePatch) - err = core.UnmarshalPrimitive(m, "table_name", &obj.TableName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) if err != nil { - err = core.SDKErrorf(err, "", "table_name-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "name-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) @@ -27919,120 +33674,67 @@ func UnmarshalTablePatch(m map[string]json.RawMessage, result interface{}) (err // AsPatch returns a generic map representation of the TablePatch func (tablePatch *TablePatch) AsPatch() (_patch map[string]interface{}, err error) { _patch = map[string]interface{}{} - if !core.IsNil(tablePatch.TableName) { - _patch["table_name"] = tablePatch.TableName - } - - return -} - -// TableResponse : Table response. -type TableResponse struct { - // Response message string. - Message *string `json:"message,omitempty"` - - // Message code string. - MessageCode *string `json:"message_code,omitempty"` - - // A list of all tables. - Tables []TableColumDetail `json:"tables,omitempty"` -} - -// UnmarshalTableResponse unmarshals an instance of TableResponse from the specified map of raw messages. -func UnmarshalTableResponse(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TableResponse) - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "message_code", &obj.MessageCode) - if err != nil { - err = core.SDKErrorf(err, "", "message_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "tables", &obj.Tables, UnmarshalTableColumDetail) - if err != nil { - err = core.SDKErrorf(err, "", "tables-error", common.GetComponentInfo()) - return + if !core.IsNil(tablePatch.Name) { + _patch["name"] = tablePatch.Name } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - -// TableResponseCollection : Table response collection. -type TableResponseCollection struct { - // Response message string. - Message *string `json:"message,omitempty"` - - // Message code string. - MessageCode *string `json:"message_code,omitempty"` - // A list of all tables. - Tables []TableResponse `json:"tables,omitempty"` -} - -// UnmarshalTableResponseCollection unmarshals an instance of TableResponseCollection from the specified map of raw messages. -func UnmarshalTableResponseCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(TableResponseCollection) - err = core.UnmarshalPrimitive(m, "message", &obj.Message) - if err != nil { - err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "message_code", &obj.MessageCode) - if err != nil { - err = core.SDKErrorf(err, "", "message_code-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "tables", &obj.Tables, UnmarshalTableResponse) - if err != nil { - err = core.SDKErrorf(err, "", "tables-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } -// TableSnapshot : TableSnapshot. +// TableSnapshot : Snapshot of a table's state after a commit. type TableSnapshot struct { - // Added data files. + // Number of data files added in this snapshot. AddedDataFiles *string `json:"added_data_files,omitempty"` - // Added files size. + // Total size (in bytes) of the added files. AddedFilesSize *string `json:"added_files_size,omitempty"` - // Added records. + // Number of records added in this snapshot. AddedRecords *string `json:"added_records,omitempty"` - // Changed partition count. + // Number of partitions that were changed in the snapshot. ChangedPartitionCount *string `json:"changed_partition_count,omitempty"` - // Committed at. - CommittedAt *string `json:"committed_at,omitempty"` + // Timestamp when the snapshot was committed in ISO 8601 format. + CommittedAt *strfmt.DateTime `json:"committed_at,omitempty"` + + // The current snapshot. + IsCurrentSnapshot *bool `json:"is_current_snapshot,omitempty"` - // Operation. - Operation *string `json:"operation,omitempty"` + // Type of operation that triggered the snapshot. + Operation *string `json:"operation" validate:"required"` - // Snapshot id. + // Unique identifier of the snapshot, consisting of alphanumeric characters and hyphens. SnapshotID *string `json:"snapshot_id,omitempty"` - // Total data files. + // Total number of data files after the snapshot. TotalDataFiles *string `json:"total_data_files,omitempty"` - // Total delete files. + // Total number of delete files after the snapshot. TotalDeleteFiles *string `json:"total_delete_files,omitempty"` - // Total equality deletes. + // Number of equality-based deletes in the snapshot. TotalEqualityDeletes *string `json:"total_equality_deletes,omitempty"` - // Total position deletes. + // Number of position-based deletes in the snapshot. TotalPositionDeletes *string `json:"total_position_deletes,omitempty"` - // Total records. + // Total number of records after applying the snapshot. TotalRecords *string `json:"total_records,omitempty"` } +// Constants associated with the TableSnapshot.Operation property. +// Type of operation that triggered the snapshot. +const ( + TableSnapshot_Operation_Alter = "alter" + TableSnapshot_Operation_Append = "append" + TableSnapshot_Operation_Compact = "compact" + TableSnapshot_Operation_Delete = "delete" + TableSnapshot_Operation_Merge = "merge" + TableSnapshot_Operation_Overwrite = "overwrite" + TableSnapshot_Operation_Replace = "replace" +) + // UnmarshalTableSnapshot unmarshals an instance of TableSnapshot from the specified map of raw messages. func UnmarshalTableSnapshot(m map[string]json.RawMessage, result interface{}) (err error) { obj := new(TableSnapshot) @@ -28061,6 +33763,11 @@ func UnmarshalTableSnapshot(m map[string]json.RawMessage, result interface{}) (e err = core.SDKErrorf(err, "", "committed_at-error", common.GetComponentInfo()) return } + err = core.UnmarshalPrimitive(m, "is_current_snapshot", &obj.IsCurrentSnapshot) + if err != nil { + err = core.SDKErrorf(err, "", "is_current_snapshot-error", common.GetComponentInfo()) + return + } err = core.UnmarshalPrimitive(m, "operation", &obj.Operation) if err != nil { err = core.SDKErrorf(err, "", "operation-error", common.GetComponentInfo()) @@ -28100,10 +33807,10 @@ func UnmarshalTableSnapshot(m map[string]json.RawMessage, result interface{}) (e return } -// TableSnapshotCollection : TableSnapshot OK. +// TableSnapshotCollection : Collection of tablesnapshots. type TableSnapshotCollection struct { - // Snapshots. - Snapshots []TableSnapshot `json:"snapshots,omitempty"` + // List of snapshots. + Snapshots []TableSnapshot `json:"snapshots" validate:"required"` } // UnmarshalTableSnapshotCollection unmarshals an instance of TableSnapshotCollection from the specified map of raw messages. @@ -28118,51 +33825,266 @@ func UnmarshalTableSnapshotCollection(m map[string]json.RawMessage, result inter return } -// UpdateBucketRegistrationOptions : The UpdateBucketRegistration options. -type UpdateBucketRegistrationOptions struct { - // bucket id. - BucketID *string `json:"bucket_id" validate:"required,ne="` +// TargetDetails : Details of ingestion target table. +type TargetDetails struct { + // Catalog of target table. + Catalog *string `json:"catalog" validate:"required"` - // Request body. - Body map[string]interface{} `json:"body" validate:"required"` + // Schema of target table. + Schema *string `json:"schema" validate:"required"` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Target table where files will be ingested. + Table *string `json:"table" validate:"required"` - // Allows users to set headers on API requests. - Headers map[string]string + // Append to existing data or overwrite it. + WriteMode *string `json:"write_mode" validate:"required"` + + // Create table with 'merge-on-read' property. + MergeOnRead *bool `json:"merge_on_read,omitempty"` + + // Controls schema validation mode. Use 'strict' to enforce exact schema match, or 'sloppy' to allow relaxed matching. + SchemaMode *string `json:"schema_mode,omitempty"` + + // Cast source column types to match target table types during append operations. When enabled, matching columns are + // cast to target types to prevent type mismatch errors. Works independently of schema_mode. + SchemaInfer *bool `json:"schema_infer,omitempty"` + + // Metastore catalog URI. + CatalogURI *string `json:"catalog_uri,omitempty"` + + // Storage connection details. + BucketDetails *BucketDetails `json:"bucket_details,omitempty"` + + // Warehouse location. + Location *string `json:"location,omitempty"` + + // Determine if target schema was created in this ingestion job. + IsNewSchema *bool `json:"is_new_schema,omitempty"` + + // Determine if target table was created in this ingestion job. + IsNewTable *bool `json:"is_new_table,omitempty"` } -// NewUpdateBucketRegistrationOptions : Instantiate UpdateBucketRegistrationOptions -func (*WatsonxDataV2) NewUpdateBucketRegistrationOptions(bucketID string, body map[string]interface{}) *UpdateBucketRegistrationOptions { - return &UpdateBucketRegistrationOptions{ - BucketID: core.StringPtr(bucketID), - Body: body, +// NewTargetDetails : Instantiate TargetDetails (Generic Model Constructor) +func (*WatsonxDataV3) NewTargetDetails(catalog string, schema string, table string, writeMode string) (_model *TargetDetails, err error) { + _model = &TargetDetails{ + Catalog: core.StringPtr(catalog), + Schema: core.StringPtr(schema), + Table: core.StringPtr(table), + WriteMode: core.StringPtr(writeMode), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) } + return } -// SetBucketID : Allow user to set BucketID -func (_options *UpdateBucketRegistrationOptions) SetBucketID(bucketID string) *UpdateBucketRegistrationOptions { - _options.BucketID = core.StringPtr(bucketID) - return _options +// UnmarshalTargetDetails unmarshals an instance of TargetDetails from the specified map of raw messages. +func UnmarshalTargetDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TargetDetails) + err = core.UnmarshalPrimitive(m, "catalog", &obj.Catalog) + if err != nil { + err = core.SDKErrorf(err, "", "catalog-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "schema", &obj.Schema) + if err != nil { + err = core.SDKErrorf(err, "", "schema-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "table", &obj.Table) + if err != nil { + err = core.SDKErrorf(err, "", "table-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "write_mode", &obj.WriteMode) + if err != nil { + err = core.SDKErrorf(err, "", "write_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "merge_on_read", &obj.MergeOnRead) + if err != nil { + err = core.SDKErrorf(err, "", "merge_on_read-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "schema_mode", &obj.SchemaMode) + if err != nil { + err = core.SDKErrorf(err, "", "schema_mode-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "schema_infer", &obj.SchemaInfer) + if err != nil { + err = core.SDKErrorf(err, "", "schema_infer-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "catalog_uri", &obj.CatalogURI) + if err != nil { + err = core.SDKErrorf(err, "", "catalog_uri-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "bucket_details", &obj.BucketDetails, UnmarshalBucketDetails) + if err != nil { + err = core.SDKErrorf(err, "", "bucket_details-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + err = core.SDKErrorf(err, "", "location-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "is_new_schema", &obj.IsNewSchema) + if err != nil { + err = core.SDKErrorf(err, "", "is_new_schema-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "is_new_table", &obj.IsNewTable) + if err != nil { + err = core.SDKErrorf(err, "", "is_new_table-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetBody : Allow user to set Body -func (_options *UpdateBucketRegistrationOptions) SetBody(body map[string]interface{}) *UpdateBucketRegistrationOptions { - _options.Body = body - return _options +// TransformColumnProperties : Defines column-level data masking transformation properties. This schema specifies the type of masking to apply to +// sensitive data columns, optional masking conditions, and the list of users or groups (grantees) who are authorized to +// view the masked data. Column masking helps protect sensitive information while maintaining data utility for +// authorized users. +type TransformColumnProperties struct { + // List of users and/or user groups who are granted permission to access the data with the specified masking + // transformation applied. Each grantee will see the column data masked according to the mask_type specified. + MaskCondition *string `json:"mask_condition,omitempty"` + + // The masking algorithm to apply to the column data. Specifies how sensitive data should be obfuscated or transformed. + // Common types include showing only the last N characters, replacing with fixed characters, hashing, or nullifying the + // data. + MaskType *string `json:"mask_type,omitempty"` + + // Defines column-level masking configuration for specific users or groups (grantees). Supports predefined masking + // types and allows specifying a custom masking expression when the mask type is set to CUSTOM. + MaskValue *string `json:"mask_value,omitempty"` } -// SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *UpdateBucketRegistrationOptions) SetAuthInstanceID(authInstanceID string) *UpdateBucketRegistrationOptions { - _options.AuthInstanceID = core.StringPtr(authInstanceID) - return _options +// Constants associated with the TransformColumnProperties.MaskType property. +// The masking algorithm to apply to the column data. Specifies how sensitive data should be obfuscated or transformed. +// Common types include showing only the last N characters, replacing with fixed characters, hashing, or nullifying the +// data. +const ( + TransformColumnProperties_MaskType_Custom = "custom" + TransformColumnProperties_MaskType_Hash = "hash" + TransformColumnProperties_MaskType_MaskDateShowYear = "mask_date_show_year" + TransformColumnProperties_MaskType_MaskShowFirst4 = "mask_show_first_4" + TransformColumnProperties_MaskType_MaskShowLast4 = "mask_show_last_4" + TransformColumnProperties_MaskType_None = "none" + TransformColumnProperties_MaskType_Null = "null" + TransformColumnProperties_MaskType_Redact = "redact" +) + +// UnmarshalTransformColumnProperties unmarshals an instance of TransformColumnProperties from the specified map of raw messages. +func UnmarshalTransformColumnProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TransformColumnProperties) + err = core.UnmarshalPrimitive(m, "mask_condition", &obj.MaskCondition) + if err != nil { + err = core.SDKErrorf(err, "", "mask_condition-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mask_type", &obj.MaskType) + if err != nil { + err = core.SDKErrorf(err, "", "mask_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mask_value", &obj.MaskValue) + if err != nil { + err = core.SDKErrorf(err, "", "mask_value-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return } -// SetHeaders : Allow user to set Headers -func (options *UpdateBucketRegistrationOptions) SetHeaders(param map[string]string) *UpdateBucketRegistrationOptions { - options.Headers = param - return options +// TransformColumnResponseProperties : Defines column-level data masking transformation properties. This schema specifies the type of masking to apply to +// sensitive data columns, optional masking conditions, and the list of users or groups (grantees) who are authorized to +// view the masked data. Column masking helps protect sensitive information while maintaining data utility for +// authorized users. +type TransformColumnResponseProperties struct { + // List of users and/or user groups who are granted permission to access the data with the specified masking + // transformation applied. Each grantee will see the column data masked according to the mask_type specified. + MaskCondition *string `json:"mask_condition,omitempty"` + + // The masking algorithm to apply to the column data. Specifies how sensitive data should be obfuscated or transformed. + // Common types include showing only the last N characters, replacing with fixed characters, hashing, or nullifying the + // data. + MaskType *string `json:"mask_type" validate:"required"` + + // Defines column-level masking configuration for specific users or groups (grantees). Supports predefined masking + // types and allows specifying a custom masking expression when the mask type is set to CUSTOM. + MaskValue *string `json:"mask_value,omitempty"` +} + +// Constants associated with the TransformColumnResponseProperties.MaskType property. +// The masking algorithm to apply to the column data. Specifies how sensitive data should be obfuscated or transformed. +// Common types include showing only the last N characters, replacing with fixed characters, hashing, or nullifying the +// data. +const ( + TransformColumnResponseProperties_MaskType_Custom = "custom" + TransformColumnResponseProperties_MaskType_Hash = "hash" + TransformColumnResponseProperties_MaskType_MaskDateShowYear = "mask_date_show_year" + TransformColumnResponseProperties_MaskType_MaskShowFirst4 = "mask_show_first_4" + TransformColumnResponseProperties_MaskType_MaskShowLast4 = "mask_show_last_4" + TransformColumnResponseProperties_MaskType_None = "none" + TransformColumnResponseProperties_MaskType_Null = "null" + TransformColumnResponseProperties_MaskType_Redact = "redact" +) + +// UnmarshalTransformColumnResponseProperties unmarshals an instance of TransformColumnResponseProperties from the specified map of raw messages. +func UnmarshalTransformColumnResponseProperties(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TransformColumnResponseProperties) + err = core.UnmarshalPrimitive(m, "mask_condition", &obj.MaskCondition) + if err != nil { + err = core.SDKErrorf(err, "", "mask_condition-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mask_type", &obj.MaskType) + if err != nil { + err = core.SDKErrorf(err, "", "mask_type-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "mask_value", &obj.MaskValue) + if err != nil { + err = core.SDKErrorf(err, "", "mask_value-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UpdateAutoScalingRequest : Request body for updating autoscaling configuration. +type UpdateAutoScalingRequest struct { + // Autoscaling configuration for engine. + AutoscalingConfig *AutoScalingConfig `json:"autoscaling_config,omitempty"` +} + +// UnmarshalUpdateAutoScalingRequest unmarshals an instance of UpdateAutoScalingRequest from the specified map of raw messages. +func UnmarshalUpdateAutoScalingRequest(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(UpdateAutoScalingRequest) + err = core.UnmarshalModel(m, "autoscaling_config", &obj.AutoscalingConfig, UnmarshalAutoScalingConfig) + if err != nil { + err = core.SDKErrorf(err, "", "autoscaling_config-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the UpdateAutoScalingRequest +func (updateAutoScalingRequest *UpdateAutoScalingRequest) AsPatch() (_patch map[string]interface{}, err error) { + _patch = map[string]interface{}{} + if !core.IsNil(updateAutoScalingRequest.AutoscalingConfig) { + _patch["autoscaling_config"] = updateAutoScalingRequest.AutoscalingConfig.asPatch() + } + + return } // UpdateColumnOptions : The UpdateColumn options. @@ -28170,22 +34092,22 @@ type UpdateColumnOptions struct { // engine id. EngineID *string `json:"engine_id" validate:"required"` - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` + // catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` // URL encoded schema name. - SchemaID *string `json:"schema_id" validate:"required,ne="` + SchemaName *string `json:"schema_name" validate:"required,ne="` - // URL encoded schema name. - TableID *string `json:"table_id" validate:"required,ne="` + // URL encoded table name. + TableName *string `json:"table_name" validate:"required,ne="` - // URL encoded schema name. - ColumnID *string `json:"column_id" validate:"required,ne="` + // Url encoded column name. + ColumnName *string `json:"column_name" validate:"required,ne="` // Request body. Body map[string]interface{} `json:"body" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -28193,13 +34115,13 @@ type UpdateColumnOptions struct { } // NewUpdateColumnOptions : Instantiate UpdateColumnOptions -func (*WatsonxDataV2) NewUpdateColumnOptions(engineID string, catalogID string, schemaID string, tableID string, columnID string, body map[string]interface{}) *UpdateColumnOptions { +func (*WatsonxDataV3) NewUpdateColumnOptions(engineID string, catalogName string, schemaName string, tableName string, columnName string, body map[string]interface{}) *UpdateColumnOptions { return &UpdateColumnOptions{ EngineID: core.StringPtr(engineID), - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - TableID: core.StringPtr(tableID), - ColumnID: core.StringPtr(columnID), + CatalogName: core.StringPtr(catalogName), + SchemaName: core.StringPtr(schemaName), + TableName: core.StringPtr(tableName), + ColumnName: core.StringPtr(columnName), Body: body, } } @@ -28210,27 +34132,27 @@ func (_options *UpdateColumnOptions) SetEngineID(engineID string) *UpdateColumnO return _options } -// SetCatalogID : Allow user to set CatalogID -func (_options *UpdateColumnOptions) SetCatalogID(catalogID string) *UpdateColumnOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetCatalogName : Allow user to set CatalogName +func (_options *UpdateColumnOptions) SetCatalogName(catalogName string) *UpdateColumnOptions { + _options.CatalogName = core.StringPtr(catalogName) return _options } -// SetSchemaID : Allow user to set SchemaID -func (_options *UpdateColumnOptions) SetSchemaID(schemaID string) *UpdateColumnOptions { - _options.SchemaID = core.StringPtr(schemaID) +// SetSchemaName : Allow user to set SchemaName +func (_options *UpdateColumnOptions) SetSchemaName(schemaName string) *UpdateColumnOptions { + _options.SchemaName = core.StringPtr(schemaName) return _options } -// SetTableID : Allow user to set TableID -func (_options *UpdateColumnOptions) SetTableID(tableID string) *UpdateColumnOptions { - _options.TableID = core.StringPtr(tableID) +// SetTableName : Allow user to set TableName +func (_options *UpdateColumnOptions) SetTableName(tableName string) *UpdateColumnOptions { + _options.TableName = core.StringPtr(tableName) return _options } -// SetColumnID : Allow user to set ColumnID -func (_options *UpdateColumnOptions) SetColumnID(columnID string) *UpdateColumnOptions { - _options.ColumnID = core.StringPtr(columnID) +// SetColumnName : Allow user to set ColumnName +func (_options *UpdateColumnOptions) SetColumnName(columnName string) *UpdateColumnOptions { + _options.ColumnName = core.StringPtr(columnName) return _options } @@ -28252,179 +34174,184 @@ func (options *UpdateColumnOptions) SetHeaders(param map[string]string) *UpdateC return options } -// UpdateDatabaseOptions : The UpdateDatabase options. -type UpdateDatabaseOptions struct { - // database id. - DatabaseID *string `json:"database_id" validate:"required,ne="` +// UpdateDataPolicyOptions : The UpdateDataPolicy options. +type UpdateDataPolicyOptions struct { + // data policy name as path param to update the users or user groups using PATCH method. + Name *string `json:"name" validate:"required,ne="` - // Request body. - Body map[string]interface{} `json:"body" validate:"required"` + // PolicyV2Patch schema contains operation, path and value. Operation can be add or remove, JSON pointer path of the + // property to be updated in the data policy. Currently only grantees inside rules (/rules/[ruleIndex]/grantees) can be + // updated and value contain list of rules. + Body []JSONPatchOperation `json:"body" validate:"required"` - // CRN. + // Unique identifier assigned to a specific watsonx.data instance. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewUpdateDatabaseOptions : Instantiate UpdateDatabaseOptions -func (*WatsonxDataV2) NewUpdateDatabaseOptions(databaseID string, body map[string]interface{}) *UpdateDatabaseOptions { - return &UpdateDatabaseOptions{ - DatabaseID: core.StringPtr(databaseID), +// NewUpdateDataPolicyOptions : Instantiate UpdateDataPolicyOptions +func (*WatsonxDataV3) NewUpdateDataPolicyOptions(name string, body []JSONPatchOperation) *UpdateDataPolicyOptions { + return &UpdateDataPolicyOptions{ + Name: core.StringPtr(name), Body: body, } } -// SetDatabaseID : Allow user to set DatabaseID -func (_options *UpdateDatabaseOptions) SetDatabaseID(databaseID string) *UpdateDatabaseOptions { - _options.DatabaseID = core.StringPtr(databaseID) +// SetName : Allow user to set Name +func (_options *UpdateDataPolicyOptions) SetName(name string) *UpdateDataPolicyOptions { + _options.Name = core.StringPtr(name) return _options } // SetBody : Allow user to set Body -func (_options *UpdateDatabaseOptions) SetBody(body map[string]interface{}) *UpdateDatabaseOptions { +func (_options *UpdateDataPolicyOptions) SetBody(body []JSONPatchOperation) *UpdateDataPolicyOptions { _options.Body = body return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *UpdateDatabaseOptions) SetAuthInstanceID(authInstanceID string) *UpdateDatabaseOptions { +func (_options *UpdateDataPolicyOptions) SetAuthInstanceID(authInstanceID string) *UpdateDataPolicyOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *UpdateDatabaseOptions) SetHeaders(param map[string]string) *UpdateDatabaseOptions { +func (options *UpdateDataPolicyOptions) SetHeaders(param map[string]string) *UpdateDataPolicyOptions { options.Headers = param return options } -// UpdateDb2EngineOptions : The UpdateDb2Engine options. -type UpdateDb2EngineOptions struct { - // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` +// UpdateDatabaseOptions : The UpdateDatabase options. +type UpdateDatabaseOptions struct { + // database id. + ID *string `json:"id" validate:"required,ne="` - // Update Engine Body. + // Request body. Body map[string]interface{} `json:"body" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewUpdateDb2EngineOptions : Instantiate UpdateDb2EngineOptions -func (*WatsonxDataV2) NewUpdateDb2EngineOptions(engineID string, body map[string]interface{}) *UpdateDb2EngineOptions { - return &UpdateDb2EngineOptions{ - EngineID: core.StringPtr(engineID), +// NewUpdateDatabaseOptions : Instantiate UpdateDatabaseOptions +func (*WatsonxDataV3) NewUpdateDatabaseOptions(id string, body map[string]interface{}) *UpdateDatabaseOptions { + return &UpdateDatabaseOptions{ + ID: core.StringPtr(id), Body: body, } } -// SetEngineID : Allow user to set EngineID -func (_options *UpdateDb2EngineOptions) SetEngineID(engineID string) *UpdateDb2EngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *UpdateDatabaseOptions) SetID(id string) *UpdateDatabaseOptions { + _options.ID = core.StringPtr(id) return _options } // SetBody : Allow user to set Body -func (_options *UpdateDb2EngineOptions) SetBody(body map[string]interface{}) *UpdateDb2EngineOptions { +func (_options *UpdateDatabaseOptions) SetBody(body map[string]interface{}) *UpdateDatabaseOptions { _options.Body = body return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *UpdateDb2EngineOptions) SetAuthInstanceID(authInstanceID string) *UpdateDb2EngineOptions { +func (_options *UpdateDatabaseOptions) SetAuthInstanceID(authInstanceID string) *UpdateDatabaseOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *UpdateDb2EngineOptions) SetHeaders(param map[string]string) *UpdateDb2EngineOptions { +func (options *UpdateDatabaseOptions) SetHeaders(param map[string]string) *UpdateDatabaseOptions { options.Headers = param return options } -// UpdateDriverEnginesOptions : The UpdateDriverEngines options. -type UpdateDriverEnginesOptions struct { - // driver id. - DriverID *string `json:"driver_id" validate:"required,ne="` +// UpdateDb2EngineOptions : The UpdateDb2Engine options. +type UpdateDb2EngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // Engine details. + // Update Engine Body. Body map[string]interface{} `json:"body" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewUpdateDriverEnginesOptions : Instantiate UpdateDriverEnginesOptions -func (*WatsonxDataV2) NewUpdateDriverEnginesOptions(driverID string, body map[string]interface{}) *UpdateDriverEnginesOptions { - return &UpdateDriverEnginesOptions{ - DriverID: core.StringPtr(driverID), +// NewUpdateDb2EngineOptions : Instantiate UpdateDb2EngineOptions +func (*WatsonxDataV3) NewUpdateDb2EngineOptions(id string, body map[string]interface{}) *UpdateDb2EngineOptions { + return &UpdateDb2EngineOptions{ + ID: core.StringPtr(id), Body: body, } } -// SetDriverID : Allow user to set DriverID -func (_options *UpdateDriverEnginesOptions) SetDriverID(driverID string) *UpdateDriverEnginesOptions { - _options.DriverID = core.StringPtr(driverID) +// SetID : Allow user to set ID +func (_options *UpdateDb2EngineOptions) SetID(id string) *UpdateDb2EngineOptions { + _options.ID = core.StringPtr(id) return _options } // SetBody : Allow user to set Body -func (_options *UpdateDriverEnginesOptions) SetBody(body map[string]interface{}) *UpdateDriverEnginesOptions { +func (_options *UpdateDb2EngineOptions) SetBody(body map[string]interface{}) *UpdateDb2EngineOptions { _options.Body = body return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *UpdateDriverEnginesOptions) SetAuthInstanceID(authInstanceID string) *UpdateDriverEnginesOptions { +func (_options *UpdateDb2EngineOptions) SetAuthInstanceID(authInstanceID string) *UpdateDb2EngineOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *UpdateDriverEnginesOptions) SetHeaders(param map[string]string) *UpdateDriverEnginesOptions { +func (options *UpdateDb2EngineOptions) SetHeaders(param map[string]string) *UpdateDb2EngineOptions { options.Headers = param return options } // UpdateIntegrationOptions : The UpdateIntegration options. type UpdateIntegrationOptions struct { - // integration_id. - IntegrationID *string `json:"integration_id" validate:"required,ne="` + // Unique id to identify the integration. + ID *string `json:"id" validate:"required,ne="` - // Integration update parameters. - IntegrationPatch map[string]interface{} `json:"Integration_patch" validate:"required"` + // Body for parameters supported for integrations. + Body map[string]interface{} `json:"body" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // API Authentication service token. + Secret *string `json:"Secret,omitempty"` + // Allows users to set headers on API requests. Headers map[string]string } // NewUpdateIntegrationOptions : Instantiate UpdateIntegrationOptions -func (*WatsonxDataV2) NewUpdateIntegrationOptions(integrationID string, integrationPatch map[string]interface{}) *UpdateIntegrationOptions { +func (*WatsonxDataV3) NewUpdateIntegrationOptions(id string, body map[string]interface{}) *UpdateIntegrationOptions { return &UpdateIntegrationOptions{ - IntegrationID: core.StringPtr(integrationID), - IntegrationPatch: integrationPatch, + ID: core.StringPtr(id), + Body: body, } } -// SetIntegrationID : Allow user to set IntegrationID -func (_options *UpdateIntegrationOptions) SetIntegrationID(integrationID string) *UpdateIntegrationOptions { - _options.IntegrationID = core.StringPtr(integrationID) +// SetID : Allow user to set ID +func (_options *UpdateIntegrationOptions) SetID(id string) *UpdateIntegrationOptions { + _options.ID = core.StringPtr(id) return _options } -// SetIntegrationPatch : Allow user to set IntegrationPatch -func (_options *UpdateIntegrationOptions) SetIntegrationPatch(integrationPatch map[string]interface{}) *UpdateIntegrationOptions { - _options.IntegrationPatch = integrationPatch +// SetBody : Allow user to set Body +func (_options *UpdateIntegrationOptions) SetBody(body map[string]interface{}) *UpdateIntegrationOptions { + _options.Body = body return _options } @@ -28434,6 +34361,12 @@ func (_options *UpdateIntegrationOptions) SetAuthInstanceID(authInstanceID strin return _options } +// SetSecret : Allow user to set Secret +func (_options *UpdateIntegrationOptions) SetSecret(secret string) *UpdateIntegrationOptions { + _options.Secret = core.StringPtr(secret) + return _options +} + // SetHeaders : Allow user to set Headers func (options *UpdateIntegrationOptions) SetHeaders(param map[string]string) *UpdateIntegrationOptions { options.Headers = param @@ -28446,9 +34379,9 @@ type UpdateMilvusServiceBucketOptions struct { ServiceID *string `json:"service_id" validate:"required,ne="` // Update milvus service bucket. - Body map[string]interface{} `json:"body" validate:"required"` + Body []JSONPatchOperation `json:"body" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -28456,7 +34389,7 @@ type UpdateMilvusServiceBucketOptions struct { } // NewUpdateMilvusServiceBucketOptions : Instantiate UpdateMilvusServiceBucketOptions -func (*WatsonxDataV2) NewUpdateMilvusServiceBucketOptions(serviceID string, body map[string]interface{}) *UpdateMilvusServiceBucketOptions { +func (*WatsonxDataV3) NewUpdateMilvusServiceBucketOptions(serviceID string, body []JSONPatchOperation) *UpdateMilvusServiceBucketOptions { return &UpdateMilvusServiceBucketOptions{ ServiceID: core.StringPtr(serviceID), Body: body, @@ -28470,7 +34403,7 @@ func (_options *UpdateMilvusServiceBucketOptions) SetServiceID(serviceID string) } // SetBody : Allow user to set Body -func (_options *UpdateMilvusServiceBucketOptions) SetBody(body map[string]interface{}) *UpdateMilvusServiceBucketOptions { +func (_options *UpdateMilvusServiceBucketOptions) SetBody(body []JSONPatchOperation) *UpdateMilvusServiceBucketOptions { _options.Body = body return _options } @@ -28489,13 +34422,13 @@ func (options *UpdateMilvusServiceBucketOptions) SetHeaders(param map[string]str // UpdateMilvusServiceOptions : The UpdateMilvusService options. type UpdateMilvusServiceOptions struct { - // service id. - ServiceID *string `json:"service_id" validate:"required,ne="` + // id. + ID *string `json:"id" validate:"required,ne="` // Update milvus service. Body map[string]interface{} `json:"body" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -28503,16 +34436,16 @@ type UpdateMilvusServiceOptions struct { } // NewUpdateMilvusServiceOptions : Instantiate UpdateMilvusServiceOptions -func (*WatsonxDataV2) NewUpdateMilvusServiceOptions(serviceID string, body map[string]interface{}) *UpdateMilvusServiceOptions { +func (*WatsonxDataV3) NewUpdateMilvusServiceOptions(id string, body map[string]interface{}) *UpdateMilvusServiceOptions { return &UpdateMilvusServiceOptions{ - ServiceID: core.StringPtr(serviceID), + ID: core.StringPtr(id), Body: body, } } -// SetServiceID : Allow user to set ServiceID -func (_options *UpdateMilvusServiceOptions) SetServiceID(serviceID string) *UpdateMilvusServiceOptions { - _options.ServiceID = core.StringPtr(serviceID) +// SetID : Allow user to set ID +func (_options *UpdateMilvusServiceOptions) SetID(id string) *UpdateMilvusServiceOptions { + _options.ID = core.StringPtr(id) return _options } @@ -28537,12 +34470,12 @@ func (options *UpdateMilvusServiceOptions) SetHeaders(param map[string]string) * // UpdateNetezzaEngineOptions : The UpdateNetezzaEngine options. type UpdateNetezzaEngineOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` // Update Engine Body. Body map[string]interface{} `json:"body" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -28550,16 +34483,16 @@ type UpdateNetezzaEngineOptions struct { } // NewUpdateNetezzaEngineOptions : Instantiate UpdateNetezzaEngineOptions -func (*WatsonxDataV2) NewUpdateNetezzaEngineOptions(engineID string, body map[string]interface{}) *UpdateNetezzaEngineOptions { +func (*WatsonxDataV3) NewUpdateNetezzaEngineOptions(id string, body map[string]interface{}) *UpdateNetezzaEngineOptions { return &UpdateNetezzaEngineOptions{ - EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), Body: body, } } -// SetEngineID : Allow user to set EngineID -func (_options *UpdateNetezzaEngineOptions) SetEngineID(engineID string) *UpdateNetezzaEngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *UpdateNetezzaEngineOptions) SetID(id string) *UpdateNetezzaEngineOptions { + _options.ID = core.StringPtr(id) return _options } @@ -28584,12 +34517,12 @@ func (options *UpdateNetezzaEngineOptions) SetHeaders(param map[string]string) * // UpdatePrestissimoEngineOptions : The UpdatePrestissimoEngine options. type UpdatePrestissimoEngineOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` // Update prestissimo engine body. Body map[string]interface{} `json:"body" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -28597,16 +34530,16 @@ type UpdatePrestissimoEngineOptions struct { } // NewUpdatePrestissimoEngineOptions : Instantiate UpdatePrestissimoEngineOptions -func (*WatsonxDataV2) NewUpdatePrestissimoEngineOptions(engineID string, body map[string]interface{}) *UpdatePrestissimoEngineOptions { +func (*WatsonxDataV3) NewUpdatePrestissimoEngineOptions(id string, body map[string]interface{}) *UpdatePrestissimoEngineOptions { return &UpdatePrestissimoEngineOptions{ - EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), Body: body, } } -// SetEngineID : Allow user to set EngineID -func (_options *UpdatePrestissimoEngineOptions) SetEngineID(engineID string) *UpdatePrestissimoEngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *UpdatePrestissimoEngineOptions) SetID(id string) *UpdatePrestissimoEngineOptions { + _options.ID = core.StringPtr(id) return _options } @@ -28628,232 +34561,194 @@ func (options *UpdatePrestissimoEngineOptions) SetHeaders(param map[string]strin return options } -// UpdatePrestoEngineOptions : The UpdatePrestoEngine options. -type UpdatePrestoEngineOptions struct { - // engine id. +// UpdatePrestoEngineAutoscalingOptions : The UpdatePrestoEngineAutoscaling options. +type UpdatePrestoEngineAutoscalingOptions struct { + // Engine ID. EngineID *string `json:"engine_id" validate:"required,ne="` - // Update Engine Body. - Body map[string]interface{} `json:"body" validate:"required"` + // Autoscaling configuration. + UpdateAutoScalingRequestPatch map[string]interface{} `json:"UpdateAutoScalingRequest_patch" validate:"required"` - // CRN. + // Watsonx.data instance ID. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. Headers map[string]string } -// NewUpdatePrestoEngineOptions : Instantiate UpdatePrestoEngineOptions -func (*WatsonxDataV2) NewUpdatePrestoEngineOptions(engineID string, body map[string]interface{}) *UpdatePrestoEngineOptions { - return &UpdatePrestoEngineOptions{ +// NewUpdatePrestoEngineAutoscalingOptions : Instantiate UpdatePrestoEngineAutoscalingOptions +func (*WatsonxDataV3) NewUpdatePrestoEngineAutoscalingOptions(engineID string, updateAutoScalingRequestPatch map[string]interface{}) *UpdatePrestoEngineAutoscalingOptions { + return &UpdatePrestoEngineAutoscalingOptions{ EngineID: core.StringPtr(engineID), - Body: body, + UpdateAutoScalingRequestPatch: updateAutoScalingRequestPatch, } } // SetEngineID : Allow user to set EngineID -func (_options *UpdatePrestoEngineOptions) SetEngineID(engineID string) *UpdatePrestoEngineOptions { +func (_options *UpdatePrestoEngineAutoscalingOptions) SetEngineID(engineID string) *UpdatePrestoEngineAutoscalingOptions { _options.EngineID = core.StringPtr(engineID) return _options } -// SetBody : Allow user to set Body -func (_options *UpdatePrestoEngineOptions) SetBody(body map[string]interface{}) *UpdatePrestoEngineOptions { - _options.Body = body +// SetUpdateAutoScalingRequestPatch : Allow user to set UpdateAutoScalingRequestPatch +func (_options *UpdatePrestoEngineAutoscalingOptions) SetUpdateAutoScalingRequestPatch(updateAutoScalingRequestPatch map[string]interface{}) *UpdatePrestoEngineAutoscalingOptions { + _options.UpdateAutoScalingRequestPatch = updateAutoScalingRequestPatch return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *UpdatePrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *UpdatePrestoEngineOptions { +func (_options *UpdatePrestoEngineAutoscalingOptions) SetAuthInstanceID(authInstanceID string) *UpdatePrestoEngineAutoscalingOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } // SetHeaders : Allow user to set Headers -func (options *UpdatePrestoEngineOptions) SetHeaders(param map[string]string) *UpdatePrestoEngineOptions { +func (options *UpdatePrestoEngineAutoscalingOptions) SetHeaders(param map[string]string) *UpdatePrestoEngineAutoscalingOptions { options.Headers = param return options } -// UpdateSalIntegrationOptions : The UpdateSalIntegration options. -type UpdateSalIntegrationOptions struct { - // Request body. - Body map[string]interface{} `json:"body" validate:"required"` +// UpdatePrestoEngineConfigOptions : The UpdatePrestoEngineConfig options. +type UpdatePrestoEngineConfigOptions struct { + // Engine ID. + EngineID *string `json:"engine_id" validate:"required,ne="` - // CRN. - AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + // Authentication Instance ID (CRN). + AuthInstanceID *string `json:"AuthInstanceId" validate:"required"` + + // Engine properties configuration to update. + PrestoEnginePropertiesDetailsPatch map[string]interface{} `json:"PrestoEnginePropertiesDetails_patch" validate:"required"` // Allows users to set headers on API requests. Headers map[string]string } -// NewUpdateSalIntegrationOptions : Instantiate UpdateSalIntegrationOptions -func (*WatsonxDataV2) NewUpdateSalIntegrationOptions(body map[string]interface{}) *UpdateSalIntegrationOptions { - return &UpdateSalIntegrationOptions{ - Body: body, +// NewUpdatePrestoEngineConfigOptions : Instantiate UpdatePrestoEngineConfigOptions +func (*WatsonxDataV3) NewUpdatePrestoEngineConfigOptions(engineID string, authInstanceID string, prestoEnginePropertiesDetailsPatch map[string]interface{}) *UpdatePrestoEngineConfigOptions { + return &UpdatePrestoEngineConfigOptions{ + EngineID: core.StringPtr(engineID), + AuthInstanceID: core.StringPtr(authInstanceID), + PrestoEnginePropertiesDetailsPatch: prestoEnginePropertiesDetailsPatch, } } -// SetBody : Allow user to set Body -func (_options *UpdateSalIntegrationOptions) SetBody(body map[string]interface{}) *UpdateSalIntegrationOptions { - _options.Body = body +// SetEngineID : Allow user to set EngineID +func (_options *UpdatePrestoEngineConfigOptions) SetEngineID(engineID string) *UpdatePrestoEngineConfigOptions { + _options.EngineID = core.StringPtr(engineID) return _options } // SetAuthInstanceID : Allow user to set AuthInstanceID -func (_options *UpdateSalIntegrationOptions) SetAuthInstanceID(authInstanceID string) *UpdateSalIntegrationOptions { +func (_options *UpdatePrestoEngineConfigOptions) SetAuthInstanceID(authInstanceID string) *UpdatePrestoEngineConfigOptions { _options.AuthInstanceID = core.StringPtr(authInstanceID) return _options } +// SetPrestoEnginePropertiesDetailsPatch : Allow user to set PrestoEnginePropertiesDetailsPatch +func (_options *UpdatePrestoEngineConfigOptions) SetPrestoEnginePropertiesDetailsPatch(prestoEnginePropertiesDetailsPatch map[string]interface{}) *UpdatePrestoEngineConfigOptions { + _options.PrestoEnginePropertiesDetailsPatch = prestoEnginePropertiesDetailsPatch + return _options +} + // SetHeaders : Allow user to set Headers -func (options *UpdateSalIntegrationOptions) SetHeaders(param map[string]string) *UpdateSalIntegrationOptions { +func (options *UpdatePrestoEngineConfigOptions) SetHeaders(param map[string]string) *UpdatePrestoEngineConfigOptions { options.Headers = param return options } -// UpdateSparkEngineBody : UpdateEngine body. -type UpdateSparkEngineBody struct { - // Modified description. - Description *string `json:"description,omitempty"` +// UpdatePrestoEngineOptions : The UpdatePrestoEngine options. +type UpdatePrestoEngineOptions struct { + // engine id. + ID *string `json:"id" validate:"required,ne="` - // Engine details. - EngineDetails *UpdateSparkEngineBodyEngineDetails `json:"engine_details,omitempty"` + // Update Engine Body. + Body map[string]interface{} `json:"body" validate:"required"` - // Engine display name. - EngineDisplayName *string `json:"engine_display_name,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // Tags. - Tags []string `json:"tags,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalUpdateSparkEngineBody unmarshals an instance of UpdateSparkEngineBody from the specified map of raw messages. -func UnmarshalUpdateSparkEngineBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(UpdateSparkEngineBody) - err = core.UnmarshalPrimitive(m, "description", &obj.Description) - if err != nil { - err = core.SDKErrorf(err, "", "description-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "engine_details", &obj.EngineDetails, UnmarshalUpdateSparkEngineBodyEngineDetails) - if err != nil { - err = core.SDKErrorf(err, "", "engine_details-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "engine_display_name", &obj.EngineDisplayName) - if err != nil { - err = core.SDKErrorf(err, "", "engine_display_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) - if err != nil { - err = core.SDKErrorf(err, "", "tags-error", common.GetComponentInfo()) - return +// NewUpdatePrestoEngineOptions : Instantiate UpdatePrestoEngineOptions +func (*WatsonxDataV3) NewUpdatePrestoEngineOptions(id string, body map[string]interface{}) *UpdatePrestoEngineOptions { + return &UpdatePrestoEngineOptions{ + ID: core.StringPtr(id), + Body: body, } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// AsPatch returns a generic map representation of the UpdateSparkEngineBody -func (updateSparkEngineBody *UpdateSparkEngineBody) AsPatch() (_patch map[string]interface{}, err error) { - _patch = map[string]interface{}{} - if !core.IsNil(updateSparkEngineBody.Description) { - _patch["description"] = updateSparkEngineBody.Description - } - if !core.IsNil(updateSparkEngineBody.EngineDetails) { - _patch["engine_details"] = updateSparkEngineBody.EngineDetails.asPatch() - } - if !core.IsNil(updateSparkEngineBody.EngineDisplayName) { - _patch["engine_display_name"] = updateSparkEngineBody.EngineDisplayName - } - if !core.IsNil(updateSparkEngineBody.Tags) { - _patch["tags"] = updateSparkEngineBody.Tags - } +// SetID : Allow user to set ID +func (_options *UpdatePrestoEngineOptions) SetID(id string) *UpdatePrestoEngineOptions { + _options.ID = core.StringPtr(id) + return _options +} - return +// SetBody : Allow user to set Body +func (_options *UpdatePrestoEngineOptions) SetBody(body map[string]interface{}) *UpdatePrestoEngineOptions { + _options.Body = body + return _options } -// UpdateSparkEngineBodyEngineDetails : Engine details. -type UpdateSparkEngineBodyEngineDetails struct { - // Dynamic dict. - DefaultConfig map[string]string `json:"default_config,omitempty"` +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *UpdatePrestoEngineOptions) SetAuthInstanceID(authInstanceID string) *UpdatePrestoEngineOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} - // The default spark version for the native engine. - DefaultVersion *string `json:"default_version,omitempty"` +// SetHeaders : Allow user to set Headers +func (options *UpdatePrestoEngineOptions) SetHeaders(param map[string]string) *UpdatePrestoEngineOptions { + options.Headers = param + return options +} - // Default bucket for spark. - EngineHomeBucketName *string `json:"engine_home_bucket_name,omitempty"` +// UpdateSalIntegrationOptions : The UpdateSalIntegration options. +type UpdateSalIntegrationOptions struct { + // Request body. + SalIntegrationPatch map[string]interface{} `json:"SalIntegration_patch" validate:"required"` - // Resource limit enabled flag. - ResourceLimitEnabled *bool `json:"resource_limit_enabled,omitempty"` + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` - // Native spark engine resource quota. - ResourceLimits *SparkEngineResourceLimit `json:"resource_limits,omitempty"` + // Allows users to set headers on API requests. + Headers map[string]string } -// UnmarshalUpdateSparkEngineBodyEngineDetails unmarshals an instance of UpdateSparkEngineBodyEngineDetails from the specified map of raw messages. -func UnmarshalUpdateSparkEngineBodyEngineDetails(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(UpdateSparkEngineBodyEngineDetails) - err = core.UnmarshalPrimitive(m, "default_config", &obj.DefaultConfig) - if err != nil { - err = core.SDKErrorf(err, "", "default_config-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "default_version", &obj.DefaultVersion) - if err != nil { - err = core.SDKErrorf(err, "", "default_version-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "engine_home_bucket_name", &obj.EngineHomeBucketName) - if err != nil { - err = core.SDKErrorf(err, "", "engine_home_bucket_name-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalPrimitive(m, "resource_limit_enabled", &obj.ResourceLimitEnabled) - if err != nil { - err = core.SDKErrorf(err, "", "resource_limit_enabled-error", common.GetComponentInfo()) - return - } - err = core.UnmarshalModel(m, "resource_limits", &obj.ResourceLimits, UnmarshalSparkEngineResourceLimit) - if err != nil { - err = core.SDKErrorf(err, "", "resource_limits-error", common.GetComponentInfo()) - return +// NewUpdateSalIntegrationOptions : Instantiate UpdateSalIntegrationOptions +func (*WatsonxDataV3) NewUpdateSalIntegrationOptions(salIntegrationPatch map[string]interface{}) *UpdateSalIntegrationOptions { + return &UpdateSalIntegrationOptions{ + SalIntegrationPatch: salIntegrationPatch, } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return } -// asPatch returns a generic map representation of the UpdateSparkEngineBodyEngineDetails -func (updateSparkEngineBodyEngineDetails *UpdateSparkEngineBodyEngineDetails) asPatch() (_patch map[string]interface{}) { - _patch = map[string]interface{}{} - if !core.IsNil(updateSparkEngineBodyEngineDetails.DefaultConfig) { - _patch["default_config"] = updateSparkEngineBodyEngineDetails.DefaultConfig - } - if !core.IsNil(updateSparkEngineBodyEngineDetails.DefaultVersion) { - _patch["default_version"] = updateSparkEngineBodyEngineDetails.DefaultVersion - } - if !core.IsNil(updateSparkEngineBodyEngineDetails.EngineHomeBucketName) { - _patch["engine_home_bucket_name"] = updateSparkEngineBodyEngineDetails.EngineHomeBucketName - } - if !core.IsNil(updateSparkEngineBodyEngineDetails.ResourceLimitEnabled) { - _patch["resource_limit_enabled"] = updateSparkEngineBodyEngineDetails.ResourceLimitEnabled - } - if !core.IsNil(updateSparkEngineBodyEngineDetails.ResourceLimits) { - _patch["resource_limits"] = updateSparkEngineBodyEngineDetails.ResourceLimits.asPatch() - } +// SetSalIntegrationPatch : Allow user to set SalIntegrationPatch +func (_options *UpdateSalIntegrationOptions) SetSalIntegrationPatch(salIntegrationPatch map[string]interface{}) *UpdateSalIntegrationOptions { + _options.SalIntegrationPatch = salIntegrationPatch + return _options +} - return +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *UpdateSalIntegrationOptions) SetAuthInstanceID(authInstanceID string) *UpdateSalIntegrationOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSalIntegrationOptions) SetHeaders(param map[string]string) *UpdateSalIntegrationOptions { + options.Headers = param + return options } // UpdateSparkEngineOptions : The UpdateSparkEngine options. type UpdateSparkEngineOptions struct { // engine id. - EngineID *string `json:"engine_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` // Update Engine Body. Body map[string]interface{} `json:"body" validate:"required"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -28861,16 +34756,16 @@ type UpdateSparkEngineOptions struct { } // NewUpdateSparkEngineOptions : Instantiate UpdateSparkEngineOptions -func (*WatsonxDataV2) NewUpdateSparkEngineOptions(engineID string, body map[string]interface{}) *UpdateSparkEngineOptions { +func (*WatsonxDataV3) NewUpdateSparkEngineOptions(id string, body map[string]interface{}) *UpdateSparkEngineOptions { return &UpdateSparkEngineOptions{ - EngineID: core.StringPtr(engineID), + ID: core.StringPtr(id), Body: body, } } -// SetEngineID : Allow user to set EngineID -func (_options *UpdateSparkEngineOptions) SetEngineID(engineID string) *UpdateSparkEngineOptions { - _options.EngineID = core.StringPtr(engineID) +// SetID : Allow user to set ID +func (_options *UpdateSparkEngineOptions) SetID(id string) *UpdateSparkEngineOptions { + _options.ID = core.StringPtr(id) return _options } @@ -28892,33 +34787,83 @@ func (options *UpdateSparkEngineOptions) SetHeaders(param map[string]string) *Up return options } -// UpdateSyncCatalogOKBody : success response. -type UpdateSyncCatalogOKBody struct { - // Response of success. - Response *SuccessResponse `json:"response,omitempty"` +// UpdateStorageRegistrationOptions : The UpdateStorageRegistration options. +type UpdateStorageRegistrationOptions struct { + // storage id. + ID *string `json:"id" validate:"required,ne="` + + // Request body. + Body map[string]interface{} `json:"body" validate:"required"` + + // Skip MDS call when Unity catalog is added. + SkipMdsCall *bool `json:"skip_mds_call,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewUpdateStorageRegistrationOptions : Instantiate UpdateStorageRegistrationOptions +func (*WatsonxDataV3) NewUpdateStorageRegistrationOptions(id string, body map[string]interface{}) *UpdateStorageRegistrationOptions { + return &UpdateStorageRegistrationOptions{ + ID: core.StringPtr(id), + Body: body, + } +} + +// SetID : Allow user to set ID +func (_options *UpdateStorageRegistrationOptions) SetID(id string) *UpdateStorageRegistrationOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetBody : Allow user to set Body +func (_options *UpdateStorageRegistrationOptions) SetBody(body map[string]interface{}) *UpdateStorageRegistrationOptions { + _options.Body = body + return _options +} + +// SetSkipMdsCall : Allow user to set SkipMdsCall +func (_options *UpdateStorageRegistrationOptions) SetSkipMdsCall(skipMdsCall bool) *UpdateStorageRegistrationOptions { + _options.SkipMdsCall = core.BoolPtr(skipMdsCall) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *UpdateStorageRegistrationOptions) SetAuthInstanceID(authInstanceID string) *UpdateStorageRegistrationOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options } -// UnmarshalUpdateSyncCatalogOKBody unmarshals an instance of UpdateSyncCatalogOKBody from the specified map of raw messages. -func UnmarshalUpdateSyncCatalogOKBody(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(UpdateSyncCatalogOKBody) - err = core.UnmarshalModel(m, "response", &obj.Response, UnmarshalSuccessResponse) - if err != nil { - err = core.SDKErrorf(err, "", "response-error", common.GetComponentInfo()) - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return +// SetHeaders : Allow user to set Headers +func (options *UpdateStorageRegistrationOptions) SetHeaders(param map[string]string) *UpdateStorageRegistrationOptions { + options.Headers = param + return options } // UpdateSyncCatalogOptions : The UpdateSyncCatalog options. type UpdateSyncCatalogOptions struct { // catalog ID. - CatalogID *string `json:"catalog_id" validate:"required,ne="` + ID *string `json:"id" validate:"required,ne="` - // Request body. - Body map[string]interface{} `json:"body" validate:"required"` + // Automatically detect and add new tables to the system when they appear in the source. + AutoAddNewTables *bool `json:"auto_add_new_tables,omitempty"` + + // Register newly discovered tables in the system so they can be tracked and managed. + RegisterNewTables *bool `json:"register_new_tables,omitempty"` + + // Synchronize and update metadata for existing tables that are already registered. + SyncExistingTables *bool `json:"sync_existing_tables,omitempty"` + + // Indicates whether to synchronize metadata from Iceberg tables with the system. + SyncIcebergMd *bool `json:"sync_iceberg_md,omitempty"` + + // Path within the bucket from where the details will be sync-ed. + SyncPath *string `json:"sync_path,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -28926,22 +34871,45 @@ type UpdateSyncCatalogOptions struct { } // NewUpdateSyncCatalogOptions : Instantiate UpdateSyncCatalogOptions -func (*WatsonxDataV2) NewUpdateSyncCatalogOptions(catalogID string, body map[string]interface{}) *UpdateSyncCatalogOptions { +func (*WatsonxDataV3) NewUpdateSyncCatalogOptions(id string) *UpdateSyncCatalogOptions { return &UpdateSyncCatalogOptions{ - CatalogID: core.StringPtr(catalogID), - Body: body, + ID: core.StringPtr(id), } } -// SetCatalogID : Allow user to set CatalogID -func (_options *UpdateSyncCatalogOptions) SetCatalogID(catalogID string) *UpdateSyncCatalogOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetID : Allow user to set ID +func (_options *UpdateSyncCatalogOptions) SetID(id string) *UpdateSyncCatalogOptions { + _options.ID = core.StringPtr(id) return _options } -// SetBody : Allow user to set Body -func (_options *UpdateSyncCatalogOptions) SetBody(body map[string]interface{}) *UpdateSyncCatalogOptions { - _options.Body = body +// SetAutoAddNewTables : Allow user to set AutoAddNewTables +func (_options *UpdateSyncCatalogOptions) SetAutoAddNewTables(autoAddNewTables bool) *UpdateSyncCatalogOptions { + _options.AutoAddNewTables = core.BoolPtr(autoAddNewTables) + return _options +} + +// SetRegisterNewTables : Allow user to set RegisterNewTables +func (_options *UpdateSyncCatalogOptions) SetRegisterNewTables(registerNewTables bool) *UpdateSyncCatalogOptions { + _options.RegisterNewTables = core.BoolPtr(registerNewTables) + return _options +} + +// SetSyncExistingTables : Allow user to set SyncExistingTables +func (_options *UpdateSyncCatalogOptions) SetSyncExistingTables(syncExistingTables bool) *UpdateSyncCatalogOptions { + _options.SyncExistingTables = core.BoolPtr(syncExistingTables) + return _options +} + +// SetSyncIcebergMd : Allow user to set SyncIcebergMd +func (_options *UpdateSyncCatalogOptions) SetSyncIcebergMd(syncIcebergMd bool) *UpdateSyncCatalogOptions { + _options.SyncIcebergMd = core.BoolPtr(syncIcebergMd) + return _options +} + +// SetSyncPath : Allow user to set SyncPath +func (_options *UpdateSyncCatalogOptions) SetSyncPath(syncPath string) *UpdateSyncCatalogOptions { + _options.SyncPath = core.StringPtr(syncPath) return _options } @@ -28959,25 +34927,25 @@ func (options *UpdateSyncCatalogOptions) SetHeaders(param map[string]string) *Up // UpdateTableOptions : The UpdateTable options. type UpdateTableOptions struct { - // catalog id. - CatalogID *string `json:"catalog_id" validate:"required,ne="` + // catalog name. + CatalogName *string `json:"catalog_name" validate:"required,ne="` // URL encoded schema name. - SchemaID *string `json:"schema_id" validate:"required,ne="` + SchemaName *string `json:"schema_name" validate:"required,ne="` // URL encoded table name. - TableID *string `json:"table_id" validate:"required,ne="` + TableName *string `json:"table_name" validate:"required,ne="` - // engine id. + // Engine id of presto/prestissimo/spark/db2/netezza other engine. EngineID *string `json:"engine_id" validate:"required"` // Request body. Body map[string]interface{} `json:"body" validate:"required"` - // URL encoded table type. + // URL encoded table type (view,base table). Type *string `json:"type,omitempty"` - // CRN. + // watsonx.data instance ID for software , CRN for SAAS. AuthInstanceID *string `json:"AuthInstanceId,omitempty"` // Allows users to set headers on API requests. @@ -28985,31 +34953,31 @@ type UpdateTableOptions struct { } // NewUpdateTableOptions : Instantiate UpdateTableOptions -func (*WatsonxDataV2) NewUpdateTableOptions(catalogID string, schemaID string, tableID string, engineID string, body map[string]interface{}) *UpdateTableOptions { +func (*WatsonxDataV3) NewUpdateTableOptions(catalogName string, schemaName string, tableName string, engineID string, body map[string]interface{}) *UpdateTableOptions { return &UpdateTableOptions{ - CatalogID: core.StringPtr(catalogID), - SchemaID: core.StringPtr(schemaID), - TableID: core.StringPtr(tableID), + CatalogName: core.StringPtr(catalogName), + SchemaName: core.StringPtr(schemaName), + TableName: core.StringPtr(tableName), EngineID: core.StringPtr(engineID), Body: body, } } -// SetCatalogID : Allow user to set CatalogID -func (_options *UpdateTableOptions) SetCatalogID(catalogID string) *UpdateTableOptions { - _options.CatalogID = core.StringPtr(catalogID) +// SetCatalogName : Allow user to set CatalogName +func (_options *UpdateTableOptions) SetCatalogName(catalogName string) *UpdateTableOptions { + _options.CatalogName = core.StringPtr(catalogName) return _options } -// SetSchemaID : Allow user to set SchemaID -func (_options *UpdateTableOptions) SetSchemaID(schemaID string) *UpdateTableOptions { - _options.SchemaID = core.StringPtr(schemaID) +// SetSchemaName : Allow user to set SchemaName +func (_options *UpdateTableOptions) SetSchemaName(schemaName string) *UpdateTableOptions { + _options.SchemaName = core.StringPtr(schemaName) return _options } -// SetTableID : Allow user to set TableID -func (_options *UpdateTableOptions) SetTableID(tableID string) *UpdateTableOptions { - _options.TableID = core.StringPtr(tableID) +// SetTableName : Allow user to set TableName +func (_options *UpdateTableOptions) SetTableName(tableName string) *UpdateTableOptions { + _options.TableName = core.StringPtr(tableName) return _options } @@ -29043,46 +35011,297 @@ func (options *UpdateTableOptions) SetHeaders(param map[string]string) *UpdateTa return options } -// WatsonxInstanceDetailsCollection : List all Instance Details. -type WatsonxInstanceDetailsCollection struct { - // Engines and Services. - EnginesServices []EngineServiceDetailsCollection `json:"engines_services,omitempty"` +// ValidateIntegration : Validate Integration prototype. +type ValidateIntegration struct { + // A brief description of the `message_code`. + Message *string `json:"message,omitempty"` + + // Message code stating if a success or failure. + MessageCode *string `json:"message_code,omitempty"` + + // Details realted to the available resources for `ranger`. + RangerDetails *RangerDetails `json:"ranger_details,omitempty"` +} + +// UnmarshalValidateIntegration unmarshals an instance of ValidateIntegration from the specified map of raw messages. +func UnmarshalValidateIntegration(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ValidateIntegration) + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + err = core.SDKErrorf(err, "", "message-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalPrimitive(m, "message_code", &obj.MessageCode) + if err != nil { + err = core.SDKErrorf(err, "", "message_code-error", common.GetComponentInfo()) + return + } + err = core.UnmarshalModel(m, "ranger_details", &obj.RangerDetails, UnmarshalRangerDetails) + if err != nil { + err = core.SDKErrorf(err, "", "ranger_details-error", common.GetComponentInfo()) + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ValidateIntegrationOptions : The ValidateIntegration options. +type ValidateIntegrationOptions struct { + // Type of the integration to be integrated. It can only have the following values: `ranger`, `ikc`, `databand` and + // `manta`. + Type *string `json:"type" validate:"required"` + + // Access Token for the integration of type `databand`. + AccessToken *string `json:"access_token,omitempty"` + + // ApiKey for the integration of type `manta` and `ikc`. + Apikey *string `json:"apikey,omitempty"` + + // Details of catalogs associated with `ikc`. + Catalogs *Catalogs `json:"catalogs,omitempty"` + + // Certificate to be provided if ssl is enabled for integration type `ikc` in Cloud Pack for Data. + Certificate *string `json:"certificate,omitempty"` + + // Password for the integration of type `ranger`. + Password *string `json:"password,omitempty"` + + // SSL enabler/disabler for `ikc` in Cloud Pack for Data. + Ssl *bool `json:"ssl,omitempty"` + + // URL of the integration to be integrated. Applicable for all the 4 types: `ranger`, `ikc`, `databand` and `manta`. + URL *string `json:"url,omitempty"` + + // Username of the `ikc`/`manta`/`ranger` integration to be integrated. + Username *string `json:"username,omitempty"` + + // watsonx.data instance ID for software , CRN for SAAS. + AuthInstanceID *string `json:"AuthInstanceId,omitempty"` + + // Allows users to set headers on API requests. + Headers map[string]string +} + +// NewValidateIntegrationOptions : Instantiate ValidateIntegrationOptions +func (*WatsonxDataV3) NewValidateIntegrationOptions(typeVar string) *ValidateIntegrationOptions { + return &ValidateIntegrationOptions{ + Type: core.StringPtr(typeVar), + } +} + +// SetType : Allow user to set Type +func (_options *ValidateIntegrationOptions) SetType(typeVar string) *ValidateIntegrationOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetAccessToken : Allow user to set AccessToken +func (_options *ValidateIntegrationOptions) SetAccessToken(accessToken string) *ValidateIntegrationOptions { + _options.AccessToken = core.StringPtr(accessToken) + return _options +} + +// SetApikey : Allow user to set Apikey +func (_options *ValidateIntegrationOptions) SetApikey(apikey string) *ValidateIntegrationOptions { + _options.Apikey = core.StringPtr(apikey) + return _options +} + +// SetCatalogs : Allow user to set Catalogs +func (_options *ValidateIntegrationOptions) SetCatalogs(catalogs *Catalogs) *ValidateIntegrationOptions { + _options.Catalogs = catalogs + return _options +} + +// SetCertificate : Allow user to set Certificate +func (_options *ValidateIntegrationOptions) SetCertificate(certificate string) *ValidateIntegrationOptions { + _options.Certificate = core.StringPtr(certificate) + return _options +} + +// SetPassword : Allow user to set Password +func (_options *ValidateIntegrationOptions) SetPassword(password string) *ValidateIntegrationOptions { + _options.Password = core.StringPtr(password) + return _options +} + +// SetSsl : Allow user to set Ssl +func (_options *ValidateIntegrationOptions) SetSsl(ssl bool) *ValidateIntegrationOptions { + _options.Ssl = core.BoolPtr(ssl) + return _options +} + +// SetURL : Allow user to set URL +func (_options *ValidateIntegrationOptions) SetURL(url string) *ValidateIntegrationOptions { + _options.URL = core.StringPtr(url) + return _options +} + +// SetUsername : Allow user to set Username +func (_options *ValidateIntegrationOptions) SetUsername(username string) *ValidateIntegrationOptions { + _options.Username = core.StringPtr(username) + return _options +} + +// SetAuthInstanceID : Allow user to set AuthInstanceID +func (_options *ValidateIntegrationOptions) SetAuthInstanceID(authInstanceID string) *ValidateIntegrationOptions { + _options.AuthInstanceID = core.StringPtr(authInstanceID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ValidateIntegrationOptions) SetHeaders(param map[string]string) *ValidateIntegrationOptions { + options.Headers = param + return options +} + +// WorkerNodeDescriptionBody : Presto engine configurations. +type WorkerNodeDescriptionBody struct { + // Presto engine worker node type. + NodeType *string `json:"node_type" validate:"required"` + + // Quantity of presto engine nodes. + Quantity *int64 `json:"quantity" validate:"required"` +} - // Watsonx Instance Details. - WatsonxDataInstance *Details `json:"watsonx_data_instance,omitempty"` +// NewWorkerNodeDescriptionBody : Instantiate WorkerNodeDescriptionBody (Generic Model Constructor) +func (*WatsonxDataV3) NewWorkerNodeDescriptionBody(nodeType string, quantity int64) (_model *WorkerNodeDescriptionBody, err error) { + _model = &WorkerNodeDescriptionBody{ + NodeType: core.StringPtr(nodeType), + Quantity: core.Int64Ptr(quantity), + } + err = core.ValidateStruct(_model, "required parameters") + if err != nil { + err = core.SDKErrorf(err, "", "model-missing-required", common.GetComponentInfo()) + } + return } -// UnmarshalWatsonxInstanceDetailsCollection unmarshals an instance of WatsonxInstanceDetailsCollection from the specified map of raw messages. -func UnmarshalWatsonxInstanceDetailsCollection(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(WatsonxInstanceDetailsCollection) - err = core.UnmarshalModel(m, "engines_services", &obj.EnginesServices, UnmarshalEngineServiceDetailsCollection) +// UnmarshalWorkerNodeDescriptionBody unmarshals an instance of WorkerNodeDescriptionBody from the specified map of raw messages. +func UnmarshalWorkerNodeDescriptionBody(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(WorkerNodeDescriptionBody) + err = core.UnmarshalPrimitive(m, "node_type", &obj.NodeType) if err != nil { - err = core.SDKErrorf(err, "", "engines_services-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "node_type-error", common.GetComponentInfo()) return } - err = core.UnmarshalModel(m, "watsonx_data_instance", &obj.WatsonxDataInstance, UnmarshalDetails) + err = core.UnmarshalPrimitive(m, "quantity", &obj.Quantity) if err != nil { - err = core.SDKErrorf(err, "", "watsonx_data_instance-error", common.GetComponentInfo()) + err = core.SDKErrorf(err, "", "quantity-error", common.GetComponentInfo()) return } reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) return } +// +// SparkEngineApplicationsPager can be used to simplify the use of the "ListSparkEngineApplications" method. +// +type SparkEngineApplicationsPager struct { + hasNext bool + options *ListSparkEngineApplicationsOptions + client *WatsonxDataV3 + pageContext struct { + next *string + } +} + +// NewSparkEngineApplicationsPager returns a new SparkEngineApplicationsPager instance. +func (watsonxData *WatsonxDataV3) NewSparkEngineApplicationsPager(options *ListSparkEngineApplicationsOptions) (pager *SparkEngineApplicationsPager, err error) { + if options.Start != nil && *options.Start != "" { + err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) + return + } + + var optionsCopy ListSparkEngineApplicationsOptions = *options + pager = &SparkEngineApplicationsPager{ + hasNext: true, + options: &optionsCopy, + client: watsonxData, + } + return +} + +// HasNext returns true if there are potentially more results to be retrieved. +func (pager *SparkEngineApplicationsPager) HasNext() bool { + return pager.hasNext +} + +// GetNextWithContext returns the next page of results using the specified Context. +func (pager *SparkEngineApplicationsPager) GetNextWithContext(ctx context.Context) (page []SparkEngineApplicationSummary, err error) { + if !pager.HasNext() { + return nil, fmt.Errorf("no more results available") + } + + pager.options.Start = pager.pageContext.next + + result, _, err := pager.client.ListSparkEngineApplicationsWithContext(ctx, pager.options) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + + var next *string + if result.Next != nil { + var start *string + start, err = core.GetQueryParam(result.Next.Href, "start") + if err != nil { + errMsg := fmt.Sprintf("error retrieving 'start' query parameter from URL '%s': %s", *result.Next.Href, err.Error()) + err = core.SDKErrorf(err, errMsg, "get-query-error", common.GetComponentInfo()) + return + } + next = start + } + pager.pageContext.next = next + pager.hasNext = (pager.pageContext.next != nil) + page = result.Applications + + return +} + +// GetAllWithContext returns all results by invoking GetNextWithContext() repeatedly +// until all pages of results have been retrieved. +func (pager *SparkEngineApplicationsPager) GetAllWithContext(ctx context.Context) (allItems []SparkEngineApplicationSummary, err error) { + for pager.HasNext() { + var nextPage []SparkEngineApplicationSummary + nextPage, err = pager.GetNextWithContext(ctx) + if err != nil { + err = core.RepurposeSDKProblem(err, "error-getting-next-page") + return + } + allItems = append(allItems, nextPage...) + } + return +} + +// GetNext invokes GetNextWithContext() using context.Background() as the Context parameter. +func (pager *SparkEngineApplicationsPager) GetNext() (page []SparkEngineApplicationSummary, err error) { + page, err = pager.GetNextWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + +// GetAll invokes GetAllWithContext() using context.Background() as the Context parameter. +func (pager *SparkEngineApplicationsPager) GetAll() (allItems []SparkEngineApplicationSummary, err error) { + allItems, err = pager.GetAllWithContext(context.Background()) + err = core.RepurposeSDKProblem(err, "") + return +} + // // IngestionJobsPager can be used to simplify the use of the "ListIngestionJobs" method. // type IngestionJobsPager struct { hasNext bool options *ListIngestionJobsOptions - client *WatsonxDataV2 + client *WatsonxDataV3 pageContext struct { next *string } } // NewIngestionJobsPager returns a new IngestionJobsPager instance. -func (watsonxData *WatsonxDataV2) NewIngestionJobsPager(options *ListIngestionJobsOptions) (pager *IngestionJobsPager, err error) { +func (watsonxData *WatsonxDataV3) NewIngestionJobsPager(options *ListIngestionJobsOptions) (pager *IngestionJobsPager, err error) { if options.Start != nil && *options.Start != "" { err = core.SDKErrorf(nil, "the 'options.Start' field should not be set", "no-query-setting", common.GetComponentInfo()) return @@ -29129,7 +35348,7 @@ func (pager *IngestionJobsPager) GetNextWithContext(ctx context.Context) (page [ } pager.pageContext.next = next pager.hasNext = (pager.pageContext.next != nil) - page = result.IngestionJobs + page = result.Jobs return } diff --git a/watsonxdatav2/watsonx_data_v2_integration_test.go b/watsonxdatav3/watsonx_data_v3_integration_test.go similarity index 50% rename from watsonxdatav2/watsonx_data_v2_integration_test.go rename to watsonxdatav3/watsonx_data_v3_integration_test.go index 7643de7..23ff7a0 100644 --- a/watsonxdatav2/watsonx_data_v2_integration_test.go +++ b/watsonxdatav3/watsonx_data_v3_integration_test.go @@ -1,7 +1,7 @@ //go:build integration /** - * (C) Copyright IBM Corp. 2025. + * (C) Copyright IBM Corp. 2026. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ * limitations under the License. */ -package watsonxdatav2_test +package watsonxdatav3_test import ( "fmt" @@ -25,25 +25,25 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/watsonxdata-go-sdk/watsonxdatav2" + "github.com/IBM/watsonxdata-go-sdk/watsonxdatav3" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) /** - * This file contains an integration test for the watsonxdatav2 package. + * This file contains an integration test for the watsonxdatav3 package. * * Notes: * * The integration test will automatically skip tests if the required config file is not available. */ -var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { - const externalConfigFile = "../watsonx_data_v2.env" +var _ = Describe(`WatsonxDataV3 Integration Tests`, func() { + const externalConfigFile = "../watsonx_data_v3.env" var ( err error - watsonxDataService *watsonxdatav2.WatsonxDataV2 + watsonxDataService *watsonxdatav3.WatsonxDataV3 serviceURL string config map[string]string ) @@ -60,7 +60,7 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { } os.Setenv("IBM_CREDENTIALS_FILE", externalConfigFile) - config, err = core.GetServiceProperties(watsonxdatav2.DefaultServiceName) + config, err = core.GetServiceProperties(watsonxdatav3.DefaultServiceName) if err != nil { Skip("Error loading service properties, skipping tests: " + err.Error()) } @@ -79,9 +79,9 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It("Successfully construct the service client instance", func() { - watsonxDataServiceOptions := &watsonxdatav2.WatsonxDataV2Options{} + watsonxDataServiceOptions := &watsonxdatav3.WatsonxDataV3Options{} - watsonxDataService, err = watsonxdatav2.NewWatsonxDataV2UsingExternalConfig(watsonxDataServiceOptions) + watsonxDataService, err = watsonxdatav3.NewWatsonxDataV3UsingExternalConfig(watsonxDataServiceOptions) Expect(err).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) Expect(watsonxDataService.Service.Options.URL).To(Equal(serviceURL)) @@ -91,249 +91,260 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { }) }) - Describe(`ListBucketRegistrations - Get bucket registrations`, func() { + Describe(`CreateHdfsStorage - Add/Create HDFS storage`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CreateHdfsStorage(createHdfsStorageOptions *CreateHdfsStorageOptions)`, func() { + createHdfsStorageOptions := &watsonxdatav3.CreateHdfsStorageOptions{ + DisplayName: core.StringPtr("testString"), + Type: core.StringPtr("testString"), + HmsThriftURI: core.StringPtr("testString"), + HmsThriftPort: core.Int64Ptr(int64(1)), + CoreSite: core.StringPtr("testString"), + HdfsSite: core.StringPtr("testString"), + Kerberos: core.StringPtr("testString"), + CatalogName: core.StringPtr("testString"), + CatalogType: core.StringPtr("testString"), + Krb5Config: core.StringPtr("testString"), + HiveKeytab: CreateMockReader("This is a mock file."), + HiveKeytabContentType: core.StringPtr("testString"), + HdfsKeytab: CreateMockReader("This is a mock file."), + HdfsKeytabContentType: core.StringPtr("testString"), + HiveServerPrincipal: core.StringPtr("testString"), + HiveClientPrincipal: core.StringPtr("testString"), + HdfsPrincipal: core.StringPtr("testString"), + Description: core.StringPtr("testString"), + CreatedAt: core.StringPtr("testString"), + AuthInstanceID: core.StringPtr("testString"), + } + + hdfsStorageRegistration, response, err := watsonxDataService.CreateHdfsStorage(createHdfsStorageOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(hdfsStorageRegistration).ToNot(BeNil()) + }) + }) + + Describe(`ListStorageRegistrations - Get list of storage registrations`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListBucketRegistrations(listBucketRegistrationsOptions *ListBucketRegistrationsOptions)`, func() { - listBucketRegistrationsOptions := &watsonxdatav2.ListBucketRegistrationsOptions{ + It(`ListStorageRegistrations(listStorageRegistrationsOptions *ListStorageRegistrationsOptions)`, func() { + listStorageRegistrationsOptions := &watsonxdatav3.ListStorageRegistrationsOptions{ AuthInstanceID: core.StringPtr("testString"), } - bucketRegistrationCollection, response, err := watsonxDataService.ListBucketRegistrations(listBucketRegistrationsOptions) + storageRegistrationCollection, response, err := watsonxDataService.ListStorageRegistrations(listStorageRegistrationsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(bucketRegistrationCollection).ToNot(BeNil()) + Expect(storageRegistrationCollection).ToNot(BeNil()) }) }) - Describe(`CreateBucketRegistration - Register bucket`, func() { + Describe(`CreateStorageRegistration - Register storage`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateBucketRegistration(createBucketRegistrationOptions *CreateBucketRegistrationOptions)`, func() { - bucketCatalogModel := &watsonxdatav2.BucketCatalog{ + It(`CreateStorageRegistration(createStorageRegistrationOptions *CreateStorageRegistrationOptions)`, func() { + storageCatalogPrototypeModel := &watsonxdatav3.StorageCatalogPrototype{ BasePath: core.StringPtr("/abc/def"), CatalogName: core.StringPtr("sampleCatalog"), CatalogTags: []string{"catalog_tag_1", "catalog_tag_2"}, CatalogType: core.StringPtr("iceberg"), } - bucketDetailsModel := &watsonxdatav2.BucketDetails{ - AccessKey: core.StringPtr("b9cbf248ea5c4c96947e64407108559j"), - BucketName: core.StringPtr("sample-bucket"), - Endpoint: core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/"), - KeyFile: core.StringPtr("key_file"), - Provider: core.StringPtr("ibm_cos"), - Region: core.StringPtr("us-south"), - SecretKey: core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87"), + storageDetailsAccesskeyVaultModel := &watsonxdatav3.StorageDetailsAccesskeyVault{ + Key: core.StringPtr("secret key"), + SecretName: core.StringPtr("secret name"), + SecretUrn: core.StringPtr("secret urn"), } - storageDetailsModel := &watsonxdatav2.StorageDetails{ + storageDetailsModel := &watsonxdatav3.StorageDetails{ AccessKey: core.StringPtr(""), - ApplicationID: core.StringPtr(""), - AuthMode: core.StringPtr(""), + AccessKeyVault: storageDetailsAccesskeyVaultModel, + AccountName: core.StringPtr("sample-storage"), + ApplicationID: core.StringPtr("application-id"), + AuthMode: core.StringPtr("iam"), ContainerName: core.StringPtr("sample-container"), - DirectoryID: core.StringPtr(""), - Endpoint: core.StringPtr("abfss://@.dfs.core.windows.net/"), - SasToken: core.StringPtr(""), + DirectoryID: core.StringPtr("directory-id"), + Endpoint: core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/"), + KeyFile: core.StringPtr("key_file"), + Name: core.StringPtr("sample-storage"), + Provider: core.StringPtr("ibm-cos"), + Region: core.StringPtr("us-south"), + RoleArn: core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9"), + SasToken: core.StringPtr(""), SecretKey: core.StringPtr("secret_key"), - StorageAccountName: core.StringPtr("sample-storage"), + SecretKeyVault: storageDetailsAccesskeyVaultModel, + VaultEnabled: core.BoolPtr(true), } - createBucketRegistrationOptions := &watsonxdatav2.CreateBucketRegistrationOptions{ - BucketType: core.StringPtr("ibm_cos"), - Description: core.StringPtr("COS bucket for customer data"), + createStorageRegistrationOptions := &watsonxdatav3.CreateStorageRegistrationOptions{ + Description: core.StringPtr("COS storage for customer data"), + DisplayName: core.StringPtr("sample-storage-displayname"), ManagedBy: core.StringPtr("ibm"), - AssociatedCatalog: bucketCatalogModel, - BucketDetails: bucketDetailsModel, - BucketDisplayName: core.StringPtr("sample-bucket-displayname"), + Type: core.StringPtr("ibm_cos"), + AssociatedCatalog: storageCatalogPrototypeModel, + Connection: storageDetailsModel, Region: core.StringPtr("us-south"), - StorageDetails: storageDetailsModel, - Tags: []string{"bucket-tag1", "bucket-tag2"}, + StorageUse: core.StringPtr("acl"), + Tags: []string{"storage-tag1", "storage-tag2"}, AuthInstanceID: core.StringPtr("testString"), } - bucketRegistration, response, err := watsonxDataService.CreateBucketRegistration(createBucketRegistrationOptions) + storageRegistration, response, err := watsonxDataService.CreateStorageRegistration(createStorageRegistrationOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) - Expect(bucketRegistration).ToNot(BeNil()) + Expect(storageRegistration).ToNot(BeNil()) }) }) - Describe(`GetBucketRegistration - Get bucket`, func() { + Describe(`GetStorageRegistration - Get storage`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetBucketRegistration(getBucketRegistrationOptions *GetBucketRegistrationOptions)`, func() { - getBucketRegistrationOptions := &watsonxdatav2.GetBucketRegistrationOptions{ - BucketID: core.StringPtr("testString"), + It(`GetStorageRegistration(getStorageRegistrationOptions *GetStorageRegistrationOptions)`, func() { + getStorageRegistrationOptions := &watsonxdatav3.GetStorageRegistrationOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), + SkipMdsCall: core.BoolPtr(false), } - bucketRegistration, response, err := watsonxDataService.GetBucketRegistration(getBucketRegistrationOptions) + storageRegistration, response, err := watsonxDataService.GetStorageRegistration(getStorageRegistrationOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(bucketRegistration).ToNot(BeNil()) + Expect(storageRegistration).ToNot(BeNil()) }) }) - Describe(`UpdateBucketRegistration - Update bucket`, func() { + Describe(`UpdateStorageRegistration - Update storage`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`UpdateBucketRegistration(updateBucketRegistrationOptions *UpdateBucketRegistrationOptions)`, func() { - bucketDetailsModel := &watsonxdatav2.BucketDetails{ - AccessKey: core.StringPtr("b9cbf248ea5c4c96947e64407108559j"), - BucketName: core.StringPtr("sample-bucket"), - Endpoint: core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/"), + It(`UpdateStorageRegistration(updateStorageRegistrationOptions *UpdateStorageRegistrationOptions)`, func() { + storageDetailsAccesskeyVaultModel := &watsonxdatav3.StorageDetailsAccesskeyVault{ + Key: core.StringPtr("secret key"), + SecretName: core.StringPtr("secret name"), + SecretUrn: core.StringPtr("secret urn"), + } + + storageDetailsModel := &watsonxdatav3.StorageDetails{ + AccessKey: core.StringPtr(""), + AccessKeyVault: storageDetailsAccesskeyVaultModel, + AccountName: core.StringPtr("sample-storage"), + ApplicationID: core.StringPtr("application-id"), + AuthMode: core.StringPtr("iam"), + ContainerName: core.StringPtr("sample-container"), + DirectoryID: core.StringPtr("directory-id"), + Endpoint: core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/"), KeyFile: core.StringPtr("key_file"), - Provider: core.StringPtr("ibm_cos"), + Name: core.StringPtr("sample-storage"), + Provider: core.StringPtr("ibm-cos"), Region: core.StringPtr("us-south"), - SecretKey: core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87"), + RoleArn: core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9"), + SasToken: core.StringPtr(""), + SecretKey: core.StringPtr("secret_key"), + SecretKeyVault: storageDetailsAccesskeyVaultModel, + VaultEnabled: core.BoolPtr(true), } - bucketRegistrationPatchModel := &watsonxdatav2.BucketRegistrationPatch{ - BucketDetails: bucketDetailsModel, - BucketDisplayName: core.StringPtr("sample-bucket-displayname"), - Description: core.StringPtr("COS bucket for customer data"), - Tags: []string{"testbucket", "userbucket"}, + storageRegistrationPatchModel := &watsonxdatav3.StorageRegistrationPatch{ + Connection: storageDetailsModel, + Description: core.StringPtr("COS storage for customer data"), + DisplayName: core.StringPtr("sample-storage-displayname"), + SystemStorageUpdateCredentials: core.BoolPtr(true), + Tags: []string{"teststorage", "userstorage"}, } - bucketRegistrationPatchModelAsPatch, asPatchErr := bucketRegistrationPatchModel.AsPatch() + storageRegistrationPatchModelAsPatch, asPatchErr := storageRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - updateBucketRegistrationOptions := &watsonxdatav2.UpdateBucketRegistrationOptions{ - BucketID: core.StringPtr("testString"), - Body: bucketRegistrationPatchModelAsPatch, + updateStorageRegistrationOptions := &watsonxdatav3.UpdateStorageRegistrationOptions{ + ID: core.StringPtr("testString"), + Body: storageRegistrationPatchModelAsPatch, + SkipMdsCall: core.BoolPtr(false), AuthInstanceID: core.StringPtr("testString"), } - bucketRegistration, response, err := watsonxDataService.UpdateBucketRegistration(updateBucketRegistrationOptions) + storageRegistration, response, err := watsonxDataService.UpdateStorageRegistration(updateStorageRegistrationOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(bucketRegistration).ToNot(BeNil()) - }) - }) - - Describe(`CreateActivateBucket - Activate Bucket`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CreateActivateBucket(createActivateBucketOptions *CreateActivateBucketOptions)`, func() { - createActivateBucketOptions := &watsonxdatav2.CreateActivateBucketOptions{ - BucketID: core.StringPtr("testString"), - AuthInstanceID: core.StringPtr("testString"), - } - - createActivateBucketCreatedBody, response, err := watsonxDataService.CreateActivateBucket(createActivateBucketOptions) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(createActivateBucketCreatedBody).ToNot(BeNil()) + Expect(storageRegistration).ToNot(BeNil()) }) }) - Describe(`AddBucketCatalog - Add bucket catalog`, func() { + Describe(`AddStorageCatalog - Add storage catalog`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`AddBucketCatalog(addBucketCatalogOptions *AddBucketCatalogOptions)`, func() { - addBucketCatalogOptions := &watsonxdatav2.AddBucketCatalogOptions{ - BucketID: core.StringPtr("testString"), + It(`AddStorageCatalog(addStorageCatalogOptions *AddStorageCatalogOptions)`, func() { + addStorageCatalogOptions := &watsonxdatav3.AddStorageCatalogOptions{ + StorageID: core.StringPtr("testString"), + CatalogTags: []string{"catalog_tag_1", "catalog_tag_2"}, BasePath: core.StringPtr("/abc/def"), CatalogName: core.StringPtr("sampleCatalog"), - CatalogTags: []string{"catalog_tag_1", "catalog_tag_2"}, CatalogType: core.StringPtr("iceberg"), + SkipMdsCall: core.BoolPtr(false), AuthInstanceID: core.StringPtr("testString"), } - successResponse, response, err := watsonxDataService.AddBucketCatalog(addBucketCatalogOptions) + successResponse, response, err := watsonxDataService.AddStorageCatalog(addStorageCatalogOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) Expect(successResponse).ToNot(BeNil()) }) }) - Describe(`ListBucketObjects - List bucket objects`, func() { + Describe(`GetStorageObjectProperties - Get storage object properties`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListBucketObjects(listBucketObjectsOptions *ListBucketObjectsOptions)`, func() { - listBucketObjectsOptions := &watsonxdatav2.ListBucketObjectsOptions{ - BucketID: core.StringPtr("testString"), - AuthInstanceID: core.StringPtr("testString"), + It(`GetStorageObjectProperties(getStorageObjectPropertiesOptions *GetStorageObjectPropertiesOptions)`, func() { + pathModel := &watsonxdatav3.Path{ Path: core.StringPtr("testString"), } - bucketRegistrationObjectCollection, response, err := watsonxDataService.ListBucketObjects(listBucketObjectsOptions) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(bucketRegistrationObjectCollection).ToNot(BeNil()) - }) - }) - - Describe(`GetBucketObjectProperties - Get bucket object properties`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetBucketObjectProperties(getBucketObjectPropertiesOptions *GetBucketObjectPropertiesOptions)`, func() { - pathModel := &watsonxdatav2.Path{ - Path: core.StringPtr("string"), - } - - getBucketObjectPropertiesOptions := &watsonxdatav2.GetBucketObjectPropertiesOptions{ - BucketID: core.StringPtr("testString"), - Paths: []watsonxdatav2.Path{*pathModel}, + getStorageObjectPropertiesOptions := &watsonxdatav3.GetStorageObjectPropertiesOptions{ + StorageID: core.StringPtr("testString"), + Paths: []watsonxdatav3.Path{*pathModel}, AuthInstanceID: core.StringPtr("testString"), } - bucketObjectProperties, response, err := watsonxDataService.GetBucketObjectProperties(getBucketObjectPropertiesOptions) + storageObjectProperties, response, err := watsonxDataService.GetStorageObjectProperties(getStorageObjectPropertiesOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) - Expect(bucketObjectProperties).ToNot(BeNil()) + Expect(storageObjectProperties).ToNot(BeNil()) }) }) - Describe(`CreateHdfsStorage - Add/Create HDFS storage`, func() { + Describe(`ListStorageRegistrationsObjects - List storage objects`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateHdfsStorage(createHdfsStorageOptions *CreateHdfsStorageOptions)`, func() { - createHdfsStorageOptions := &watsonxdatav2.CreateHdfsStorageOptions{ - BucketDisplayName: core.StringPtr("testString"), - BucketType: core.StringPtr("testString"), - HmsThriftURI: core.StringPtr("testString"), - HmsThriftPort: core.Int64Ptr(int64(1)), - CoreSite: core.StringPtr("testString"), - HdfsSite: core.StringPtr("testString"), - Kerberos: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), - CatalogType: core.StringPtr("testString"), - Krb5Config: core.StringPtr("testString"), - HiveKeytab: CreateMockReader("This is a mock file."), - HiveKeytabContentType: core.StringPtr("testString"), - HdfsKeytab: CreateMockReader("This is a mock file."), - HdfsKeytabContentType: core.StringPtr("testString"), - HiveServerPrincipal: core.StringPtr("testString"), - HiveClientPrincipal: core.StringPtr("testString"), - HdfsPrincipal: core.StringPtr("testString"), - Description: core.StringPtr("testString"), - CreatedOn: core.StringPtr("testString"), + It(`ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptions *ListStorageRegistrationsObjectsOptions)`, func() { + listStorageRegistrationsObjectsOptions := &watsonxdatav3.ListStorageRegistrationsObjectsOptions{ + StorageID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), + Path: core.StringPtr("testString"), + Paginated: core.BoolPtr(true), + PageSize: core.Int64Ptr(int64(1)), + Prefix: core.StringPtr("testString"), + StartAfter: core.StringPtr("testString"), } - hdfsStorageRegistration, response, err := watsonxDataService.CreateHdfsStorage(createHdfsStorageOptions) + storageRegistrationObjectCollection, response, err := watsonxDataService.ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(hdfsStorageRegistration).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(storageRegistrationObjectCollection).ToNot(BeNil()) }) }) - Describe(`ListDatabaseRegistrations - Get databases`, func() { + Describe(`ListDatabaseRegistrations - Get list of databases`, func() { BeforeEach(func() { shouldSkipTest() }) It(`ListDatabaseRegistrations(listDatabaseRegistrationsOptions *ListDatabaseRegistrationsOptions)`, func() { - listDatabaseRegistrationsOptions := &watsonxdatav2.ListDatabaseRegistrationsOptions{ + listDatabaseRegistrationsOptions := &watsonxdatav3.ListDatabaseRegistrationsOptions{ AuthInstanceID: core.StringPtr("testString"), } @@ -349,19 +360,28 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`CreateDatabaseRegistration(createDatabaseRegistrationOptions *CreateDatabaseRegistrationOptions)`, func() { - databaseCatalogModel := &watsonxdatav2.DatabaseCatalog{ + databaseCatalogPrototypeModel := &watsonxdatav3.DatabaseCatalogPrototype{ CatalogName: core.StringPtr("sampleCatalog"), - CatalogTags: []string{"catalog_tag_1", "catalog_tag_2"}, CatalogType: core.StringPtr("iceberg"), } - databaseDetailsModel := &watsonxdatav2.DatabaseDetails{ - AuthenticationType: core.StringPtr("LDAP"), + secretDetailsModel := &watsonxdatav3.SecretDetails{ + Key: core.StringPtr("secret key"), + SecretName: core.StringPtr("secret name"), + SecretUrn: core.StringPtr("secret urn"), + } + + databaseDetailsPrototypeModel := &watsonxdatav3.DatabaseDetailsPrototype{ + AuthenticationType: core.StringPtr("LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword"), + AuthenticationValue: core.StringPtr("LDAP"), + AuthenticationValueKeyVault: secretDetailsModel, BrokerAuthenticationPassword: core.StringPtr("samplepassword"), BrokerAuthenticationType: core.StringPtr("PASSWORD"), BrokerAuthenticationUser: core.StringPtr("sampleuser"), - Certificate: core.StringPtr("contents of a pem/crt file"), - CertificateExtension: core.StringPtr("pem/crt"), + BrokerHost: core.StringPtr("samplehost"), + BrokerPort: core.Int64Ptr(int64(4553)), + Certificate: core.StringPtr("exampleCertificate"), + CertificateExtension: core.StringPtr("pem"), ConnectionMethod: core.StringPtr("basic, apikey"), ConnectionMode: core.StringPtr("service_name"), ConnectionModeValue: core.StringPtr("orclpdb"), @@ -369,17 +389,24 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { ControllerAuthenticationPassword: core.StringPtr("samplepassword"), ControllerAuthenticationType: core.StringPtr("PASSWORD"), ControllerAuthenticationUser: core.StringPtr("sampleuser"), + CoordinatorHost: core.StringPtr("samplehost"), + CoordinatorPort: core.Int64Ptr(int64(4553)), CpdHostname: core.StringPtr("samplecpdhostname"), CredentialsKey: core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......"), - DatabaseName: core.StringPtr("new_database"), - Hostname: core.StringPtr("db2@.com"), + DomainName: core.StringPtr("conops-mssql.conops.local"), + Hostname: core.StringPtr("http://db2@localhost:9900.com"), HostnameInCertificate: core.StringPtr("samplehostname"), Hosts: core.StringPtr("abc.com:1234,xyz.com:4321"), InformixServer: core.StringPtr("ol_informix1410"), + Name: core.StringPtr("new_database"), Password: core.StringPtr("samplepassword"), + PasswordKeyVault: secretDetailsModel, Port: core.Int64Ptr(int64(4553)), ProjectID: core.StringPtr("conops-bigquery"), Sasl: core.BoolPtr(true), + SaslMechanism: core.StringPtr("plain"), + SchemaName: core.StringPtr("sampleSchema"), + Schemas: core.StringPtr("redis__name"), ServiceApiKey: core.StringPtr("sampleapikey"), ServiceHostname: core.StringPtr("api.dataplatform.dev.cloud.ibm.com"), ServicePassword: core.StringPtr("samplepassword"), @@ -388,27 +415,35 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { ServiceTokenURL: core.StringPtr("sampletoakenurl"), ServiceUsername: core.StringPtr("sampleusername"), Ssl: core.BoolPtr(true), - Tables: core.StringPtr("kafka_table_name"), + SslcertificateKeyVault: secretDetailsModel, + Tables: core.StringPtr("kafka_table_name, redis_table_name"), Username: core.StringPtr("sampleuser"), + UsernameKeyVault: secretDetailsModel, ValidateServerCertificate: core.BoolPtr(true), + VaultEnabled: core.BoolPtr(true), VerifyHostName: core.BoolPtr(true), + WarehouseName: core.StringPtr("samplewrehouse"), } - databaseRegistrationPrototypeDatabasePropertiesItemsModel := &watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems{ + databaseRegistrationPrototypeDatabasePropertiesItemsModel := &watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems{ Encrypt: core.BoolPtr(true), Key: core.StringPtr("abc"), Value: core.StringPtr("xyz"), } - createDatabaseRegistrationOptions := &watsonxdatav2.CreateDatabaseRegistrationOptions{ - DatabaseDisplayName: core.StringPtr("new_database"), - DatabaseType: core.StringPtr("db2"), - AssociatedCatalog: databaseCatalogModel, - CreatedOn: core.StringPtr("1686792721"), - DatabaseDetails: databaseDetailsModel, - DatabaseProperties: []watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel}, + createDatabaseRegistrationOptions := &watsonxdatav3.CreateDatabaseRegistrationOptions{ + DisplayName: core.StringPtr("new_database"), + Type: core.StringPtr("db2"), + AssociatedCatalog: databaseCatalogPrototypeModel, + Connection: databaseDetailsPrototypeModel, + CreatedAt: core.StringPtr("1686792721"), Description: core.StringPtr("db2 extenal database description"), + Properties: []watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel}, + SourceAssetID: core.StringPtr("cc85d899-9ec3-496a-be36-99cabc62f123"), + SourceCatalogID: core.StringPtr("cc85d899-9ec3-496a-be36-99cff962f000"), + SourceProjectID: core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116"), Tags: []string{"testdatabase", "userdatabase"}, + TargetCatalogID: core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116"), AuthInstanceID: core.StringPtr("testString"), } @@ -419,13 +454,31 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { }) }) + Describe(`AddDatabaseCatalog - Post database catalog`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`AddDatabaseCatalog(addDatabaseCatalogOptions *AddDatabaseCatalogOptions)`, func() { + addDatabaseCatalogOptions := &watsonxdatav3.AddDatabaseCatalogOptions{ + DatabaseID: core.StringPtr("testString"), + CatalogName: core.StringPtr("sampleCatalog"), + AuthInstanceID: core.StringPtr("testString"), + } + + successResponse, response, err := watsonxDataService.AddDatabaseCatalog(addDatabaseCatalogOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(successResponse).ToNot(BeNil()) + }) + }) + Describe(`GetDatabase - Get database`, func() { BeforeEach(func() { shouldSkipTest() }) It(`GetDatabase(getDatabaseOptions *GetDatabaseOptions)`, func() { - getDatabaseOptions := &watsonxdatav2.GetDatabaseOptions{ - DatabaseID: core.StringPtr("testString"), + getDatabaseOptions := &watsonxdatav3.GetDatabaseOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } @@ -441,30 +494,54 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`UpdateDatabase(updateDatabaseOptions *UpdateDatabaseOptions)`, func() { - databaseRegistrationPatchDatabaseDetailsModel := &watsonxdatav2.DatabaseRegistrationPatchDatabaseDetails{ + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel := &watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems{ + Encrypt: core.BoolPtr(true), + Key: core.StringPtr("abc"), + Value: core.StringPtr("xyz"), + } + + databaseRegistrationPatchDatabaseDetailsModel := &watsonxdatav3.DatabaseRegistrationPatchDatabaseDetails{ + AuthenticationValue: core.StringPtr("LDAP"), + BrokerAuthenticationPassword: core.StringPtr("samplepassword"), + BrokerAuthenticationType: core.StringPtr("PASSWORD"), + BrokerAuthenticationUser: core.StringPtr("sampleuser"), + ControllerAuthenticationPassword: core.StringPtr("samplepassword"), + ControllerAuthenticationType: core.StringPtr("PASSWORD"), + ControllerAuthenticationUser: core.StringPtr("sampleuser"), + CredentialsKey: core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......"), Password: core.StringPtr("samplepassword"), + Properties: []watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems{*databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel}, Username: core.StringPtr("sampleuser"), } - databaseRegistrationPatchTopicsItemsModel := &watsonxdatav2.DatabaseRegistrationPatchTopicsItems{ - CreatedOn: core.StringPtr("1686792721"), + databaseRegistrationPatchTablesItemsModel := &watsonxdatav3.DatabaseRegistrationPatchTablesItems{ + CreatedAt: core.StringPtr("1686792721"), + FileContents: core.StringPtr("sample file content"), + FileName: core.StringPtr("test.json"), + SchemaName: core.StringPtr("customer"), + TableName: core.StringPtr("customer"), + } + + databaseRegistrationPatchTopicsItemsModel := &watsonxdatav3.DatabaseRegistrationPatchTopicsItems{ + CreatedAt: core.StringPtr("1686792721"), FileContents: core.StringPtr("sample file contents"), - FileName: core.StringPtr("sample file name"), + FileName: core.StringPtr("test.json"), TopicName: core.StringPtr("customer"), } - databaseRegistrationPatchModel := &watsonxdatav2.DatabaseRegistrationPatch{ - DatabaseDetails: databaseRegistrationPatchDatabaseDetailsModel, - DatabaseDisplayName: core.StringPtr("new_database"), + databaseRegistrationPatchModel := &watsonxdatav3.DatabaseRegistrationPatch{ + Connection: databaseRegistrationPatchDatabaseDetailsModel, Description: core.StringPtr("External database description"), + DisplayName: core.StringPtr("new_database"), + Tables: []watsonxdatav3.DatabaseRegistrationPatchTablesItems{*databaseRegistrationPatchTablesItemsModel}, Tags: []string{"testdatabase", "userdatabase"}, - Topics: []watsonxdatav2.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel}, + Topics: []watsonxdatav3.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel}, } databaseRegistrationPatchModelAsPatch, asPatchErr := databaseRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - updateDatabaseOptions := &watsonxdatav2.UpdateDatabaseOptions{ - DatabaseID: core.StringPtr("testString"), + updateDatabaseOptions := &watsonxdatav3.UpdateDatabaseOptions{ + ID: core.StringPtr("testString"), Body: databaseRegistrationPatchModelAsPatch, AuthInstanceID: core.StringPtr("testString"), } @@ -476,432 +553,452 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { }) }) - Describe(`ListDriverRegistration - Get drivers`, func() { + Describe(`ListPrestoEngines - Get list of Presto(Java) engines`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListDriverRegistration(listDriverRegistrationOptions *ListDriverRegistrationOptions)`, func() { - listDriverRegistrationOptions := &watsonxdatav2.ListDriverRegistrationOptions{ + It(`ListPrestoEngines(listPrestoEnginesOptions *ListPrestoEnginesOptions)`, func() { + listPrestoEnginesOptions := &watsonxdatav3.ListPrestoEnginesOptions{ AuthInstanceID: core.StringPtr("testString"), } - driverRegistrationCollection, response, err := watsonxDataService.ListDriverRegistration(listDriverRegistrationOptions) + prestoEngineCollection, response, err := watsonxDataService.ListPrestoEngines(listPrestoEnginesOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(driverRegistrationCollection).ToNot(BeNil()) + Expect(prestoEngineCollection).ToNot(BeNil()) }) }) - Describe(`CreateDriverRegistration - Register driver`, func() { + Describe(`CreatePrestoEngine - Create presto engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateDriverRegistration(createDriverRegistrationOptions *CreateDriverRegistrationOptions)`, func() { - createDriverRegistrationOptions := &watsonxdatav2.CreateDriverRegistrationOptions{ - Driver: CreateMockReader("This is a mock file."), - DriverName: core.StringPtr("testString"), - ConnectionType: core.StringPtr("testString"), - DriverContentType: core.StringPtr("testString"), - Version: core.StringPtr("testString"), + It(`CreatePrestoEngine(createPrestoEngineOptions *CreatePrestoEngineOptions)`, func() { + coordinatorNodeDescriptionBodyModel := &watsonxdatav3.CoordinatorNodeDescriptionBody{ + NodeType: core.StringPtr("starter"), + Quantity: core.Int64Ptr(int64(1)), + } + + workerNodeDescriptionBodyModel := &watsonxdatav3.WorkerNodeDescriptionBody{ + NodeType: core.StringPtr("starter"), + Quantity: core.Int64Ptr(int64(1)), + } + + autoscalingConfigModel := &watsonxdatav3.AutoscalingConfig{ + Type: core.StringPtr("cpu"), + Target: core.Int64Ptr(int64(40)), + MinWorkerQuantity: core.Int64Ptr(int64(1)), + MaxWorkerQuantity: core.Int64Ptr(int64(18)), + QueryTerminationGracePeriodMin: core.Int64Ptr(int64(1)), + ScaleInStabilizationWindowMin: core.Int64Ptr(int64(5)), + ScalingStepSize: core.Int64Ptr(int64(1)), + } + + engineDetailsModel := &watsonxdatav3.EngineDetails{ + Coordinator: coordinatorNodeDescriptionBodyModel, + SizeConfig: core.StringPtr("starter"), + Worker: workerNodeDescriptionBodyModel, + AutoscalingEnabled: core.BoolPtr(true), + AutoscalingConfig: autoscalingConfigModel, + } + + createPrestoEngineOptions := &watsonxdatav3.CreatePrestoEngineOptions{ + Configuration: engineDetailsModel, + DisplayName: core.StringPtr("sampleEngine"), + Origin: core.StringPtr("native"), + AssociatedCatalogs: []string{"iceberg_data", "hive_data"}, + Description: core.StringPtr("presto engine for running sql queries"), + ID: core.StringPtr("presto123"), + Tags: []string{"tag1", "tag2"}, AuthInstanceID: core.StringPtr("testString"), } - driverRegistration, response, err := watsonxDataService.CreateDriverRegistration(createDriverRegistrationOptions) + prestoEngine, response, err := watsonxDataService.CreatePrestoEngine(createPrestoEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) - Expect(driverRegistration).ToNot(BeNil()) + Expect(prestoEngine).ToNot(BeNil()) }) }) - Describe(`UpdateDriverEngines - Associate engines to driver`, func() { + Describe(`UpdatePrestoEngineAutoscaling - Update Autoscaling Configuration`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`UpdateDriverEngines(updateDriverEnginesOptions *UpdateDriverEnginesOptions)`, func() { - driverRegistrationEnginePrototypeModel := &watsonxdatav2.DriverRegistrationEnginePrototype{ - Engines: []string{"testString"}, + It(`UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptions *UpdatePrestoEngineAutoscalingOptions)`, func() { + autoScalingConfigModel := &watsonxdatav3.AutoScalingConfig{ + Target: core.Int64Ptr(int64(40)), + MinWorkerQuantity: core.Int64Ptr(int64(1)), + MaxWorkerQuantity: core.Int64Ptr(int64(1)), + QueryTerminationGracePeriodMin: core.Int64Ptr(int64(1)), + ScaleInStabilizationWindowMin: core.Int64Ptr(int64(5)), + ScalingStepSize: core.Int64Ptr(int64(1)), } - driverRegistrationEnginePrototypeModelAsPatch, asPatchErr := driverRegistrationEnginePrototypeModel.AsPatch() + + updateAutoScalingRequestModel := &watsonxdatav3.UpdateAutoScalingRequest{ + AutoscalingConfig: autoScalingConfigModel, + } + updateAutoScalingRequestModelAsPatch, asPatchErr := updateAutoScalingRequestModel.AsPatch() Expect(asPatchErr).To(BeNil()) - updateDriverEnginesOptions := &watsonxdatav2.UpdateDriverEnginesOptions{ - DriverID: core.StringPtr("testString"), - Body: driverRegistrationEnginePrototypeModelAsPatch, + updatePrestoEngineAutoscalingOptions := &watsonxdatav3.UpdatePrestoEngineAutoscalingOptions{ + EngineID: core.StringPtr("testString"), + UpdateAutoScalingRequestPatch: updateAutoScalingRequestModelAsPatch, AuthInstanceID: core.StringPtr("testString"), } - driverRegistrationEngine, response, err := watsonxDataService.UpdateDriverEngines(updateDriverEnginesOptions) + patchAutoscalingSuccess, response, err := watsonxDataService.UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(driverRegistrationEngine).ToNot(BeNil()) + Expect(patchAutoscalingSuccess).ToNot(BeNil()) }) }) - Describe(`ListOtherEngines - List other engines`, func() { + Describe(`ListPrestoEngineCatalogs - Get presto engine catalogs`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListOtherEngines(listOtherEnginesOptions *ListOtherEnginesOptions)`, func() { - listOtherEnginesOptions := &watsonxdatav2.ListOtherEnginesOptions{ + It(`ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptions *ListPrestoEngineCatalogsOptions)`, func() { + listPrestoEngineCatalogsOptions := &watsonxdatav3.ListPrestoEngineCatalogsOptions{ + EngineID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - otherEngineCollection, response, err := watsonxDataService.ListOtherEngines(listOtherEnginesOptions) + catalogCollection, response, err := watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(otherEngineCollection).ToNot(BeNil()) + Expect(catalogCollection).ToNot(BeNil()) }) }) - Describe(`CreateOtherEngine - Create other engine`, func() { + Describe(`CreatePrestoEngineCatalogs - Associate catalogs to presto engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateOtherEngine(createOtherEngineOptions *CreateOtherEngineOptions)`, func() { - otherEngineDetailsBodyModel := &watsonxdatav2.OtherEngineDetailsBody{ - ConnectionString: core.StringPtr("1.2.3.4"), - EngineType: core.StringPtr("netezza"), - } - - createOtherEngineOptions := &watsonxdatav2.CreateOtherEngineOptions{ - EngineDetails: otherEngineDetailsBodyModel, - EngineDisplayName: core.StringPtr("sampleEngine01"), - Description: core.StringPtr("external engine description"), - Origin: core.StringPtr("external"), - Tags: []string{"tag1", "tag2"}, + It(`CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptions *CreatePrestoEngineCatalogsOptions)`, func() { + createPrestoEngineCatalogsOptions := &watsonxdatav3.CreatePrestoEngineCatalogsOptions{ + EngineID: core.StringPtr("testString"), + CatalogNames: []string{"iceberg_catalog"}, AuthInstanceID: core.StringPtr("testString"), } - otherEngine, response, err := watsonxDataService.CreateOtherEngine(createOtherEngineOptions) + catalog, response, err := watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) - Expect(otherEngine).ToNot(BeNil()) + Expect(catalog).ToNot(BeNil()) }) }) - Describe(`ListAllIntegrations - Get all existing Integrations`, func() { + Describe(`GetPrestoEngineCatalog - Get presto engine catalog`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListAllIntegrations(listAllIntegrationsOptions *ListAllIntegrationsOptions)`, func() { - listAllIntegrationsOptions := &watsonxdatav2.ListAllIntegrationsOptions{ + It(`GetPrestoEngineCatalog(getPrestoEngineCatalogOptions *GetPrestoEngineCatalogOptions)`, func() { + getPrestoEngineCatalogOptions := &watsonxdatav3.GetPrestoEngineCatalogOptions{ + EngineID: core.StringPtr("testString"), + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), - Secret: core.StringPtr("testString"), - ServiceType: core.StringPtr("testString"), - State: []string{"testString"}, } - integrationCollection, response, err := watsonxDataService.ListAllIntegrations(listAllIntegrationsOptions) + catalog, response, err := watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(integrationCollection).ToNot(BeNil()) + Expect(catalog).ToNot(BeNil()) }) }) - Describe(`CreateIntegration - To register an integration`, func() { + Describe(`GetPrestoEngineConfig - Get Presto Engine Configuration`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateIntegration(createIntegrationOptions *CreateIntegrationOptions)`, func() { - createIntegrationOptions := &watsonxdatav2.CreateIntegrationOptions{ - AccessToken: core.StringPtr("testString"), - Apikey: core.StringPtr("testString"), - CrossAccountIntegration: core.BoolPtr(true), - EnableDataPolicyWithinWxd: core.BoolPtr(false), - IkcUserAccountID: core.StringPtr("testString"), - Password: core.StringPtr("password"), - Resource: core.StringPtr("resource_name"), - ServiceType: core.StringPtr("ranger"), - StorageCatalogs: []string{"testString"}, - URL: core.StringPtr("http://abcd.efgh.com:9876/"), - Username: core.StringPtr("username"), - AuthInstanceID: core.StringPtr("testString"), + It(`GetPrestoEngineConfig(getPrestoEngineConfigOptions *GetPrestoEngineConfigOptions)`, func() { + getPrestoEngineConfigOptions := &watsonxdatav3.GetPrestoEngineConfigOptions{ + EngineID: core.StringPtr("presto860"), + AuthInstanceID: core.StringPtr("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::"), + Sections: core.StringPtr("catalog,configuration,jvm"), } - integration, response, err := watsonxDataService.CreateIntegration(createIntegrationOptions) + prestoEnginePropertiesDetails, response, err := watsonxDataService.GetPrestoEngineConfig(getPrestoEngineConfigOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(integration).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(prestoEnginePropertiesDetails).ToNot(BeNil()) }) }) - Describe(`GetIntegrations - Get an Integration`, func() { + Describe(`UpdatePrestoEngineConfig - Update Presto Engine Configuration`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetIntegrations(getIntegrationsOptions *GetIntegrationsOptions)`, func() { - getIntegrationsOptions := &watsonxdatav2.GetIntegrationsOptions{ - IntegrationID: core.StringPtr("testString"), - AuthInstanceID: core.StringPtr("testString"), - Secret: core.StringPtr("testString"), + It(`UpdatePrestoEngineConfig(updatePrestoEngineConfigOptions *UpdatePrestoEngineConfigOptions)`, func() { + catalogPropertiesModel := &watsonxdatav3.CatalogProperties{ + Coordinator: map[string]string{"key1": "testString"}, + Worker: map[string]string{"key1": "testString"}, } - integration, response, err := watsonxDataService.GetIntegrations(getIntegrationsOptions) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(integration).ToNot(BeNil()) - }) - }) + configurationPropertiesModel := &watsonxdatav3.ConfigurationProperties{ + Coordinator: map[string]string{"key1": "configuration_property_value"}, + Worker: map[string]string{"key1": "configuration_property_value"}, + } - Describe(`UpdateIntegration - Update an existing Integration`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`UpdateIntegration(updateIntegrationOptions *UpdateIntegrationOptions)`, func() { - integrationPatchModel := &watsonxdatav2.IntegrationPatch{ - AccessToken: core.StringPtr("uiOO90kklop"), - Apikey: core.StringPtr("apikey"), - CrossAccountIntegration: core.BoolPtr(false), - EnableDataPolicyWithinWxd: core.BoolPtr(true), - IkcUserAccountID: core.StringPtr("abcdefghijklmnopqrstuvwxyz"), - Password: core.StringPtr("password"), - Resource: core.StringPtr("resource_name"), - State: core.StringPtr("active"), - StorageCatalogs: []string{"iceberg_data", "hive_data"}, - URL: core.StringPtr("http://abcd.efgh.com:9876/"), - Username: core.StringPtr("username"), + jvmPropertiesModel := &watsonxdatav3.JvmProperties{ + Coordinator: map[string]string{"key1": "JVM_property_value"}, + Worker: map[string]string{"key1": "JVM_property_value"}, } - integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + + logConfigPropertiesModel := &watsonxdatav3.LogConfigProperties{ + Coordinator: map[string]string{"key1": "log_config_property_value"}, + Worker: map[string]string{"key1": "log_config_property_value"}, + } + + prestoEnginePropertiesModel := &watsonxdatav3.PrestoEngineProperties{ + Catalog: map[string]watsonxdatav3.CatalogProperties{"key1": *catalogPropertiesModel}, + Configuration: configurationPropertiesModel, + EventListener: map[string]string{"key1": "event_listener_property_value"}, + Global: map[string]string{"key1": "global_property_value"}, + JmxExporterConfig: map[string]string{"key1": "jmx_exporter_config_property_value"}, + Jvm: jvmPropertiesModel, + LogConfig: logConfigPropertiesModel, + } + prestoEnginePropertiesModel.Catalog["foo"] = *catalogPropertiesModel + + prestoEnginePropertiesDetailsModel := &watsonxdatav3.PrestoEnginePropertiesDetails{ + EngineProperties: prestoEnginePropertiesModel, + } + prestoEnginePropertiesDetailsModelAsPatch, asPatchErr := prestoEnginePropertiesDetailsModel.AsPatch() Expect(asPatchErr).To(BeNil()) - updateIntegrationOptions := &watsonxdatav2.UpdateIntegrationOptions{ - IntegrationID: core.StringPtr("testString"), - IntegrationPatch: integrationPatchModelAsPatch, - AuthInstanceID: core.StringPtr("testString"), + updatePrestoEngineConfigOptions := &watsonxdatav3.UpdatePrestoEngineConfigOptions{ + EngineID: core.StringPtr("presto93"), + AuthInstanceID: core.StringPtr("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::"), + PrestoEnginePropertiesDetailsPatch: prestoEnginePropertiesDetailsModelAsPatch, } - integration, response, err := watsonxDataService.UpdateIntegration(updateIntegrationOptions) + response, err := watsonxDataService.UpdatePrestoEngineConfig(updatePrestoEngineConfigOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(integration).ToNot(BeNil()) }) }) - Describe(`ListDb2Engines - Get list of db2 engines`, func() { + Describe(`GetPrestoEngine - Get presto engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListDb2Engines(listDb2EnginesOptions *ListDb2EnginesOptions)`, func() { - listDb2EnginesOptions := &watsonxdatav2.ListDb2EnginesOptions{ + It(`GetPrestoEngine(getPrestoEngineOptions *GetPrestoEngineOptions)`, func() { + getPrestoEngineOptions := &watsonxdatav3.GetPrestoEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - db2EngineCollection, response, err := watsonxDataService.ListDb2Engines(listDb2EnginesOptions) + prestoEngine, response, err := watsonxDataService.GetPrestoEngine(getPrestoEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(db2EngineCollection).ToNot(BeNil()) + Expect(prestoEngine).ToNot(BeNil()) }) }) - Describe(`CreateDb2Engine - Create db2 engine`, func() { + Describe(`UpdatePrestoEngine - Update presto engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateDb2Engine(createDb2EngineOptions *CreateDb2EngineOptions)`, func() { - db2EngineDetailsBodyModel := &watsonxdatav2.Db2EngineDetailsBody{ - ConnectionString: core.StringPtr("1.2.3.4"), + It(`UpdatePrestoEngine(updatePrestoEngineOptions *UpdatePrestoEngineOptions)`, func() { + enginePropertiesCatalogAdditionalPropertiesModel := &watsonxdatav3.EnginePropertiesCatalogAdditionalProperties{ + Coordinator: map[string]interface{}{"anyKey": "anyValue"}, + Worker: map[string]interface{}{"anyKey": "anyValue"}, } - createDb2EngineOptions := &watsonxdatav2.CreateDb2EngineOptions{ - Origin: core.StringPtr("external"), - Description: core.StringPtr("db2 engine description"), - EngineDetails: db2EngineDetailsBodyModel, - EngineDisplayName: core.StringPtr("sampleEngine"), - Tags: []string{"tag1", "tag2"}, - AuthInstanceID: core.StringPtr("testString"), + enginePropertiesConfigurationModel := &watsonxdatav3.EnginePropertiesConfiguration{ + Coordinator: map[string]string{"key1": "configuration_property_value"}, + Worker: map[string]string{"key1": "configuration_property_value"}, } - db2Engine, response, err := watsonxDataService.CreateDb2Engine(createDb2EngineOptions) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(db2Engine).ToNot(BeNil()) - }) - }) + enginePropertiesJvmModel := &watsonxdatav3.EnginePropertiesJvm{ + Coordinator: map[string]string{"key1": "JVM_property_value"}, + Worker: map[string]string{"key1": "JVM_property_value"}, + } - Describe(`UpdateDb2Engine - Update db2 engine`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`UpdateDb2Engine(updateDb2EngineOptions *UpdateDb2EngineOptions)`, func() { - db2EnginePatchModel := &watsonxdatav2.Db2EnginePatch{ - Description: core.StringPtr("db2 engine updated description"), - EngineDisplayName: core.StringPtr("sampleEngine"), - Tags: []string{"tag1", "tag2"}, + enginePropertiesLogConfigModel := &watsonxdatav3.EnginePropertiesLogConfig{ + Coordinator: map[string]string{"key1": "testString"}, + Worker: map[string]string{"key1": "log_config_property_value"}, } - db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - updateDb2EngineOptions := &watsonxdatav2.UpdateDb2EngineOptions{ - EngineID: core.StringPtr("testString"), - Body: db2EnginePatchModelAsPatch, - AuthInstanceID: core.StringPtr("testString"), + enginePropertiesModel := &watsonxdatav3.EngineProperties{ + Catalog: map[string]watsonxdatav3.EnginePropertiesCatalogAdditionalProperties{"key1": *enginePropertiesCatalogAdditionalPropertiesModel}, + Configuration: enginePropertiesConfigurationModel, + EventListener: map[string]string{"key1": "event_listener_property_value"}, + Global: map[string]string{"key1": "global_property_value"}, + JmxExporterConfig: map[string]string{"key1": "jmx_exporter_config_property_value"}, + Jvm: enginePropertiesJvmModel, + LogConfig: enginePropertiesLogConfigModel, } + enginePropertiesModel.Catalog["foo"] = *enginePropertiesCatalogAdditionalPropertiesModel - db2Engine, response, err := watsonxDataService.UpdateDb2Engine(updateDb2EngineOptions) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(db2Engine).ToNot(BeNil()) - }) - }) + removeEnginePropertiesCatalogAdditionalPropertiesModel := &watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties{ + Coordinator: []string{"property_name"}, + Worker: []string{"property_name"}, + } - Describe(`ListNetezzaEngines - Get list of netezza engines`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`ListNetezzaEngines(listNetezzaEnginesOptions *ListNetezzaEnginesOptions)`, func() { - listNetezzaEnginesOptions := &watsonxdatav2.ListNetezzaEnginesOptions{ - AuthInstanceID: core.StringPtr("testString"), + removeEnginePropertiesConfigurationModel := &watsonxdatav3.RemoveEnginePropertiesConfiguration{ + Coordinator: []string{"property_name"}, + Worker: []string{"property_name"}, } - netezzaEngineCollection, response, err := watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptions) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(netezzaEngineCollection).ToNot(BeNil()) - }) - }) + removeEnginePropertiesJvmModel := &watsonxdatav3.RemoveEnginePropertiesJvm{ + Coordinator: []string{"property_name"}, + Worker: []string{"property_name"}, + } - Describe(`CreateNetezzaEngine - Create netezza engine`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`CreateNetezzaEngine(createNetezzaEngineOptions *CreateNetezzaEngineOptions)`, func() { - netezzaEngineDetailsBodyModel := &watsonxdatav2.NetezzaEngineDetailsBody{ - ConnectionString: core.StringPtr("1.2.3.4"), + removeEnginePropertiesLogConfigModel := &watsonxdatav3.RemoveEnginePropertiesLogConfig{ + Coordinator: []string{"property_name"}, + Worker: []string{"property_name"}, } - createNetezzaEngineOptions := &watsonxdatav2.CreateNetezzaEngineOptions{ - Origin: core.StringPtr("external"), - Description: core.StringPtr("netezza engine description"), - EngineDetails: netezzaEngineDetailsBodyModel, - EngineDisplayName: core.StringPtr("sampleEngine"), + removeEnginePropertiesModel := &watsonxdatav3.RemoveEngineProperties{ + Catalog: map[string]watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties{"key1": *removeEnginePropertiesCatalogAdditionalPropertiesModel}, + Configuration: removeEnginePropertiesConfigurationModel, + EventListener: []string{"property_name"}, + Global: []string{"property_name"}, + JmxExporterConfig: []string{"testString"}, + Jvm: removeEnginePropertiesJvmModel, + LogConfig: removeEnginePropertiesLogConfigModel, + } + removeEnginePropertiesModel.Catalog["foo"] = *removeEnginePropertiesCatalogAdditionalPropertiesModel + + prestoEnginePatchModel := &watsonxdatav3.PrestoEnginePatch{ + Description: core.StringPtr("updated description for presto engine"), + DisplayName: core.StringPtr("sampleEngine"), + Properties: enginePropertiesModel, + RemoveEngineProperties: removeEnginePropertiesModel, + RestartType: core.StringPtr("force"), Tags: []string{"tag1", "tag2"}, + } + prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updatePrestoEngineOptions := &watsonxdatav3.UpdatePrestoEngineOptions{ + ID: core.StringPtr("testString"), + Body: prestoEnginePatchModelAsPatch, AuthInstanceID: core.StringPtr("testString"), } - netezzaEngine, response, err := watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptions) + prestoEngine, response, err := watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(netezzaEngine).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(prestoEngine).ToNot(BeNil()) }) }) - Describe(`UpdateNetezzaEngine - Update netezza engine`, func() { + Describe(`PausePrestoEngine - Pause presto engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`UpdateNetezzaEngine(updateNetezzaEngineOptions *UpdateNetezzaEngineOptions)`, func() { - netezzaEnginePatchModel := &watsonxdatav2.NetezzaEnginePatch{ - Description: core.StringPtr("netezza engine updated description"), - EngineDisplayName: core.StringPtr("sampleEngine"), - Tags: []string{"tag1", "tag2"}, - } - netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - updateNetezzaEngineOptions := &watsonxdatav2.UpdateNetezzaEngineOptions{ - EngineID: core.StringPtr("testString"), - Body: netezzaEnginePatchModelAsPatch, + It(`PausePrestoEngine(pausePrestoEngineOptions *PausePrestoEngineOptions)`, func() { + pausePrestoEngineOptions := &watsonxdatav3.PausePrestoEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - netezzaEngine, response, err := watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptions) + prestoEngineSuccessResponse, response, err := watsonxDataService.PausePrestoEngine(pausePrestoEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(netezzaEngine).ToNot(BeNil()) + Expect(prestoEngineSuccessResponse).ToNot(BeNil()) }) }) - Describe(`CreateExecuteQuery - Execute a query`, func() { + Describe(`RunExplainStatement - Explain presto query`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateExecuteQuery(createExecuteQueryOptions *CreateExecuteQueryOptions)`, func() { - createExecuteQueryOptions := &watsonxdatav2.CreateExecuteQueryOptions{ - EngineID: core.StringPtr("testString"), - SqlString: core.StringPtr("select expenses from expenditure"), - CatalogName: core.StringPtr("sampleCatalog"), - SchemaName: core.StringPtr("SampleSchema1"), + It(`RunExplainStatement(runExplainStatementOptions *RunExplainStatementOptions)`, func() { + runExplainStatementOptions := &watsonxdatav3.RunExplainStatementOptions{ + ID: core.StringPtr("testString"), + Statement: core.StringPtr("show schemas in catalog_name"), + Catalog: core.StringPtr("catalog_name"), + Format: core.StringPtr("json"), + Schema: core.StringPtr("schema_name"), + Type: core.StringPtr("io"), AuthInstanceID: core.StringPtr("testString"), } - executeQueryCreatedBody, response, err := watsonxDataService.CreateExecuteQuery(createExecuteQueryOptions) + prestoQueryExplain, response, err := watsonxDataService.RunExplainStatement(runExplainStatementOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(executeQueryCreatedBody).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(prestoQueryExplain).ToNot(BeNil()) }) }) - Describe(`ListInstanceDetails - Get all instance details`, func() { + Describe(`RunExplainAnalyzeStatement - Explain presto analyze`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListInstanceDetails(listInstanceDetailsOptions *ListInstanceDetailsOptions)`, func() { - listInstanceDetailsOptions := &watsonxdatav2.ListInstanceDetailsOptions{ + It(`RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptions *RunExplainAnalyzeStatementOptions)`, func() { + runExplainAnalyzeStatementOptions := &watsonxdatav3.RunExplainAnalyzeStatementOptions{ + ID: core.StringPtr("testString"), + Statement: core.StringPtr("show schemas in catalog_name"), + Verbose: core.BoolPtr(true), AuthInstanceID: core.StringPtr("testString"), } - watsonxInstanceDetailsCollection, response, err := watsonxDataService.ListInstanceDetails(listInstanceDetailsOptions) + prestoQueryExplain, response, err := watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(watsonxInstanceDetailsCollection).ToNot(BeNil()) + Expect(prestoQueryExplain).ToNot(BeNil()) }) }) - Describe(`ListInstanceServiceDetails - Get engines and services detail`, func() { + Describe(`RestartPrestoEngine - Restart a presto engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListInstanceServiceDetails(listInstanceServiceDetailsOptions *ListInstanceServiceDetailsOptions)`, func() { - listInstanceServiceDetailsOptions := &watsonxdatav2.ListInstanceServiceDetailsOptions{ - Target: core.StringPtr("testString"), - InternalHost: core.BoolPtr(false), + It(`RestartPrestoEngine(restartPrestoEngineOptions *RestartPrestoEngineOptions)`, func() { + restartPrestoEngineOptions := &watsonxdatav3.RestartPrestoEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - enginesServicesDetails, response, err := watsonxDataService.ListInstanceServiceDetails(listInstanceServiceDetailsOptions) + prestoEngineSuccessResponse, response, err := watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(enginesServicesDetails).ToNot(BeNil()) + Expect(prestoEngineSuccessResponse).ToNot(BeNil()) }) }) - Describe(`GetServicesDetails - Get services details`, func() { + Describe(`ResumePrestoEngine - Resume Presto(Java) engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetServicesDetails(getServicesDetailsOptions *GetServicesDetailsOptions)`, func() { - getServicesDetailsOptions := &watsonxdatav2.GetServicesDetailsOptions{ - Target: core.StringPtr("testString"), - EngineOrServiceType: core.StringPtr("testString"), - InternalHost: core.BoolPtr(false), + It(`ResumePrestoEngine(resumePrestoEngineOptions *ResumePrestoEngineOptions)`, func() { + resumePrestoEngineOptions := &watsonxdatav3.ResumePrestoEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - servicesDetails, response, err := watsonxDataService.GetServicesDetails(getServicesDetailsOptions) + prestoEngineSuccessResponse, response, err := watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(servicesDetails).ToNot(BeNil()) + Expect(prestoEngineSuccessResponse).ToNot(BeNil()) }) }) - Describe(`GetServiceDetail - Get Milvus service detail`, func() { + Describe(`ScalePrestoEngine - Scale a presto engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetServiceDetail(getServiceDetailOptions *GetServiceDetailOptions)`, func() { - getServiceDetailOptions := &watsonxdatav2.GetServiceDetailOptions{ - Target: core.StringPtr("testString"), - EngineOrServiceType: core.StringPtr("testString"), + It(`ScalePrestoEngine(scalePrestoEngineOptions *ScalePrestoEngineOptions)`, func() { + nodeDescriptionModel := &watsonxdatav3.NodeDescription{ + NodeType: core.StringPtr("worker"), + Quantity: core.Int64Ptr(int64(1)), + } + + scalePrestoEngineOptions := &watsonxdatav3.ScalePrestoEngineOptions{ ID: core.StringPtr("testString"), - Database: core.StringPtr("testString"), - InternalHost: core.BoolPtr(false), + Coordinator: nodeDescriptionModel, + Worker: nodeDescriptionModel, AuthInstanceID: core.StringPtr("testString"), } - connectionPropertiesDetails, response, err := watsonxDataService.GetServiceDetail(getServiceDetailOptions) + prestoEngineSuccessResponse, response, err := watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(connectionPropertiesDetails).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + Expect(prestoEngineSuccessResponse).ToNot(BeNil()) }) }) @@ -910,7 +1007,7 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`ListPrestissimoEngines(listPrestissimoEnginesOptions *ListPrestissimoEnginesOptions)`, func() { - listPrestissimoEnginesOptions := &watsonxdatav2.ListPrestissimoEnginesOptions{ + listPrestissimoEnginesOptions := &watsonxdatav3.ListPrestissimoEnginesOptions{ AuthInstanceID: core.StringPtr("testString"), } @@ -926,42 +1023,25 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`CreatePrestissimoEngine(createPrestissimoEngineOptions *CreatePrestissimoEngineOptions)`, func() { - prestissimoNodeDescriptionBodyModel := &watsonxdatav2.PrestissimoNodeDescriptionBody{ + nodeDescriptionModel := &watsonxdatav3.NodeDescription{ NodeType: core.StringPtr("worker"), - Quantity: core.Int64Ptr(int64(38)), - } - - prestissimoEndpointsModel := &watsonxdatav2.PrestissimoEndpoints{ - ApplicationsApi: core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/"), - HistoryServerEndpoint: core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server"), - SparkAccessEndpoint: core.StringPtr("$HOST/analytics-engine/details/spark-"), - SparkJobsV4Endpoint: core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications"), - SparkKernelEndpoint: core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels"), - ViewHistoryServer: core.StringPtr("testString"), - WxdApplicationEndpoint: core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications"), + Quantity: core.Int64Ptr(int64(1)), } - prestissimoEngineDetailsModel := &watsonxdatav2.PrestissimoEngineDetails{ - ApiKey: core.StringPtr(""), - ConnectionString: core.StringPtr("1.2.3.4"), - Coordinator: prestissimoNodeDescriptionBodyModel, - Endpoints: prestissimoEndpointsModel, - InstanceID: core.StringPtr("instance_id"), - ManagedBy: core.StringPtr("fully/self"), - MetastoreHost: core.StringPtr("1.2.3.4"), + prestissimoEngineDetailsModel := &watsonxdatav3.PrestissimoEngineDetails{ + Coordinator: nodeDescriptionModel, SizeConfig: core.StringPtr("starter"), - Worker: prestissimoNodeDescriptionBodyModel, + Worker: nodeDescriptionModel, } - createPrestissimoEngineOptions := &watsonxdatav2.CreatePrestissimoEngineOptions{ + createPrestissimoEngineOptions := &watsonxdatav3.CreatePrestissimoEngineOptions{ + Configuration: prestissimoEngineDetailsModel, + DisplayName: core.StringPtr("sampleEngine"), Origin: core.StringPtr("native"), AssociatedCatalogs: []string{"hive_data"}, Description: core.StringPtr("prestissimo engine description"), - EngineDetails: prestissimoEngineDetailsModel, - EngineDisplayName: core.StringPtr("sampleEngine"), - Region: core.StringPtr("us-south"), + ID: core.StringPtr("prestissimo123"), Tags: []string{"tag1", "tag2"}, - Version: core.StringPtr("1.2.3"), AuthInstanceID: core.StringPtr("testString"), } @@ -972,13 +1052,31 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { }) }) + Describe(`GetPrestissimoEngineCatalog - Get prestissimo engine catalog`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptions *GetPrestissimoEngineCatalogOptions)`, func() { + getPrestissimoEngineCatalogOptions := &watsonxdatav3.GetPrestissimoEngineCatalogOptions{ + EngineID: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + AuthInstanceID: core.StringPtr("testString"), + } + + catalog, response, err := watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(catalog).ToNot(BeNil()) + }) + }) + Describe(`GetPrestissimoEngine - Get prestissimo engine`, func() { BeforeEach(func() { shouldSkipTest() }) It(`GetPrestissimoEngine(getPrestissimoEngineOptions *GetPrestissimoEngineOptions)`, func() { - getPrestissimoEngineOptions := &watsonxdatav2.GetPrestissimoEngineOptions{ - EngineID: core.StringPtr("testString"), + getPrestissimoEngineOptions := &watsonxdatav3.GetPrestissimoEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } @@ -994,73 +1092,79 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`UpdatePrestissimoEngine(updatePrestissimoEngineOptions *UpdatePrestissimoEngineOptions)`, func() { - enginePropertiesCatalogModel := &watsonxdatav2.EnginePropertiesCatalog{ - Coordinator: map[string]string{"key1": "testString"}, - Worker: map[string]string{"key1": "testString"}, - } - - prestissimoPropertiesCatalogModel := &watsonxdatav2.PrestissimoPropertiesCatalog{ - CatalogName: enginePropertiesCatalogModel, + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel := &watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties{ + Coordinator: map[string]interface{}{"anyKey": "anyValue"}, + Worker: map[string]interface{}{"anyKey": "anyValue"}, } - prestissimoNodeDescriptionBodyModel := &watsonxdatav2.PrestissimoNodeDescriptionBody{ - NodeType: core.StringPtr("worker"), - Quantity: core.Int64Ptr(int64(38)), - } - - enginePropertiesOaiGenConfigurationModel := &watsonxdatav2.EnginePropertiesOaiGenConfiguration{ - Coordinator: prestissimoNodeDescriptionBodyModel, - Worker: prestissimoNodeDescriptionBodyModel, + prestissimoEnginePropertiesConfigurationModel := &watsonxdatav3.PrestissimoEnginePropertiesConfiguration{ + Coordinator: map[string]string{"key1": "testString"}, + Worker: map[string]string{"key1": "testString"}, } - prestissimoEnginePropertiesVeloxModel := &watsonxdatav2.PrestissimoEnginePropertiesVelox{ - VeloxProperty: []string{"testString"}, + prestissimoEnginePropertiesJvmModel := &watsonxdatav3.PrestissimoEnginePropertiesJvm{ + Coordinator: map[string]string{"key1": "testString"}, } - prestissimoEnginePropertiesOaiGen1JvmModel := &watsonxdatav2.PrestissimoEnginePropertiesOaiGen1Jvm{ + prestissimoEnginePropertiesLogConfigModel := &watsonxdatav3.PrestissimoEnginePropertiesLogConfig{ Coordinator: map[string]string{"key1": "testString"}, + Worker: map[string]string{"key1": "testString"}, } - prestissimoEngineEnginePropertiesModel := &watsonxdatav2.PrestissimoEngineEngineProperties{ - Catalog: prestissimoPropertiesCatalogModel, - Configuration: enginePropertiesOaiGenConfigurationModel, - Velox: prestissimoEnginePropertiesVeloxModel, - Jvm: prestissimoEnginePropertiesOaiGen1JvmModel, + prestissimoEnginePropertiesModel := &watsonxdatav3.PrestissimoEngineProperties{ + Catalog: map[string]watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel}, + Configuration: prestissimoEnginePropertiesConfigurationModel, + Global: map[string]string{"key1": "testString"}, + Jvm: prestissimoEnginePropertiesJvmModel, + LogConfig: prestissimoEnginePropertiesLogConfigModel, + OptimizerProperties: map[string]string{"key1": "testString"}, + Velox: map[string]string{"key1": "testString"}, } + prestissimoEnginePropertiesModel.Catalog["foo"] = *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel - prestissimoEnginePropertiesCatalogModel := &watsonxdatav2.PrestissimoEnginePropertiesCatalog{ - CatalogName: []string{"testString"}, + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel := &watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties{ + Coordinator: []string{"testString"}, + Worker: []string{"testString"}, } - removeEnginePropertiesConfigurationModel := &watsonxdatav2.RemoveEnginePropertiesConfiguration{ + removePrestissimoEnginePropertiesConfigurationModel := &watsonxdatav3.RemovePrestissimoEnginePropertiesConfiguration{ Coordinator: []string{"testString"}, Worker: []string{"testString"}, } - removeEnginePropertiesPrestissimoOaiGenJvmModel := &watsonxdatav2.RemoveEnginePropertiesPrestissimoOaiGenJvm{ + removePrestissimoEnginePropertiesJvmModel := &watsonxdatav3.RemovePrestissimoEnginePropertiesJvm{ Coordinator: []string{"testString"}, } - removeEnginePropertiesModel := &watsonxdatav2.RemoveEngineProperties{ - Catalog: prestissimoEnginePropertiesCatalogModel, - Configuration: removeEnginePropertiesConfigurationModel, - Jvm: removeEnginePropertiesPrestissimoOaiGenJvmModel, + removePrestissimoEnginePropertiesLogConfigModel := &watsonxdatav3.RemovePrestissimoEnginePropertiesLogConfig{ + Coordinator: []string{"testString"}, + Worker: []string{"testString"}, + } + + removePrestissimoEnginePropertiesModel := &watsonxdatav3.RemovePrestissimoEngineProperties{ + Catalog: map[string]watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel}, + Configuration: removePrestissimoEnginePropertiesConfigurationModel, + Global: []string{"testString"}, + Jvm: removePrestissimoEnginePropertiesJvmModel, + LogConfig: removePrestissimoEnginePropertiesLogConfigModel, + OptimizerProperties: []string{"testString"}, Velox: []string{"testString"}, } + removePrestissimoEnginePropertiesModel.Catalog["foo"] = *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel - prestissimoEnginePatchModel := &watsonxdatav2.PrestissimoEnginePatch{ + prestissimoEnginePatchModel := &watsonxdatav3.PrestissimoEnginePatch{ Description: core.StringPtr("updated description for prestissimo engine"), - EngineDisplayName: core.StringPtr("sampleEngine"), - EngineProperties: prestissimoEngineEnginePropertiesModel, - EngineRestart: core.StringPtr("force"), - RemoveEngineProperties: removeEnginePropertiesModel, + DisplayName: core.StringPtr("sampleEngine"), + Properties: prestissimoEnginePropertiesModel, + RemoveEngineProperties: removePrestissimoEnginePropertiesModel, + RestartType: core.StringPtr("force"), Tags: []string{"tag1", "tag2"}, } prestissimoEnginePatchModelAsPatch, asPatchErr := prestissimoEnginePatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - updatePrestissimoEngineOptions := &watsonxdatav2.UpdatePrestissimoEngineOptions{ - EngineID: core.StringPtr("testString"), + updatePrestissimoEngineOptions := &watsonxdatav3.UpdatePrestissimoEngineOptions{ + ID: core.StringPtr("testString"), Body: prestissimoEnginePatchModelAsPatch, AuthInstanceID: core.StringPtr("testString"), } @@ -1077,8 +1181,8 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptions *ListPrestissimoEngineCatalogsOptions)`, func() { - listPrestissimoEngineCatalogsOptions := &watsonxdatav2.ListPrestissimoEngineCatalogsOptions{ - EngineID: core.StringPtr("testString"), + listPrestissimoEngineCatalogsOptions := &watsonxdatav3.ListPrestissimoEngineCatalogsOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } @@ -1094,34 +1198,16 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptions *CreatePrestissimoEngineCatalogsOptions)`, func() { - createPrestissimoEngineCatalogsOptions := &watsonxdatav2.CreatePrestissimoEngineCatalogsOptions{ - EngineID: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), + createPrestissimoEngineCatalogsOptions := &watsonxdatav3.CreatePrestissimoEngineCatalogsOptions{ + ID: core.StringPtr("testString"), + CatalogNames: []string{"iceberg_catalog"}, AuthInstanceID: core.StringPtr("testString"), } - catalog, response, err := watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptions) + catalogCollection, response, err := watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) - Expect(catalog).ToNot(BeNil()) - }) - }) - - Describe(`GetPrestissimoEngineCatalog - Get prestissimo engine catalog`, func() { - BeforeEach(func() { - shouldSkipTest() - }) - It(`GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptions *GetPrestissimoEngineCatalogOptions)`, func() { - getPrestissimoEngineCatalogOptions := &watsonxdatav2.GetPrestissimoEngineCatalogOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - AuthInstanceID: core.StringPtr("testString"), - } - - catalog, response, err := watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptions) - Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(catalog).ToNot(BeNil()) + Expect(catalogCollection).ToNot(BeNil()) }) }) @@ -1130,8 +1216,8 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`PausePrestissimoEngine(pausePrestissimoEngineOptions *PausePrestissimoEngineOptions)`, func() { - pausePrestissimoEngineOptions := &watsonxdatav2.PausePrestissimoEngineOptions{ - EngineID: core.StringPtr("testString"), + pausePrestissimoEngineOptions := &watsonxdatav3.PausePrestissimoEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } @@ -1147,10 +1233,12 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptions *RunPrestissimoExplainStatementOptions)`, func() { - runPrestissimoExplainStatementOptions := &watsonxdatav2.RunPrestissimoExplainStatementOptions{ - EngineID: core.StringPtr("testString"), + runPrestissimoExplainStatementOptions := &watsonxdatav3.RunPrestissimoExplainStatementOptions{ + ID: core.StringPtr("testString"), Statement: core.StringPtr("show schemas in catalog_name"), + Catalog: core.StringPtr("catalog_name"), Format: core.StringPtr("json"), + Schema: core.StringPtr("schema_name"), Type: core.StringPtr("io"), AuthInstanceID: core.StringPtr("testString"), } @@ -1167,8 +1255,8 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptions *RunPrestissimoExplainAnalyzeStatementOptions)`, func() { - runPrestissimoExplainAnalyzeStatementOptions := &watsonxdatav2.RunPrestissimoExplainAnalyzeStatementOptions{ - EngineID: core.StringPtr("testString"), + runPrestissimoExplainAnalyzeStatementOptions := &watsonxdatav3.RunPrestissimoExplainAnalyzeStatementOptions{ + ID: core.StringPtr("testString"), Statement: core.StringPtr("show schemas in catalog_name"), Verbose: core.BoolPtr(true), AuthInstanceID: core.StringPtr("testString"), @@ -1186,8 +1274,8 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`RestartPrestissimoEngine(restartPrestissimoEngineOptions *RestartPrestissimoEngineOptions)`, func() { - restartPrestissimoEngineOptions := &watsonxdatav2.RestartPrestissimoEngineOptions{ - EngineID: core.StringPtr("testString"), + restartPrestissimoEngineOptions := &watsonxdatav3.RestartPrestissimoEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } @@ -1203,8 +1291,8 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`ResumePrestissimoEngine(resumePrestissimoEngineOptions *ResumePrestissimoEngineOptions)`, func() { - resumePrestissimoEngineOptions := &watsonxdatav2.ResumePrestissimoEngineOptions{ - EngineID: core.StringPtr("testString"), + resumePrestissimoEngineOptions := &watsonxdatav3.ResumePrestissimoEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } @@ -1220,15 +1308,15 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`ScalePrestissimoEngine(scalePrestissimoEngineOptions *ScalePrestissimoEngineOptions)`, func() { - prestissimoNodeDescriptionBodyModel := &watsonxdatav2.PrestissimoNodeDescriptionBody{ + nodeDescriptionModel := &watsonxdatav3.NodeDescription{ NodeType: core.StringPtr("worker"), - Quantity: core.Int64Ptr(int64(38)), + Quantity: core.Int64Ptr(int64(1)), } - scalePrestissimoEngineOptions := &watsonxdatav2.ScalePrestissimoEngineOptions{ - EngineID: core.StringPtr("testString"), - Coordinator: prestissimoNodeDescriptionBodyModel, - Worker: prestissimoNodeDescriptionBodyModel, + scalePrestissimoEngineOptions := &watsonxdatav3.ScalePrestissimoEngineOptions{ + ID: core.StringPtr("testString"), + Coordinator: nodeDescriptionModel, + Worker: nodeDescriptionModel, AuthInstanceID: core.StringPtr("testString"), } @@ -1239,1593 +1327,1872 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { }) }) - Describe(`ListPrestoEngines - Get list of presto engines`, func() { + Describe(`ListDb2Engines - Get list of db2 engines`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListPrestoEngines(listPrestoEnginesOptions *ListPrestoEnginesOptions)`, func() { - listPrestoEnginesOptions := &watsonxdatav2.ListPrestoEnginesOptions{ + It(`ListDb2Engines(listDb2EnginesOptions *ListDb2EnginesOptions)`, func() { + listDb2EnginesOptions := &watsonxdatav3.ListDb2EnginesOptions{ AuthInstanceID: core.StringPtr("testString"), } - prestoEngineCollection, response, err := watsonxDataService.ListPrestoEngines(listPrestoEnginesOptions) + db2EngineCollection, response, err := watsonxDataService.ListDb2Engines(listDb2EnginesOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(prestoEngineCollection).ToNot(BeNil()) + Expect(db2EngineCollection).ToNot(BeNil()) }) }) - Describe(`CreatePrestoEngine - Create presto engine`, func() { + Describe(`CreateDb2Engine - Create db2 engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreatePrestoEngine(createPrestoEngineOptions *CreatePrestoEngineOptions)`, func() { - nodeDescriptionBodyModel := &watsonxdatav2.NodeDescriptionBody{ - NodeType: core.StringPtr("worker"), - Quantity: core.Int64Ptr(int64(38)), - } - - engineDetailsBodyModel := &watsonxdatav2.EngineDetailsBody{ - ApiKey: core.StringPtr(""), + It(`CreateDb2Engine(createDb2EngineOptions *CreateDb2EngineOptions)`, func() { + db2EngineDetailsBodyModel := &watsonxdatav3.Db2EngineDetailsBody{ ConnectionString: core.StringPtr("1.2.3.4"), - Coordinator: nodeDescriptionBodyModel, - InstanceID: core.StringPtr("instance_id"), - ManagedBy: core.StringPtr("fully/self"), - SizeConfig: core.StringPtr("starter"), - Worker: nodeDescriptionBodyModel, } - createPrestoEngineOptions := &watsonxdatav2.CreatePrestoEngineOptions{ - Origin: core.StringPtr("native"), - AssociatedCatalogs: []string{"iceberg-data", "hive-data"}, - Description: core.StringPtr("presto engine for running sql queries"), - EngineDetails: engineDetailsBodyModel, - EngineDisplayName: core.StringPtr("sampleEngine"), - Region: core.StringPtr("us-south"), + createDb2EngineOptions := &watsonxdatav3.CreateDb2EngineOptions{ + Configuration: db2EngineDetailsBodyModel, + DisplayName: core.StringPtr("sampleEngine"), + Origin: core.StringPtr("external"), + Description: core.StringPtr("db2 engine description"), Tags: []string{"tag1", "tag2"}, - Version: core.StringPtr("1.2.3"), AuthInstanceID: core.StringPtr("testString"), } - prestoEngine, response, err := watsonxDataService.CreatePrestoEngine(createPrestoEngineOptions) + db2Engine, response, err := watsonxDataService.CreateDb2Engine(createDb2EngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) - Expect(prestoEngine).ToNot(BeNil()) + Expect(db2Engine).ToNot(BeNil()) }) }) - Describe(`GetPrestoEngine - Get presto engine`, func() { + Describe(`UpdateDb2Engine - Update db2 engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetPrestoEngine(getPrestoEngineOptions *GetPrestoEngineOptions)`, func() { - getPrestoEngineOptions := &watsonxdatav2.GetPrestoEngineOptions{ - EngineID: core.StringPtr("testString"), + It(`UpdateDb2Engine(updateDb2EngineOptions *UpdateDb2EngineOptions)`, func() { + db2EnginePatchModel := &watsonxdatav3.Db2EnginePatch{ + Description: core.StringPtr("db2 engine updated description"), + DisplayName: core.StringPtr("sampleEngine"), + Tags: []string{"tag1", "tag2"}, + } + db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateDb2EngineOptions := &watsonxdatav3.UpdateDb2EngineOptions{ + ID: core.StringPtr("testString"), + Body: db2EnginePatchModelAsPatch, AuthInstanceID: core.StringPtr("testString"), } - prestoEngine, response, err := watsonxDataService.GetPrestoEngine(getPrestoEngineOptions) + db2Engine, response, err := watsonxDataService.UpdateDb2Engine(updateDb2EngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(prestoEngine).ToNot(BeNil()) + Expect(db2Engine).ToNot(BeNil()) }) }) - Describe(`UpdatePrestoEngine - Update presto engine`, func() { + Describe(`ListOtherEngines - Get list of other engines`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`UpdatePrestoEngine(updatePrestoEngineOptions *UpdatePrestoEngineOptions)`, func() { - enginePropertiesCatalogModel := &watsonxdatav2.EnginePropertiesCatalog{ - Coordinator: map[string]string{"key1": "testString"}, - Worker: map[string]string{"key1": "testString"}, - } - - prestoEnginePropertiesCatalogModel := &watsonxdatav2.PrestoEnginePropertiesCatalog{ - CatalogName: enginePropertiesCatalogModel, + It(`ListOtherEngines(listOtherEnginesOptions *ListOtherEnginesOptions)`, func() { + listOtherEnginesOptions := &watsonxdatav3.ListOtherEnginesOptions{ + AuthInstanceID: core.StringPtr("testString"), } - enginePropertiesOaiGen1ConfigurationModel := &watsonxdatav2.EnginePropertiesOaiGen1Configuration{ - Coordinator: map[string]string{"key1": "testString"}, - Worker: map[string]string{"key1": "testString"}, - } + otherEngineCollection, response, err := watsonxDataService.ListOtherEngines(listOtherEnginesOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(otherEngineCollection).ToNot(BeNil()) + }) + }) - prestoEnginePropertiesEventListenerModel := &watsonxdatav2.PrestoEnginePropertiesEventListener{ - EventListenerProperty: core.StringPtr("testString"), + Describe(`CreateOtherEngine - Create other engine`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CreateOtherEngine(createOtherEngineOptions *CreateOtherEngineOptions)`, func() { + otherEngineConfigurationBodyModel := &watsonxdatav3.OtherEngineConfigurationBody{ + ConnectionString: core.StringPtr("1.2.3.4"), + Type: core.StringPtr("netezza"), } - prestoEnginePropertiesGlobalModel := &watsonxdatav2.PrestoEnginePropertiesGlobal{ - GlobalProperty: core.StringPtr("enable-mixed-case-support:true"), + createOtherEngineOptions := &watsonxdatav3.CreateOtherEngineOptions{ + Configuration: otherEngineConfigurationBodyModel, + DisplayName: core.StringPtr("sampleEngine01"), + Origin: core.StringPtr("external"), + Description: core.StringPtr("external engine description"), + Tags: []string{"tag1", "tag2"}, + AuthInstanceID: core.StringPtr("testString"), } - enginePropertiesOaiGen1JvmModel := &watsonxdatav2.EnginePropertiesOaiGen1Jvm{ - Coordinator: map[string]string{"key1": "testString"}, - Worker: map[string]string{"key1": "testString"}, + otherEngine, response, err := watsonxDataService.CreateOtherEngine(createOtherEngineOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(otherEngine).ToNot(BeNil()) + }) + }) + + Describe(`ListNetezzaEngines - Get list of Netezza engines`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ListNetezzaEngines(listNetezzaEnginesOptions *ListNetezzaEnginesOptions)`, func() { + listNetezzaEnginesOptions := &watsonxdatav3.ListNetezzaEnginesOptions{ + AuthInstanceID: core.StringPtr("testString"), } - prestoEnginePropertiesJmxModel := &watsonxdatav2.PrestoEnginePropertiesJMX{ - GlobalProperty: core.StringPtr("watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes"), + netezzaEngineCollection, response, err := watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(netezzaEngineCollection).ToNot(BeNil()) + }) + }) + + Describe(`CreateNetezzaEngine - Create netezza engine`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CreateNetezzaEngine(createNetezzaEngineOptions *CreateNetezzaEngineOptions)`, func() { + netezzaEngineConfigurationBodyModel := &watsonxdatav3.NetezzaEngineConfigurationBody{ + ConnectionString: core.StringPtr("1.2.3.4"), } - enginePropertiesLogConfigurationModel := &watsonxdatav2.EnginePropertiesLogConfiguration{ - Coordinator: map[string]string{"key1": "testString"}, - Worker: map[string]string{"key1": "testString"}, + createNetezzaEngineOptions := &watsonxdatav3.CreateNetezzaEngineOptions{ + Configuration: netezzaEngineConfigurationBodyModel, + DisplayName: core.StringPtr("sampleEngine"), + Origin: core.StringPtr("external"), + Description: core.StringPtr("netezza engine description"), + Tags: []string{"tag1", "tag2"}, + AuthInstanceID: core.StringPtr("testString"), } - prestoEngineEnginePropertiesModel := &watsonxdatav2.PrestoEngineEngineProperties{ - Catalog: prestoEnginePropertiesCatalogModel, - Configuration: enginePropertiesOaiGen1ConfigurationModel, - EventListener: prestoEnginePropertiesEventListenerModel, - Global: prestoEnginePropertiesGlobalModel, - Jvm: enginePropertiesOaiGen1JvmModel, - JmxExporterConfig: prestoEnginePropertiesJmxModel, - LogConfig: enginePropertiesLogConfigurationModel, + netezzaEngine, response, err := watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(netezzaEngine).ToNot(BeNil()) + }) + }) + + Describe(`UpdateNetezzaEngine - Update netezza engine`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`UpdateNetezzaEngine(updateNetezzaEngineOptions *UpdateNetezzaEngineOptions)`, func() { + netezzaEnginePatchModel := &watsonxdatav3.NetezzaEnginePatch{ + Description: core.StringPtr("netezza engine updated description"), + DisplayName: core.StringPtr("sampleEngine"), + Tags: []string{"tag1", "tag2"}, } + netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - removeEnginePropertiesOaiGenConfigurationModel := &watsonxdatav2.RemoveEnginePropertiesOaiGenConfiguration{ - Coordinator: []string{"testString"}, - Worker: []string{"testString"}, + updateNetezzaEngineOptions := &watsonxdatav3.UpdateNetezzaEngineOptions{ + ID: core.StringPtr("testString"), + Body: netezzaEnginePatchModelAsPatch, + AuthInstanceID: core.StringPtr("testString"), } - removeEnginePropertiesOaiGenJvmModel := &watsonxdatav2.RemoveEnginePropertiesOaiGenJvm{ - Coordinator: []string{"testString"}, - Worker: []string{"testString"}, + netezzaEngine, response, err := watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(netezzaEngine).ToNot(BeNil()) + }) + }) + + Describe(`ListSparkEngines - Get list of spark engines`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`ListSparkEngines(listSparkEnginesOptions *ListSparkEnginesOptions)`, func() { + listSparkEnginesOptions := &watsonxdatav3.ListSparkEnginesOptions{ + AuthInstanceID: core.StringPtr("testString"), } - removeEnginePropertiesLogConfigModel := &watsonxdatav2.RemoveEnginePropertiesLogConfig{ - Coordinator: []string{"testString"}, - Worker: []string{"testString"}, + sparkEngineCollection, response, err := watsonxDataService.ListSparkEngines(listSparkEnginesOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(sparkEngineCollection).ToNot(BeNil()) + }) + }) + + Describe(`CreateSparkEngine - Create spark engine`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CreateSparkEngine(createSparkEngineOptions *CreateSparkEngineOptions)`, func() { + sparkEndpointsModel := &watsonxdatav3.SparkEndpoints{ + ApplicationsApi: core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id"), + HistoryServerEndpoint: core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server"), + SparkAccessEndpoint: core.StringPtr("$HOST/analytics-engine/details/spark-instance_id"), + SparkJobsV4Endpoint: core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications"), + SparkKernelEndpoint: core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels"), + ViewHistoryServer: core.StringPtr("testString"), + WxdApplicationEndpoint: core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications"), + WxdEngineEndpoint: core.StringPtr("$HOST/v1/1698311655308796/engines/spark817"), + WxdHistoryServerEndpoint: core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server"), + WxdHistoryServerUiEndpoint: core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server/ui"), } - prestoEnginePatchRemoveEnginePropertiesModel := &watsonxdatav2.PrestoEnginePatchRemoveEngineProperties{ - Catalog: prestoEnginePropertiesCatalogModel, - Configuration: removeEnginePropertiesOaiGenConfigurationModel, - Jvm: removeEnginePropertiesOaiGenJvmModel, - EventListener: []string{"testString"}, - Global: []string{"testString"}, - JmxExporterConfig: []string{"testString"}, - LogConfig: removeEnginePropertiesLogConfigModel, + sparkEngineHomeModel := &watsonxdatav3.SparkEngineHome{ + Path: core.StringPtr("spark/spark1234"), + StorageName: core.StringPtr("test-spark-storage"), + Volume: core.StringPtr("test-spark-volume"), + VolumeID: core.StringPtr("1704979825978585"), + VolumeName: core.StringPtr("my-volume"), } - prestoEnginePatchModel := &watsonxdatav2.PrestoEnginePatch{ - Description: core.StringPtr("updated description for presto engine"), - EngineDisplayName: core.StringPtr("sampleEngine"), - EngineProperties: prestoEngineEnginePropertiesModel, - EngineRestart: core.StringPtr("force"), - RemoveEngineProperties: prestoEnginePatchRemoveEnginePropertiesModel, + sparkEngineResourceLimitModel := &watsonxdatav3.SparkEngineResourceLimit{ + Cores: core.StringPtr("1"), + Memory: core.StringPtr("4G"), + } + + sparkEngineResourceUtilisationModel := &watsonxdatav3.SparkEngineResourceUtilisation{ + Cores: core.StringPtr("1m"), + Memory: core.StringPtr("4Gi"), + } + + sparkScaleConfigModel := &watsonxdatav3.SparkScaleConfig{ + AutoScaleEnabled: core.BoolPtr(true), + CurrentNumberOfNodes: core.Int64Ptr(int64(2)), + MaximumNumberOfNodes: core.Int64Ptr(int64(5)), + MinimumNumberOfNodes: core.Int64Ptr(int64(1)), + NodeType: core.StringPtr("medium"), + NumberOfNodes: core.Int64Ptr(int64(2)), + } + + sparkVscodeConfigModel := &watsonxdatav3.SparkVscodeConfig{ + Crn: core.StringPtr("crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2"), + EnvironmentType: core.StringPtr("SaaS"), + Host: core.StringPtr("us-south.lakehouse.dev.cloud.ibm.com"), + UserName: core.StringPtr("user@example.com"), + } + + sparkEngineDetailsModel := &watsonxdatav3.SparkEngineDetails{ + ApiKey: core.StringPtr("apikey"), + ConnectionString: core.StringPtr("https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id"), + DefaultConfig: map[string]string{"key1": "configuration"}, + DefaultVersion: core.StringPtr("4.8.3"), + Endpoints: sparkEndpointsModel, + EngineHome: sparkEngineHomeModel, + EngineSubType: core.StringPtr("java"), + InstanceID: core.StringPtr("spark-id"), + ManagedBy: core.StringPtr("fully"), + ResourceLimitEnabled: core.BoolPtr(true), + ResourceLimits: sparkEngineResourceLimitModel, + ResourceUtilisation: sparkEngineResourceUtilisationModel, + ScaleConfig: sparkScaleConfigModel, + VscodeConfig: sparkVscodeConfigModel, + } + + createSparkEngineOptions := &watsonxdatav3.CreateSparkEngineOptions{ + DisplayName: core.StringPtr("sampleEngine"), + Origin: core.StringPtr("external"), + AssociatedCatalogs: []string{"iceberg_data", "hive_data"}, + Configuration: sparkEngineDetailsModel, + Description: core.StringPtr("spark engine description"), + ID: core.StringPtr("spark123"), + Status: core.StringPtr("provisioning"), Tags: []string{"tag1", "tag2"}, + Type: core.StringPtr("spark"), + AuthInstanceID: core.StringPtr("testString"), } - prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - updatePrestoEngineOptions := &watsonxdatav2.UpdatePrestoEngineOptions{ + sparkEngine, response, err := watsonxDataService.CreateSparkEngine(createSparkEngineOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + Expect(sparkEngine).ToNot(BeNil()) + }) + }) + + Describe(`GetSparkEngineCatalog - Get spark engine catalog`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`GetSparkEngineCatalog(getSparkEngineCatalogOptions *GetSparkEngineCatalogOptions)`, func() { + getSparkEngineCatalogOptions := &watsonxdatav3.GetSparkEngineCatalogOptions{ EngineID: core.StringPtr("testString"), - Body: prestoEnginePatchModelAsPatch, + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - prestoEngine, response, err := watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptions) + catalog, response, err := watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(prestoEngine).ToNot(BeNil()) + Expect(catalog).ToNot(BeNil()) }) }) - Describe(`ListPrestoEngineCatalogs - Get presto engine catalogs`, func() { + Describe(`GetSparkEngine - Get spark engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptions *ListPrestoEngineCatalogsOptions)`, func() { - listPrestoEngineCatalogsOptions := &watsonxdatav2.ListPrestoEngineCatalogsOptions{ - EngineID: core.StringPtr("testString"), + It(`GetSparkEngine(getSparkEngineOptions *GetSparkEngineOptions)`, func() { + getSparkEngineOptions := &watsonxdatav3.GetSparkEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - catalogCollection, response, err := watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptions) + sparkEngine, response, err := watsonxDataService.GetSparkEngine(getSparkEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(catalogCollection).ToNot(BeNil()) + Expect(sparkEngine).ToNot(BeNil()) }) }) - Describe(`CreatePrestoEngineCatalogs - Associate catalogs to presto engine`, func() { + Describe(`UpdateSparkEngine - Update spark engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptions *CreatePrestoEngineCatalogsOptions)`, func() { - createPrestoEngineCatalogsOptions := &watsonxdatav2.CreatePrestoEngineCatalogsOptions{ - EngineID: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), + It(`UpdateSparkEngine(updateSparkEngineOptions *UpdateSparkEngineOptions)`, func() { + sparkEngineHomePatchModel := &watsonxdatav3.SparkEngineHomePatch{ + StorageName: core.StringPtr("test-spark-storage"), + } + + sparkEngineResourceLimitModel := &watsonxdatav3.SparkEngineResourceLimit{ + Cores: core.StringPtr("1"), + Memory: core.StringPtr("4G"), + } + + sparkEnginePatchEngineDetailsModel := &watsonxdatav3.SparkEnginePatchEngineDetails{ + DefaultConfig: map[string]string{"key1": "configuration"}, + DefaultVersion: core.StringPtr("4.8.3"), + EngineHome: sparkEngineHomePatchModel, + ResourceLimitEnabled: core.BoolPtr(true), + ResourceLimits: sparkEngineResourceLimitModel, + } + + sparkEnginePatchModel := &watsonxdatav3.SparkEnginePatch{ + Configuration: sparkEnginePatchEngineDetailsModel, + Description: core.StringPtr("updated description for spark engine"), + DisplayName: core.StringPtr("sampleEngine"), + Tags: []string{"tag1", "tag2"}, + } + sparkEnginePatchModelAsPatch, asPatchErr := sparkEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateSparkEngineOptions := &watsonxdatav3.UpdateSparkEngineOptions{ + ID: core.StringPtr("testString"), + Body: sparkEnginePatchModelAsPatch, AuthInstanceID: core.StringPtr("testString"), } - catalog, response, err := watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptions) + sparkEngine, response, err := watsonxDataService.UpdateSparkEngine(updateSparkEngineOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(catalog).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(sparkEngine).ToNot(BeNil()) }) }) - Describe(`GetPrestoEngineCatalog - Get presto engine catalog`, func() { + Describe(`ListSparkEngineCatalogs - Get spark engine catalogs`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetPrestoEngineCatalog(getPrestoEngineCatalogOptions *GetPrestoEngineCatalogOptions)`, func() { - getPrestoEngineCatalogOptions := &watsonxdatav2.GetPrestoEngineCatalogOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), + It(`ListSparkEngineCatalogs(listSparkEngineCatalogsOptions *ListSparkEngineCatalogsOptions)`, func() { + listSparkEngineCatalogsOptions := &watsonxdatav3.ListSparkEngineCatalogsOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - catalog, response, err := watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptions) + catalogCollection, response, err := watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(catalog).ToNot(BeNil()) + Expect(catalogCollection).ToNot(BeNil()) }) }) - Describe(`PausePrestoEngine - Pause presto engine`, func() { + Describe(`CreateSparkEngineCatalogs - Associate catalogs to spark engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`PausePrestoEngine(pausePrestoEngineOptions *PausePrestoEngineOptions)`, func() { - pausePrestoEngineOptions := &watsonxdatav2.PausePrestoEngineOptions{ - EngineID: core.StringPtr("testString"), + It(`CreateSparkEngineCatalogs(createSparkEngineCatalogsOptions *CreateSparkEngineCatalogsOptions)`, func() { + createSparkEngineCatalogsOptions := &watsonxdatav3.CreateSparkEngineCatalogsOptions{ + ID: core.StringPtr("testString"), + CatalogNames: []string{"iceberg_catalog"}, AuthInstanceID: core.StringPtr("testString"), } - createEnginePauseCreatedBody, response, err := watsonxDataService.PausePrestoEngine(pausePrestoEngineOptions) + catalogCollection, response, err := watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(createEnginePauseCreatedBody).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(catalogCollection).ToNot(BeNil()) }) }) - Describe(`RunExplainStatement - Explain presto query`, func() { + Describe(`PauseSparkEngine - Pause engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`RunExplainStatement(runExplainStatementOptions *RunExplainStatementOptions)`, func() { - runExplainStatementOptions := &watsonxdatav2.RunExplainStatementOptions{ - EngineID: core.StringPtr("testString"), - Statement: core.StringPtr("show schemas in catalog_name"), - Format: core.StringPtr("json"), - Type: core.StringPtr("io"), + It(`PauseSparkEngine(pauseSparkEngineOptions *PauseSparkEngineOptions)`, func() { + pauseSparkEngineOptions := &watsonxdatav3.PauseSparkEngineOptions{ + ID: core.StringPtr("testString"), + Force: core.BoolPtr(true), AuthInstanceID: core.StringPtr("testString"), } - runExplainStatementOkBody, response, err := watsonxDataService.RunExplainStatement(runExplainStatementOptions) + successResponse, response, err := watsonxDataService.PauseSparkEngine(pauseSparkEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(runExplainStatementOkBody).ToNot(BeNil()) + Expect(successResponse).ToNot(BeNil()) }) }) - Describe(`RunExplainAnalyzeStatement - Explain presto analyze`, func() { + Describe(`ResumeSparkEngine - Resume engine. This feature is only available in SAAS`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptions *RunExplainAnalyzeStatementOptions)`, func() { - runExplainAnalyzeStatementOptions := &watsonxdatav2.RunExplainAnalyzeStatementOptions{ - EngineID: core.StringPtr("testString"), - Statement: core.StringPtr("show schemas in catalog_name"), - Verbose: core.BoolPtr(true), + It(`ResumeSparkEngine(resumeSparkEngineOptions *ResumeSparkEngineOptions)`, func() { + resumeSparkEngineOptions := &watsonxdatav3.ResumeSparkEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - runExplainAnalyzeStatementOkBody, response, err := watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptions) + successResponse, response, err := watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(runExplainAnalyzeStatementOkBody).ToNot(BeNil()) + Expect(successResponse).ToNot(BeNil()) }) }) - Describe(`RestartPrestoEngine - Restart a presto engine`, func() { + Describe(`ScaleSparkEngine - Scale engine. This feature is only available in SAAS`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`RestartPrestoEngine(restartPrestoEngineOptions *RestartPrestoEngineOptions)`, func() { - restartPrestoEngineOptions := &watsonxdatav2.RestartPrestoEngineOptions{ - EngineID: core.StringPtr("testString"), + It(`ScaleSparkEngine(scaleSparkEngineOptions *ScaleSparkEngineOptions)`, func() { + scaleSparkEngineOptions := &watsonxdatav3.ScaleSparkEngineOptions{ + ID: core.StringPtr("testString"), + NumberOfNodes: core.Int64Ptr(int64(2)), AuthInstanceID: core.StringPtr("testString"), } - createEngineRestartCreatedBody, response, err := watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptions) + successResponse, response, err := watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(createEngineRestartCreatedBody).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + Expect(successResponse).ToNot(BeNil()) }) }) - Describe(`ResumePrestoEngine - Resume presto engine`, func() { + Describe(`GetSparkEngineApplicationStatus - Get spark engine application details`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ResumePrestoEngine(resumePrestoEngineOptions *ResumePrestoEngineOptions)`, func() { - resumePrestoEngineOptions := &watsonxdatav2.ResumePrestoEngineOptions{ + It(`GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptions *GetSparkEngineApplicationStatusOptions)`, func() { + getSparkEngineApplicationStatusOptions := &watsonxdatav3.GetSparkEngineApplicationStatusOptions{ EngineID: core.StringPtr("testString"), + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - createEngineResumeCreatedBody, response, err := watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptions) + sparkEngineApplicationResponse, response, err := watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(createEngineResumeCreatedBody).ToNot(BeNil()) + Expect(sparkEngineApplicationResponse).ToNot(BeNil()) }) }) - Describe(`ScalePrestoEngine - Scale a presto engine`, func() { + Describe(`GetSparkEngineApplicationUi - Redirect to spark UI`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ScalePrestoEngine(scalePrestoEngineOptions *ScalePrestoEngineOptions)`, func() { - nodeDescriptionModel := &watsonxdatav2.NodeDescription{ - NodeType: core.StringPtr("starter"), - Quantity: core.Int64Ptr(int64(38)), - } - - scalePrestoEngineOptions := &watsonxdatav2.ScalePrestoEngineOptions{ + It(`GetSparkEngineApplicationUi(getSparkEngineApplicationUiOptions *GetSparkEngineApplicationUiOptions)`, func() { + getSparkEngineApplicationUiOptions := &watsonxdatav3.GetSparkEngineApplicationUiOptions{ EngineID: core.StringPtr("testString"), - Coordinator: nodeDescriptionModel, - Worker: nodeDescriptionModel, + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - createEngineScaleCreatedBody, response, err := watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptions) + response, err := watsonxDataService.GetSparkEngineApplicationUi(getSparkEngineApplicationUiOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - Expect(createEngineScaleCreatedBody).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) }) }) - Describe(`GetSalIntegration - Get SAL Integrations`, func() { + Describe(`ListSparkEngineApplications - List all applications in a spark engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSalIntegration(getSalIntegrationOptions *GetSalIntegrationOptions)`, func() { - getSalIntegrationOptions := &watsonxdatav2.GetSalIntegrationOptions{ + It(`ListSparkEngineApplications(listSparkEngineApplicationsOptions *ListSparkEngineApplicationsOptions) with pagination`, func(){ + listSparkEngineApplicationsOptions := &watsonxdatav3.ListSparkEngineApplicationsOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), + State: []string{"testString"}, + SubmissionTimeInterval: core.StringPtr("testString"), + StartTimeInterval: core.StringPtr("testString"), + EndTimeInterval: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + Start: core.StringPtr("testString"), } - salIntegration, response, err := watsonxDataService.GetSalIntegration(getSalIntegrationOptions) + listSparkEngineApplicationsOptions.Start = nil + listSparkEngineApplicationsOptions.Limit = core.Int64Ptr(1) + + var allResults []watsonxdatav3.SparkEngineApplicationSummary + for { + sparkEngineApplicationCollection, response, err := watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(sparkEngineApplicationCollection).ToNot(BeNil()) + allResults = append(allResults, sparkEngineApplicationCollection.Applications...) + + listSparkEngineApplicationsOptions.Start, err = sparkEngineApplicationCollection.GetNextStart() + Expect(err).To(BeNil()) + + if listSparkEngineApplicationsOptions.Start == nil { + break + } + } + fmt.Fprintf(GinkgoWriter, "Retrieved a total of %d item(s) with pagination.\n", len(allResults)) + }) + It(`ListSparkEngineApplications(listSparkEngineApplicationsOptions *ListSparkEngineApplicationsOptions) using SparkEngineApplicationsPager`, func(){ + listSparkEngineApplicationsOptions := &watsonxdatav3.ListSparkEngineApplicationsOptions{ + ID: core.StringPtr("testString"), + AuthInstanceID: core.StringPtr("testString"), + State: []string{"testString"}, + SubmissionTimeInterval: core.StringPtr("testString"), + StartTimeInterval: core.StringPtr("testString"), + EndTimeInterval: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + // Test GetNext(). + pager, err := watsonxDataService.NewSparkEngineApplicationsPager(listSparkEngineApplicationsOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegration).ToNot(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []watsonxdatav3.SparkEngineApplicationSummary + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + + // Test GetAll(). + pager, err = watsonxDataService.NewSparkEngineApplicationsPager(listSparkEngineApplicationsOptions) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allItems, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allItems).ToNot(BeNil()) + + Expect(len(allItems)).To(Equal(len(allResults))) + fmt.Fprintf(GinkgoWriter, "ListSparkEngineApplications() returned a total of %d item(s) using SparkEngineApplicationsPager.\n", len(allResults)) }) }) - Describe(`CreateSalIntegration - Create sal integration with wxd`, func() { + Describe(`CreateSparkEngineApplication - Create spark engine application`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateSalIntegration(createSalIntegrationOptions *CreateSalIntegrationOptions)`, func() { - createSalIntegrationOptions := &watsonxdatav2.CreateSalIntegrationOptions{ - Apikey: core.StringPtr("12efd3raq"), - EngineID: core.StringPtr("presto-01"), - StorageResourceCrn: core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161"), - StorageType: core.StringPtr("bmcos_object_storage"), - TrialPlan: core.BoolPtr(true), + It(`CreateSparkEngineApplication(createSparkEngineApplicationOptions *CreateSparkEngineApplicationOptions)`, func() { + sparkApplicationRuntimeModel := &watsonxdatav3.SparkApplicationRuntime{ + SparkVersion: core.StringPtr("3.4"), + } + + sparkApplicationDetailsModel := &watsonxdatav3.SparkApplicationDetails{ + Application: core.StringPtr("s3://mybucket/wordcount.py"), + Archives: core.StringPtr("s3://mybucket/myarchive.zip"), + Arguments: []string{"people.txt"}, + Class: core.StringPtr("org.apache.spark.examples.SparkPi"), + Conf: map[string]string{"key1": "configuration"}, + Env: map[string]string{"key1": "configuration"}, + Files: core.StringPtr("s3://mybucket/myfile.txt"), + Jars: core.StringPtr("testString"), + Name: core.StringPtr("SparkApplicaton1"), + Packages: core.StringPtr("org.apache.spark:example_1.2.3"), + Repositories: core.StringPtr("https://repo1.maven.org/maven2/"), + Runtime: sparkApplicationRuntimeModel, + SparkVersion: core.StringPtr("3.3"), + } + + sparkEngineApplicationCallbackModel := &watsonxdatav3.SparkEngineApplicationCallback{ + URL: core.StringPtr("testString"), + } + + sparkVolumeDetailsModel := &watsonxdatav3.SparkVolumeDetails{ + MountPath: core.StringPtr("/mount/path"), + Name: core.StringPtr("my-volume"), + ReadOnly: core.BoolPtr(true), + SourceSubPath: core.StringPtr("/source/path"), + } + + createSparkEngineApplicationOptions := &watsonxdatav3.CreateSparkEngineApplicationOptions{ + ID: core.StringPtr("testString"), + ApplicationDetails: sparkApplicationDetailsModel, + Callback: sparkEngineApplicationCallbackModel, + ContextID: core.StringPtr("testString"), + ContextType: core.StringPtr("project"), + DeployMode: core.StringPtr("local"), + IdempotencyKey: core.StringPtr("testString"), + InitScripts: []string{"file://init_scripts/test.sh"}, + JobEndpoint: core.StringPtr("/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications"), + MaxRetries: core.StringPtr("3"), + MinRetryIntervalInSeconds: core.StringPtr("30"), + ServiceInstanceID: core.StringPtr("iae"), + TimeoutInSeconds: core.StringPtr("60"), + Type: core.StringPtr("spark"), + Volumes: []watsonxdatav3.SparkVolumeDetails{*sparkVolumeDetailsModel}, AuthInstanceID: core.StringPtr("testString"), } - salIntegration, response, err := watsonxDataService.CreateSalIntegration(createSalIntegrationOptions) + sparkEngineApplicationSummary, response, err := watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(salIntegration).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(sparkEngineApplicationSummary).ToNot(BeNil()) }) }) - Describe(`UpdateSalIntegration - Update sal-wxd integration`, func() { + Describe(`GetSparkEngineHistoryServer - Get Spark history server details`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`UpdateSalIntegration(updateSalIntegrationOptions *UpdateSalIntegrationOptions)`, func() { - salIntegrationPatchModel := &watsonxdatav2.SalIntegrationPatch{ - Op: core.StringPtr("add"), - Path: core.StringPtr("storage"), - Value: core.StringPtr("new-apikey"), - } - salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - updateSalIntegrationOptions := &watsonxdatav2.UpdateSalIntegrationOptions{ - Body: salIntegrationPatchModelAsPatch, + It(`GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptions *GetSparkEngineHistoryServerOptions)`, func() { + getSparkEngineHistoryServerOptions := &watsonxdatav3.GetSparkEngineHistoryServerOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - salIntegration, response, err := watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptions) + sparkHistoryServer, response, err := watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegration).ToNot(BeNil()) + Expect(sparkHistoryServer).ToNot(BeNil()) }) }) - Describe(`CreateSalIntegrationEnrichment - Trigger enrichment jobs on schemas and tables`, func() { + Describe(`StartSparkEngineHistoryServer - Start spark history server`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptions *CreateSalIntegrationEnrichmentOptions)`, func() { - enrichmentObjModel := &watsonxdatav2.EnrichmentObj{ - Catalog: core.StringPtr("iceberg_data"), - Operation: core.StringPtr("create"), - Schema: core.StringPtr("testString"), - Tables: []string{"testString"}, - } - - createSalIntegrationEnrichmentOptions := &watsonxdatav2.CreateSalIntegrationEnrichmentOptions{ - EnrichmentPrototype: enrichmentObjModel, + It(`StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptions *StartSparkEngineHistoryServerOptions)`, func() { + startSparkEngineHistoryServerOptions := &watsonxdatav3.StartSparkEngineHistoryServerOptions{ + ID: core.StringPtr("testString"), + Cores: core.StringPtr("1"), + Memory: core.StringPtr("4G"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptions) + sparkHistoryServer, response, err := watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(204)) + Expect(response.StatusCode).To(Equal(201)) + Expect(sparkHistoryServer).ToNot(BeNil()) }) }) - Describe(`GetSalIntegrationEnrichmentAssets - Get semantic enrichment assets associated with the schema`, func() { + Describe(`GetSparkEngineHistoryServerUi - Redirect to spark history server UI`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSalIntegrationEnrichmentAssets(getSalIntegrationEnrichmentAssetsOptions *GetSalIntegrationEnrichmentAssetsOptions)`, func() { - getSalIntegrationEnrichmentAssetsOptions := &watsonxdatav2.GetSalIntegrationEnrichmentAssetsOptions{ - ProjectID: core.StringPtr("testString"), + It(`GetSparkEngineHistoryServerUi(getSparkEngineHistoryServerUiOptions *GetSparkEngineHistoryServerUiOptions)`, func() { + getSparkEngineHistoryServerUiOptions := &watsonxdatav3.GetSparkEngineHistoryServerUiOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - salIntegrationEnrichmentAssets, response, err := watsonxDataService.GetSalIntegrationEnrichmentAssets(getSalIntegrationEnrichmentAssetsOptions) + response, err := watsonxDataService.GetSparkEngineHistoryServerUi(getSparkEngineHistoryServerUiOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegrationEnrichmentAssets).ToNot(BeNil()) }) }) - Describe(`GetSalIntegrationEnrichmentDataAsset - Get semantic enrichment data asset associated with the table`, func() { + Describe(`ValidateIntegration - To validate an integration`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSalIntegrationEnrichmentDataAsset(getSalIntegrationEnrichmentDataAssetOptions *GetSalIntegrationEnrichmentDataAssetOptions)`, func() { - getSalIntegrationEnrichmentDataAssetOptions := &watsonxdatav2.GetSalIntegrationEnrichmentDataAssetOptions{ - ProjectID: core.StringPtr("testString"), - AssetID: core.StringPtr("testString"), + It(`ValidateIntegration(validateIntegrationOptions *ValidateIntegrationOptions)`, func() { + catalogsModel := &watsonxdatav3.Catalogs{ + CatalogNames: []string{"iceberg_data", "hive_data"}, + } + + validateIntegrationOptions := &watsonxdatav3.ValidateIntegrationOptions{ + Type: core.StringPtr("ranger"), + AccessToken: core.StringPtr("Header.Payload.Signature"), + Apikey: core.StringPtr("apikey"), + Catalogs: catalogsModel, + Certificate: core.StringPtr("certificate_content_base64_encoded"), + Password: core.StringPtr("password"), + Ssl: core.BoolPtr(true), + URL: core.StringPtr("https://www.abcd.com"), + Username: core.StringPtr("username"), AuthInstanceID: core.StringPtr("testString"), } - salIntegrationEnrichmentDataAsset, response, err := watsonxDataService.GetSalIntegrationEnrichmentDataAsset(getSalIntegrationEnrichmentDataAssetOptions) + validateIntegration, response, err := watsonxDataService.ValidateIntegration(validateIntegrationOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegrationEnrichmentDataAsset).ToNot(BeNil()) + Expect(validateIntegration).ToNot(BeNil()) }) }) - Describe(`GetSalIntegrationEnrichmentJobRunLogs - Get semantic enrichment job run logs associated with the job run`, func() { + Describe(`ListAllIntegrations - List integrations`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptions *GetSalIntegrationEnrichmentJobRunLogsOptions)`, func() { - getSalIntegrationEnrichmentJobRunLogsOptions := &watsonxdatav2.GetSalIntegrationEnrichmentJobRunLogsOptions{ - JobID: core.StringPtr("testString"), - JobRunID: core.StringPtr("testString"), - ProjectID: core.StringPtr("testString"), + It(`ListAllIntegrations(listAllIntegrationsOptions *ListAllIntegrationsOptions)`, func() { + listAllIntegrationsOptions := &watsonxdatav3.ListAllIntegrationsOptions{ AuthInstanceID: core.StringPtr("testString"), + Secret: core.StringPtr("testString"), + Type: []string{"testString"}, + State: []string{"active"}, } - salIntegrationEnrichmentJobRunLogs, response, err := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptions) + integrationCollection, response, err := watsonxDataService.ListAllIntegrations(listAllIntegrationsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegrationEnrichmentJobRunLogs).ToNot(BeNil()) + Expect(integrationCollection).ToNot(BeNil()) }) }) - Describe(`GetSalIntegrationEnrichmentJobRuns - Get semantic enrichment job runs associated with the schema`, func() { + Describe(`CreateIntegration - Create an integration`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSalIntegrationEnrichmentJobRuns(getSalIntegrationEnrichmentJobRunsOptions *GetSalIntegrationEnrichmentJobRunsOptions)`, func() { - getSalIntegrationEnrichmentJobRunsOptions := &watsonxdatav2.GetSalIntegrationEnrichmentJobRunsOptions{ - JobID: core.StringPtr("testString"), - ProjectID: core.StringPtr("testString"), + It(`CreateIntegration(createIntegrationOptions *CreateIntegrationOptions)`, func() { + catalogsModel := &watsonxdatav3.Catalogs{ + CatalogNames: []string{"iceberg_data", "hive_data"}, + } + + createIntegrationOptions := &watsonxdatav3.CreateIntegrationOptions{ + AccessToken: core.StringPtr("Header.Payload.Signature"), + Apikey: core.StringPtr("apikey"), + Catalogs: catalogsModel, + Certificate: core.StringPtr("certificate_content_base64_encoded"), + CertificateExtension: core.StringPtr("pem"), + ConnectionMode: core.StringPtr("external"), + CrossAccountIntegration: core.BoolPtr(false), + EnableDataPolicyWithinWxd: core.BoolPtr(false), + IkcUserAccountID: core.StringPtr("ikc_user_account_id"), + Password: core.StringPtr("password"), + PolicyCacheTimeConfiguration: core.StringPtr("123456789"), + Resource: core.StringPtr("presto01"), + Ssl: core.BoolPtr(true), + Type: core.StringPtr("ranger"), + URL: core.StringPtr("https://abcd.efgh.com"), + Username: core.StringPtr("username"), AuthInstanceID: core.StringPtr("testString"), } - salIntegrationEnrichmentJobRun, response, err := watsonxDataService.GetSalIntegrationEnrichmentJobRuns(getSalIntegrationEnrichmentJobRunsOptions) + integration, response, err := watsonxDataService.CreateIntegration(createIntegrationOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegrationEnrichmentJobRun).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(integration).ToNot(BeNil()) }) }) - Describe(`GetSalIntegrationEnrichmentJobs - Get semantic enrichment jobs associated with the schema`, func() { + Describe(`GetIntegrations - Get an Integration`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSalIntegrationEnrichmentJobs(getSalIntegrationEnrichmentJobsOptions *GetSalIntegrationEnrichmentJobsOptions)`, func() { - getSalIntegrationEnrichmentJobsOptions := &watsonxdatav2.GetSalIntegrationEnrichmentJobsOptions{ - WkcProjectID: core.StringPtr("testString"), + It(`GetIntegrations(getIntegrationsOptions *GetIntegrationsOptions)`, func() { + getIntegrationsOptions := &watsonxdatav3.GetIntegrationsOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - salIntegrationEnrichmentJobs, response, err := watsonxDataService.GetSalIntegrationEnrichmentJobs(getSalIntegrationEnrichmentJobsOptions) + integration, response, err := watsonxDataService.GetIntegrations(getIntegrationsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegrationEnrichmentJobs).ToNot(BeNil()) + Expect(integration).ToNot(BeNil()) }) }) - Describe(`GetSalIntegrationGlossaryTerms - Get list of uploaded glossary terms`, func() { + Describe(`UpdateIntegration - Update an Integration`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptions *GetSalIntegrationGlossaryTermsOptions)`, func() { - getSalIntegrationGlossaryTermsOptions := &watsonxdatav2.GetSalIntegrationGlossaryTermsOptions{ + It(`UpdateIntegration(updateIntegrationOptions *UpdateIntegrationOptions)`, func() { + catalogsModel := &watsonxdatav3.Catalogs{ + CatalogNames: []string{"iceberg_data", "hive_data"}, + } + + integrationPatchModel := &watsonxdatav3.IntegrationPatch{ + AccessToken: core.StringPtr("Header.Payload.Signature"), + Apikey: core.StringPtr("apikey"), + Catalogs: catalogsModel, + Certificate: core.StringPtr("certificate_content_base64_encoded"), + CertificateExtension: core.StringPtr("pem"), + ConnectionMode: core.StringPtr("external"), + CrossAccountIntegration: core.BoolPtr(false), + EnableDataPolicyWithinWxd: core.BoolPtr(false), + IkcUserAccountID: core.StringPtr("ikc_user_account_id"), + Password: core.StringPtr("password"), + PolicyCacheTimeConfiguration: core.StringPtr("123456789"), + Resource: core.StringPtr("presto01"), + Ssl: core.BoolPtr(true), + State: core.StringPtr("active"), + URL: core.StringPtr("https://abcd.efgh.com"), + Username: core.StringPtr("username"), + } + integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateIntegrationOptions := &watsonxdatav3.UpdateIntegrationOptions{ + ID: core.StringPtr("testString"), + Body: integrationPatchModelAsPatch, AuthInstanceID: core.StringPtr("testString"), + Secret: core.StringPtr("testString"), } - salIntegrationGlossaryTerms, response, err := watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptions) + integration, response, err := watsonxDataService.UpdateIntegration(updateIntegrationOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegrationGlossaryTerms).ToNot(BeNil()) + Expect(integration).ToNot(BeNil()) }) }) - Describe(`GetSalIntegrationMappings - Get wkc catalog and project mapped to the schema`, func() { + Describe(`RegisterTable - Register delta and hudi tables`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSalIntegrationMappings(getSalIntegrationMappingsOptions *GetSalIntegrationMappingsOptions)`, func() { - getSalIntegrationMappingsOptions := &watsonxdatav2.GetSalIntegrationMappingsOptions{ - CatalogName: core.StringPtr("testString"), - SchemaName: core.StringPtr("testString"), + It(`RegisterTable(registerTableOptions *RegisterTableOptions)`, func() { + registerTableOptions := &watsonxdatav3.RegisterTableOptions{ + CatalogID: core.StringPtr("testString"), + SchemaID: core.StringPtr("testString"), + MetadataLocation: core.StringPtr("s3a://storagename/path/to/table/metadata_location/_delta_log"), + TableName: core.StringPtr("table1"), AuthInstanceID: core.StringPtr("testString"), } - salIntegrationMappings, response, err := watsonxDataService.GetSalIntegrationMappings(getSalIntegrationMappingsOptions) + registerTableCreatedBody, response, err := watsonxDataService.RegisterTable(registerTableOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegrationMappings).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(registerTableCreatedBody).ToNot(BeNil()) }) }) - Describe(`GetSalIntegrationEnrichmentGlobalSettings - Get metadata enrichment global settings`, func() { + Describe(`LoadTable - Load delta and hudi tables metadata`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptions *GetSalIntegrationEnrichmentGlobalSettingsOptions)`, func() { - getSalIntegrationEnrichmentGlobalSettingsOptions := &watsonxdatav2.GetSalIntegrationEnrichmentGlobalSettingsOptions{ + It(`LoadTable(loadTableOptions *LoadTableOptions)`, func() { + loadTableOptions := &watsonxdatav3.LoadTableOptions{ + CatalogID: core.StringPtr("testString"), + SchemaID: core.StringPtr("testString"), + TableID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - salIntegrationEnrichmentSettings, response, err := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptions) + loadTableResponse, response, err := watsonxDataService.LoadTable(loadTableOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegrationEnrichmentSettings).ToNot(BeNil()) + Expect(loadTableResponse).ToNot(BeNil()) }) }) - Describe(`CreateSalIntegrationEnrichmentGlobalSettings - Add metadata enrichment global settings`, func() { + Describe(`ListCatalogs - Get list of catalogs`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateSalIntegrationEnrichmentGlobalSettings(createSalIntegrationEnrichmentGlobalSettingsOptions *CreateSalIntegrationEnrichmentGlobalSettingsOptions)`, func() { - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel := &watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration{ - AssignmentThreshold: core.Float64Ptr(float64(0.14)), - SuggestionThreshold: core.Float64Ptr(float64(0.9)), - } - - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel := &watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration{ - AssignmentThreshold: core.Float64Ptr(float64(0.1)), - SuggestionThreshold: core.Float64Ptr(float64(0.1)), - } - - salIntegrationEnrichmentSettingsSemanticExpansionModel := &watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion{ - DescriptionGeneration: core.BoolPtr(true), - DescriptionGenerationConfiguration: salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel, - NameExpansion: core.BoolPtr(true), - NameExpansionConfiguration: salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel, - } - - salIntegrationEnrichmentSettingsTermAssignmentModel := &watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment{ - ClassBasedAssignments: core.BoolPtr(false), - EvaluateNegativeAssignments: core.BoolPtr(false), - LlmBasedAssignments: core.BoolPtr(false), - MlBasedAssignmentsCustom: core.BoolPtr(false), - MlBasedAssignmentsDefault: core.BoolPtr(false), - NameMatching: core.BoolPtr(false), - TermAssignmentThreshold: core.Float64Ptr(float64(0.3)), - TermSuggestionThreshold: core.Float64Ptr(float64(0.4)), - } - - createSalIntegrationEnrichmentGlobalSettingsOptions := &watsonxdatav2.CreateSalIntegrationEnrichmentGlobalSettingsOptions{ - SemanticExpansion: salIntegrationEnrichmentSettingsSemanticExpansionModel, - TermAssignment: salIntegrationEnrichmentSettingsTermAssignmentModel, + It(`ListCatalogs(listCatalogsOptions *ListCatalogsOptions)`, func() { + listCatalogsOptions := &watsonxdatav3.ListCatalogsOptions{ AuthInstanceID: core.StringPtr("testString"), + Secret: core.StringPtr("testString"), + DefaultCatalogs: core.BoolPtr(false), + View: core.StringPtr("testString"), } - salIntegrationEnrichmentSettings, response, err := watsonxDataService.CreateSalIntegrationEnrichmentGlobalSettings(createSalIntegrationEnrichmentGlobalSettingsOptions) + catalogCollection, response, err := watsonxDataService.ListCatalogs(listCatalogsOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(salIntegrationEnrichmentSettings).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(catalogCollection).ToNot(BeNil()) }) }) - Describe(`GetSalIntegrationEnrichmentSettings - get metadata enrichment settings for a project`, func() { + Describe(`GetCatalogEngineAssociation - Get catalog engine association`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSalIntegrationEnrichmentSettings(getSalIntegrationEnrichmentSettingsOptions *GetSalIntegrationEnrichmentSettingsOptions)`, func() { - getSalIntegrationEnrichmentSettingsOptions := &watsonxdatav2.GetSalIntegrationEnrichmentSettingsOptions{ - ProjectID: core.StringPtr("testString"), + It(`GetCatalogEngineAssociation(getCatalogEngineAssociationOptions *GetCatalogEngineAssociationOptions)`, func() { + getCatalogEngineAssociationOptions := &watsonxdatav3.GetCatalogEngineAssociationOptions{ + CatalogName: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - salIntegrationEnrichmentSettings, response, err := watsonxDataService.GetSalIntegrationEnrichmentSettings(getSalIntegrationEnrichmentSettingsOptions) + catalogEngineResponse, response, err := watsonxDataService.GetCatalogEngineAssociation(getCatalogEngineAssociationOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegrationEnrichmentSettings).ToNot(BeNil()) + Expect(catalogEngineResponse).ToNot(BeNil()) }) }) - Describe(`CreateSalIntegrationEnrichmentSettings - Add metadata enrichment settings for a project`, func() { + Describe(`ListTables - List all tables`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateSalIntegrationEnrichmentSettings(createSalIntegrationEnrichmentSettingsOptions *CreateSalIntegrationEnrichmentSettingsOptions)`, func() { - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel := &watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration{ - AssignmentThreshold: core.Float64Ptr(float64(0.14)), - SuggestionThreshold: core.Float64Ptr(float64(0.9)), - } - - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel := &watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration{ - AssignmentThreshold: core.Float64Ptr(float64(0.1)), - SuggestionThreshold: core.Float64Ptr(float64(0.1)), - } - - salIntegrationEnrichmentSettingsSemanticExpansionModel := &watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion{ - DescriptionGeneration: core.BoolPtr(true), - DescriptionGenerationConfiguration: salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel, - NameExpansion: core.BoolPtr(true), - NameExpansionConfiguration: salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel, - } - - salIntegrationEnrichmentSettingsTermAssignmentModel := &watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment{ - ClassBasedAssignments: core.BoolPtr(false), - EvaluateNegativeAssignments: core.BoolPtr(false), - LlmBasedAssignments: core.BoolPtr(false), - MlBasedAssignmentsCustom: core.BoolPtr(false), - MlBasedAssignmentsDefault: core.BoolPtr(false), - NameMatching: core.BoolPtr(false), - TermAssignmentThreshold: core.Float64Ptr(float64(0.3)), - TermSuggestionThreshold: core.Float64Ptr(float64(0.4)), - } - - createSalIntegrationEnrichmentSettingsOptions := &watsonxdatav2.CreateSalIntegrationEnrichmentSettingsOptions{ - SemanticExpansion: salIntegrationEnrichmentSettingsSemanticExpansionModel, - TermAssignment: salIntegrationEnrichmentSettingsTermAssignmentModel, - ProjectID: core.StringPtr("testString"), + It(`ListTables(listTablesOptions *ListTablesOptions)`, func() { + listTablesOptions := &watsonxdatav3.ListTablesOptions{ + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), + EngineID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.CreateSalIntegrationEnrichmentSettings(createSalIntegrationEnrichmentSettingsOptions) + tableCollection, response, err := watsonxDataService.ListTables(listTablesOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(204)) + Expect(response.StatusCode).To(Equal(200)) + Expect(tableCollection).ToNot(BeNil()) }) }) - Describe(`CreateSalIntegrationUploadGlossary - Upload semantic enrichment business terms glossary`, func() { + Describe(`GetTable - Get table details`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptions *CreateSalIntegrationUploadGlossaryOptions)`, func() { - createSalIntegrationUploadGlossaryOptions := &watsonxdatav2.CreateSalIntegrationUploadGlossaryOptions{ - ReplaceOption: core.StringPtr("all"), - GlossaryCsv: CreateMockReader("This is a mock file."), - GlossaryCsvContentType: core.StringPtr("testString"), + It(`GetTable(getTableOptions *GetTableOptions)`, func() { + getTableOptions := &watsonxdatav3.GetTableOptions{ + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), + TableName: core.StringPtr("testString"), + EngineID: core.StringPtr("testString"), + Type: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - salIntegrationUploadGlossary, response, err := watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptions) + table, response, err := watsonxDataService.GetTable(getTableOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(salIntegrationUploadGlossary).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(table).ToNot(BeNil()) }) }) - Describe(`GetSalIntegrationUploadGlossaryStatus - Get status of upload glossary job`, func() { + Describe(`UpdateTable - Rename table`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptions *GetSalIntegrationUploadGlossaryStatusOptions)`, func() { - getSalIntegrationUploadGlossaryStatusOptions := &watsonxdatav2.GetSalIntegrationUploadGlossaryStatusOptions{ - ProcessID: core.StringPtr("testString"), + It(`UpdateTable(updateTableOptions *UpdateTableOptions)`, func() { + tablePatchModel := &watsonxdatav3.TablePatch{ + Name: core.StringPtr("updated_table_name"), + } + tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateTableOptions := &watsonxdatav3.UpdateTableOptions{ + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), + TableName: core.StringPtr("testString"), + EngineID: core.StringPtr("testString"), + Body: tablePatchModelAsPatch, + Type: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - salIntegrationUploadGlossaryStatus, response, err := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptions) + table, response, err := watsonxDataService.UpdateTable(updateTableOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(salIntegrationUploadGlossaryStatus).ToNot(BeNil()) + Expect(table).ToNot(BeNil()) }) }) - Describe(`ListSparkEngines - List all spark engines`, func() { + Describe(`ListColumns - List all columns of a table`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListSparkEngines(listSparkEnginesOptions *ListSparkEnginesOptions)`, func() { - listSparkEnginesOptions := &watsonxdatav2.ListSparkEnginesOptions{ + It(`ListColumns(listColumnsOptions *ListColumnsOptions)`, func() { + listColumnsOptions := &watsonxdatav3.ListColumnsOptions{ + EngineID: core.StringPtr("testString"), + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), + TableName: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - sparkEngineCollection, response, err := watsonxDataService.ListSparkEngines(listSparkEnginesOptions) + columnCollection, response, err := watsonxDataService.ListColumns(listColumnsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(sparkEngineCollection).ToNot(BeNil()) + Expect(columnCollection).ToNot(BeNil()) }) }) - Describe(`CreateSparkEngine - Create spark engine`, func() { + Describe(`CreateColumns - Add column(s)`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateSparkEngine(createSparkEngineOptions *CreateSparkEngineOptions)`, func() { - sparkDefaultConfigModel := &watsonxdatav2.SparkDefaultConfig{ - Config1: core.StringPtr("testString"), - Config2: core.StringPtr("testString"), - } - - sparkScaleConfigModel := &watsonxdatav2.SparkScaleConfig{ - AutoScaleEnabled: core.BoolPtr(true), - CurrentNumberOfNodes: core.Int64Ptr(int64(2)), - MaximumNumberOfNodes: core.Int64Ptr(int64(5)), - MinimumNumberOfNodes: core.Int64Ptr(int64(1)), - NodeType: core.StringPtr("small"), - NumberOfNodes: core.Int64Ptr(int64(5)), - } - - sparkEngineDetailsPrototypeModel := &watsonxdatav2.SparkEngineDetailsPrototype{ - ApiKey: core.StringPtr("apikey"), - ConnectionString: core.StringPtr("1.2.3.4"), - DefaultConfig: sparkDefaultConfigModel, - DefaultVersion: core.StringPtr("3.3"), - EngineHomeBucketDisplayName: core.StringPtr("test-spark-bucket"), - EngineHomeBucketName: core.StringPtr("4fec0f8b-888a-4c16-8f38-250c8499e6ce-customer"), - EngineHomePath: core.StringPtr("spark/spark1234"), - EngineHomeVolumeID: core.StringPtr("1704979825978585"), - EngineHomeVolumeName: core.StringPtr("my-volume"), - EngineHomeVolumeStorageClass: core.StringPtr("nfs-client"), - EngineHomeVolumeStorageSize: core.StringPtr("5Gi"), - EngineSubType: core.StringPtr("java/cpp"), - InstanceID: core.StringPtr("spark-id"), - ManagedBy: core.StringPtr("fully/self"), - ScaleConfig: sparkScaleConfigModel, + It(`CreateColumns(createColumnsOptions *CreateColumnsOptions)`, func() { + columnModel := &watsonxdatav3.Column{ + Comment: core.StringPtr("Expenses column for each department"), + Extra: core.StringPtr("AUTO_INCREMENT"), + Length: core.StringPtr("30"), + Name: core.StringPtr("expenses"), + Precision: core.StringPtr("10"), + Scale: core.StringPtr("2"), + Type: core.StringPtr("varchar"), } - createSparkEngineOptions := &watsonxdatav2.CreateSparkEngineOptions{ - Origin: core.StringPtr("native"), - AssociatedCatalogs: []string{"iceberg-data"}, - Description: core.StringPtr("testString"), - EngineDetails: sparkEngineDetailsPrototypeModel, - EngineDisplayName: core.StringPtr("test-native"), - Status: core.StringPtr("testString"), - Tags: []string{"testString"}, - Type: core.StringPtr("spark"), + createColumnsOptions := &watsonxdatav3.CreateColumnsOptions{ + EngineID: core.StringPtr("testString"), + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), + TableName: core.StringPtr("testString"), + Columns: []watsonxdatav3.Column{*columnModel}, AuthInstanceID: core.StringPtr("testString"), } - sparkEngine, response, err := watsonxDataService.CreateSparkEngine(createSparkEngineOptions) + columnCollection, response, err := watsonxDataService.CreateColumns(createColumnsOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - Expect(sparkEngine).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(columnCollection).ToNot(BeNil()) }) }) - Describe(`GetSparkEngine - Get spark engine`, func() { + Describe(`UpdateColumn - Alter column`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSparkEngine(getSparkEngineOptions *GetSparkEngineOptions)`, func() { - getSparkEngineOptions := &watsonxdatav2.GetSparkEngineOptions{ + It(`UpdateColumn(updateColumnOptions *UpdateColumnOptions)`, func() { + columnPatchModel := &watsonxdatav3.ColumnPatch{ + Name: core.StringPtr("expenses"), + } + columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateColumnOptions := &watsonxdatav3.UpdateColumnOptions{ EngineID: core.StringPtr("testString"), + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), + TableName: core.StringPtr("testString"), + ColumnName: core.StringPtr("testString"), + Body: columnPatchModelAsPatch, AuthInstanceID: core.StringPtr("testString"), } - sparkEngine, response, err := watsonxDataService.GetSparkEngine(getSparkEngineOptions) + column, response, err := watsonxDataService.UpdateColumn(updateColumnOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(sparkEngine).ToNot(BeNil()) + Expect(column).ToNot(BeNil()) }) }) - Describe(`UpdateSparkEngine - Update spark engine`, func() { + Describe(`RollbackTable - Rollback snapshot`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`UpdateSparkEngine(updateSparkEngineOptions *UpdateSparkEngineOptions)`, func() { - sparkEngineResourceLimitModel := &watsonxdatav2.SparkEngineResourceLimit{ - Cores: core.StringPtr("1"), - Memory: core.StringPtr("4G"), - } - - updateSparkEngineBodyEngineDetailsModel := &watsonxdatav2.UpdateSparkEngineBodyEngineDetails{ - DefaultConfig: map[string]string{"key1": "testString"}, - DefaultVersion: core.StringPtr("3.4"), - EngineHomeBucketName: core.StringPtr("test-spark-bucket"), - ResourceLimitEnabled: core.BoolPtr(true), - ResourceLimits: sparkEngineResourceLimitModel, - } - - updateSparkEngineBodyModel := &watsonxdatav2.UpdateSparkEngineBody{ - Description: core.StringPtr("Updated Description"), - EngineDetails: updateSparkEngineBodyEngineDetailsModel, - EngineDisplayName: core.StringPtr("Updated Display Name"), - Tags: []string{"tag1", "tag2"}, - } - updateSparkEngineBodyModelAsPatch, asPatchErr := updateSparkEngineBodyModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - updateSparkEngineOptions := &watsonxdatav2.UpdateSparkEngineOptions{ + It(`RollbackTable(rollbackTableOptions *RollbackTableOptions)`, func() { + rollbackTableOptions := &watsonxdatav3.RollbackTableOptions{ + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), + TableName: core.StringPtr("testString"), + SnapshotID: core.StringPtr("12357647"), EngineID: core.StringPtr("testString"), - Body: updateSparkEngineBodyModelAsPatch, AuthInstanceID: core.StringPtr("testString"), } - sparkEngine, response, err := watsonxDataService.UpdateSparkEngine(updateSparkEngineOptions) + successResponsePrototype, response, err := watsonxDataService.RollbackTable(rollbackTableOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(sparkEngine).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(successResponsePrototype).ToNot(BeNil()) }) }) - Describe(`ListSparkEngineApplications - List all applications in a spark engine`, func() { + Describe(`ListTableSnapshots - Get table snapshots`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListSparkEngineApplications(listSparkEngineApplicationsOptions *ListSparkEngineApplicationsOptions)`, func() { - listSparkEngineApplicationsOptions := &watsonxdatav2.ListSparkEngineApplicationsOptions{ + It(`ListTableSnapshots(listTableSnapshotsOptions *ListTableSnapshotsOptions)`, func() { + listTableSnapshotsOptions := &watsonxdatav3.ListTableSnapshotsOptions{ + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), + TableName: core.StringPtr("testString"), EngineID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), - State: []string{"testString"}, } - sparkEngineApplicationStatusCollection, response, err := watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptions) + tableSnapshotCollection, response, err := watsonxDataService.ListTableSnapshots(listTableSnapshotsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(sparkEngineApplicationStatusCollection).ToNot(BeNil()) + Expect(tableSnapshotCollection).ToNot(BeNil()) }) }) - Describe(`CreateSparkEngineApplication - Submit engine applications`, func() { + Describe(`ListSchemas - List all schemas`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateSparkEngineApplication(createSparkEngineApplicationOptions *CreateSparkEngineApplicationOptions)`, func() { - sparkApplicationConfigModel := &watsonxdatav2.SparkApplicationConfig{ - SparkSampleConfigProperpty: core.StringPtr("testString"), - } - - sparkApplicationEnvModel := &watsonxdatav2.SparkApplicationEnv{ - SampleEnvKey: core.StringPtr("testString"), - } - - sparkApplicationDetailsModel := &watsonxdatav2.SparkApplicationDetails{ - Application: core.StringPtr("/opt/ibm/spark/examples/src/main/python/wordcount.py"), - Arguments: []string{"/opt/ibm/spark/examples/src/main/resources/people.txt"}, - Class: core.StringPtr("org.apache.spark.examples.SparkPi"), - Conf: sparkApplicationConfigModel, - Env: sparkApplicationEnvModel, - Files: core.StringPtr("s3://mybucket/myfile.txt"), - Jars: core.StringPtr("testString"), - Name: core.StringPtr("SparkApplicaton1"), - Packages: core.StringPtr("org.apache.spark:example_1.2.3"), - Repositories: core.StringPtr("https://repo1.maven.org/maven2/"), - SparkVersion: core.StringPtr("3.3"), - } - - sparkVolumeDetailsModel := &watsonxdatav2.SparkVolumeDetails{ - MountPath: core.StringPtr("/mount/path"), - Name: core.StringPtr("my-volume"), - ReadOnly: core.BoolPtr(true), - SourceSubPath: core.StringPtr("/source/path"), - } - - createSparkEngineApplicationOptions := &watsonxdatav2.CreateSparkEngineApplicationOptions{ + It(`ListSchemas(listSchemasOptions *ListSchemasOptions)`, func() { + listSchemasOptions := &watsonxdatav3.ListSchemasOptions{ EngineID: core.StringPtr("testString"), - ApplicationDetails: sparkApplicationDetailsModel, - JobEndpoint: core.StringPtr("testString"), - ServiceInstanceID: core.StringPtr("testString"), - Type: core.StringPtr("iae"), - Volumes: []watsonxdatav2.SparkVolumeDetails{*sparkVolumeDetailsModel}, + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), - State: []string{"testString"}, } - sparkEngineApplicationStatus, response, err := watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptions) + schemasCollection, response, err := watsonxDataService.ListSchemas(listSchemasOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(sparkEngineApplicationStatus).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(schemasCollection).ToNot(BeNil()) }) }) - Describe(`GetSparkEngineApplicationStatus - Get spark application`, func() { + Describe(`CreateSchema - Create schema`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptions *GetSparkEngineApplicationStatusOptions)`, func() { - getSparkEngineApplicationStatusOptions := &watsonxdatav2.GetSparkEngineApplicationStatusOptions{ + It(`CreateSchema(createSchemaOptions *CreateSchemaOptions)`, func() { + createSchemaOptions := &watsonxdatav3.CreateSchemaOptions{ EngineID: core.StringPtr("testString"), - ApplicationID: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + CustomPath: core.StringPtr("sample-path"), + Name: core.StringPtr("SampleSchema1"), + Hostname: core.StringPtr("db2@hostname.com"), + Port: core.Int64Ptr(int64(4553)), + StorageName: core.StringPtr("sample-bucket"), AuthInstanceID: core.StringPtr("testString"), } - sparkEngineApplicationStatus, response, err := watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptions) + schemaPrototype, response, err := watsonxDataService.CreateSchema(createSchemaOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(sparkEngineApplicationStatus).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(schemaPrototype).ToNot(BeNil()) }) }) - Describe(`ListSparkEngineCatalogs - Get spark engine catalogs`, func() { + Describe(`UpdateSyncCatalog - External Iceberg table registration`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListSparkEngineCatalogs(listSparkEngineCatalogsOptions *ListSparkEngineCatalogsOptions)`, func() { - listSparkEngineCatalogsOptions := &watsonxdatav2.ListSparkEngineCatalogsOptions{ - EngineID: core.StringPtr("testString"), + It(`UpdateSyncCatalog(updateSyncCatalogOptions *UpdateSyncCatalogOptions)`, func() { + updateSyncCatalogOptions := &watsonxdatav3.UpdateSyncCatalogOptions{ + ID: core.StringPtr("testString"), + AutoAddNewTables: core.BoolPtr(true), + RegisterNewTables: core.BoolPtr(true), + SyncExistingTables: core.BoolPtr(true), + SyncIcebergMd: core.BoolPtr(true), + SyncPath: core.StringPtr("sample-path"), AuthInstanceID: core.StringPtr("testString"), } - catalogCollection, response, err := watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptions) + successResponsePrototype, response, err := watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(catalogCollection).ToNot(BeNil()) + Expect(successResponsePrototype).ToNot(BeNil()) }) }) - Describe(`CreateSparkEngineCatalogs - Associate catalogs to spark engine`, func() { + Describe(`GetCatalog - Get catalog properties by catalog_id`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateSparkEngineCatalogs(createSparkEngineCatalogsOptions *CreateSparkEngineCatalogsOptions)`, func() { - createSparkEngineCatalogsOptions := &watsonxdatav2.CreateSparkEngineCatalogsOptions{ - EngineID: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), + It(`GetCatalog(getCatalogOptions *GetCatalogOptions)`, func() { + getCatalogOptions := &watsonxdatav3.GetCatalogOptions{ + Name: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - catalog, response, err := watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptions) + catalog, response, err := watsonxDataService.GetCatalog(getCatalogOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) + Expect(response.StatusCode).To(Equal(200)) Expect(catalog).ToNot(BeNil()) }) }) - Describe(`GetSparkEngineCatalog - Get spark engine catalog`, func() { + Describe(`ListMilvusServices - Get list of milvus services`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSparkEngineCatalog(getSparkEngineCatalogOptions *GetSparkEngineCatalogOptions)`, func() { - getSparkEngineCatalogOptions := &watsonxdatav2.GetSparkEngineCatalogOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), + It(`ListMilvusServices(listMilvusServicesOptions *ListMilvusServicesOptions)`, func() { + listMilvusServicesOptions := &watsonxdatav3.ListMilvusServicesOptions{ AuthInstanceID: core.StringPtr("testString"), } - catalog, response, err := watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptions) + milvusServiceCollection, response, err := watsonxDataService.ListMilvusServices(listMilvusServicesOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(catalog).ToNot(BeNil()) + Expect(milvusServiceCollection).ToNot(BeNil()) }) }) - Describe(`GetSparkEngineHistoryServer - Get spark history server`, func() { + Describe(`CreateMilvusService - Create milvus service`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptions *GetSparkEngineHistoryServerOptions)`, func() { - getSparkEngineHistoryServerOptions := &watsonxdatav2.GetSparkEngineHistoryServerOptions{ - EngineID: core.StringPtr("testString"), + It(`CreateMilvusService(createMilvusServiceOptions *CreateMilvusServiceOptions)`, func() { + createMilvusServiceOptions := &watsonxdatav3.CreateMilvusServiceOptions{ + DisplayName: core.StringPtr("sampleService"), + Origin: core.StringPtr("native"), + RootPath: core.StringPtr("Sample/path"), + TshirtSize: core.StringPtr("small"), + DcCpu: core.Float64Ptr(float64(0.01)), + DcMemory: core.Float64Ptr(float64(0.01)), + DcReplicas: core.Int64Ptr(int64(1)), + Description: core.StringPtr("milvus service for running sql queries"), + DwCpu: core.Float64Ptr(float64(0.01)), + DwMemory: core.Float64Ptr(float64(0.01)), + DwReplicas: core.Int64Ptr(int64(1)), + EtcdCpu: core.Float64Ptr(float64(0.01)), + EtcdMemory: core.Float64Ptr(float64(0.01)), + ID: core.StringPtr("milvus123"), + IndexType: core.StringPtr("ivf_sq8"), + IwCpu: core.Float64Ptr(float64(0.01)), + IwMemory: core.Float64Ptr(float64(0.01)), + IwReplicas: core.Int64Ptr(int64(1)), + KafkaCpu: core.Float64Ptr(float64(0.01)), + KafkaMemory: core.Float64Ptr(float64(0.01)), + ProxyCpu: core.Float64Ptr(float64(0.01)), + ProxyMemory: core.Float64Ptr(float64(0.01)), + ProxyReplicas: core.Int64Ptr(int64(1)), + QcCpu: core.Float64Ptr(float64(0.01)), + QcMemory: core.Float64Ptr(float64(0.01)), + QcReplicas: core.Int64Ptr(int64(1)), + QwCpu: core.Float64Ptr(float64(0.01)), + QwMemory: core.Float64Ptr(float64(0.01)), + QwReplicas: core.Int64Ptr(int64(1)), + RcCpu: core.Float64Ptr(float64(0.01)), + RcMemory: core.Float64Ptr(float64(0.01)), + RcReplicas: core.Int64Ptr(int64(1)), + StorageName: core.StringPtr("Sample_storage_name"), + Tags: []string{"tag1", "tag2"}, + Vector: core.Int64Ptr(int64(1)), + VectorDimension: core.Int64Ptr(int64(384)), AuthInstanceID: core.StringPtr("testString"), } - sparkHistoryServer, response, err := watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptions) + milvusService, response, err := watsonxDataService.CreateMilvusService(createMilvusServiceOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(sparkHistoryServer).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(202)) + Expect(milvusService).ToNot(BeNil()) }) }) - Describe(`StartSparkEngineHistoryServer - Start spark history server`, func() { + Describe(`GetMilvusService - Get milvus service`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptions *StartSparkEngineHistoryServerOptions)`, func() { - startSparkEngineHistoryServerOptions := &watsonxdatav2.StartSparkEngineHistoryServerOptions{ - EngineID: core.StringPtr("testString"), - Cores: core.StringPtr("1"), - Memory: core.StringPtr("4G"), + It(`GetMilvusService(getMilvusServiceOptions *GetMilvusServiceOptions)`, func() { + getMilvusServiceOptions := &watsonxdatav3.GetMilvusServiceOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - sparkHistoryServer, response, err := watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptions) + milvusService, response, err := watsonxDataService.GetMilvusService(getMilvusServiceOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(sparkHistoryServer).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(milvusService).ToNot(BeNil()) }) }) - Describe(`PauseSparkEngine - Pause engine`, func() { + Describe(`UpdateMilvusService - Update milvus service`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`PauseSparkEngine(pauseSparkEngineOptions *PauseSparkEngineOptions)`, func() { - pauseSparkEngineOptions := &watsonxdatav2.PauseSparkEngineOptions{ - EngineID: core.StringPtr("testString"), - Force: core.BoolPtr(true), + It(`UpdateMilvusService(updateMilvusServiceOptions *UpdateMilvusServiceOptions)`, func() { + milvusServicePatchModel := &watsonxdatav3.MilvusServicePatch{ + Description: core.StringPtr("updated description for milvus service"), + DisplayName: core.StringPtr("sampleService"), + Tags: []string{"tag1", "tag2"}, + } + milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + updateMilvusServiceOptions := &watsonxdatav3.UpdateMilvusServiceOptions{ + ID: core.StringPtr("testString"), + Body: milvusServicePatchModelAsPatch, AuthInstanceID: core.StringPtr("testString"), } - successResponse, response, err := watsonxDataService.PauseSparkEngine(pauseSparkEngineOptions) + milvusService, response, err := watsonxDataService.UpdateMilvusService(updateMilvusServiceOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(successResponse).ToNot(BeNil()) + Expect(milvusService).ToNot(BeNil()) }) }) - Describe(`ResumeSparkEngine - Resume engine`, func() { + Describe(`CreateMilvusServicePause - Pause milvus service`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ResumeSparkEngine(resumeSparkEngineOptions *ResumeSparkEngineOptions)`, func() { - resumeSparkEngineOptions := &watsonxdatav2.ResumeSparkEngineOptions{ - EngineID: core.StringPtr("testString"), + It(`CreateMilvusServicePause(createMilvusServicePauseOptions *CreateMilvusServicePauseOptions)`, func() { + createMilvusServicePauseOptions := &watsonxdatav3.CreateMilvusServicePauseOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - successResponse, response, err := watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptions) + successResponse, response, err := watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) + Expect(response.StatusCode).To(Equal(201)) Expect(successResponse).ToNot(BeNil()) }) }) - Describe(`ScaleSparkEngine - Scale Spark engine`, func() { + Describe(`CreateMilvusServiceResume - Resume milvus service`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ScaleSparkEngine(scaleSparkEngineOptions *ScaleSparkEngineOptions)`, func() { - scaleSparkEngineOptions := &watsonxdatav2.ScaleSparkEngineOptions{ - EngineID: core.StringPtr("testString"), - NumberOfNodes: core.Int64Ptr(int64(2)), + It(`CreateMilvusServiceResume(createMilvusServiceResumeOptions *CreateMilvusServiceResumeOptions)`, func() { + createMilvusServiceResumeOptions := &watsonxdatav3.CreateMilvusServiceResumeOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - successResponse, response, err := watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptions) + successResponse, response, err := watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) + Expect(response.StatusCode).To(Equal(201)) Expect(successResponse).ToNot(BeNil()) }) }) - Describe(`ListSparkVersions - List spark version`, func() { + Describe(`CreateMilvusServiceScale - Scale a milvus service`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListSparkVersions(listSparkVersionsOptions *ListSparkVersionsOptions)`, func() { - listSparkVersionsOptions := &watsonxdatav2.ListSparkVersionsOptions{ + It(`CreateMilvusServiceScale(createMilvusServiceScaleOptions *CreateMilvusServiceScaleOptions)`, func() { + createMilvusServiceScaleOptions := &watsonxdatav3.CreateMilvusServiceScaleOptions{ + ID: core.StringPtr("testString"), + TshirtSize: core.StringPtr("small"), + DcCpu: core.Float64Ptr(float64(0.01)), + DcMemory: core.Float64Ptr(float64(0.01)), + DcReplicas: core.Int64Ptr(int64(1)), + DwCpu: core.Float64Ptr(float64(0.01)), + DwMemory: core.Float64Ptr(float64(0.01)), + DwReplicas: core.Int64Ptr(int64(1)), + EtcdCpu: core.Float64Ptr(float64(0.01)), + EtcdMemory: core.Float64Ptr(float64(0.01)), + IndexType: core.StringPtr("flat"), + IwCpu: core.Float64Ptr(float64(0.01)), + IwMemory: core.Float64Ptr(float64(0.01)), + IwReplicas: core.Int64Ptr(int64(1)), + KafkaCpu: core.Float64Ptr(float64(0.01)), + KafkaMemory: core.Float64Ptr(float64(0.01)), + ProxyCpu: core.Float64Ptr(float64(0.01)), + ProxyMemory: core.Float64Ptr(float64(0.01)), + ProxyReplicas: core.Int64Ptr(int64(1)), + QcCpu: core.Float64Ptr(float64(0.01)), + QcMemory: core.Float64Ptr(float64(0.01)), + QcReplicas: core.Int64Ptr(int64(1)), + QwCpu: core.Float64Ptr(float64(0.01)), + QwMemory: core.Float64Ptr(float64(0.01)), + QwReplicas: core.Int64Ptr(int64(1)), + RcCpu: core.Float64Ptr(float64(0.01)), + RcMemory: core.Float64Ptr(float64(0.01)), + RcReplicas: core.Int64Ptr(int64(1)), + Vector: core.Int64Ptr(int64(1)), + VectorDimension: core.Int64Ptr(int64(384)), AuthInstanceID: core.StringPtr("testString"), } - listSparkVersionsOkBody, response, err := watsonxDataService.ListSparkVersions(listSparkVersionsOptions) + successResponse, response, err := watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(listSparkVersionsOkBody).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(successResponse).ToNot(BeNil()) }) }) - Describe(`ListCatalogs - List all registered catalogs`, func() { + Describe(`ListMilvusServiceDatabases - Get milvus service databases`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListCatalogs(listCatalogsOptions *ListCatalogsOptions)`, func() { - listCatalogsOptions := &watsonxdatav2.ListCatalogsOptions{ + It(`ListMilvusServiceDatabases(listMilvusServiceDatabasesOptions *ListMilvusServiceDatabasesOptions)`, func() { + listMilvusServiceDatabasesOptions := &watsonxdatav3.ListMilvusServiceDatabasesOptions{ + ServiceID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - catalogCollection, response, err := watsonxDataService.ListCatalogs(listCatalogsOptions) + milvusServiceDatabases, response, err := watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(catalogCollection).ToNot(BeNil()) + Expect(milvusServiceDatabases).ToNot(BeNil()) }) }) - Describe(`GetCatalog - Get catalog properties by catalog_id`, func() { + Describe(`ListMilvusDatabaseCollections - Get milvus database collections`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetCatalog(getCatalogOptions *GetCatalogOptions)`, func() { - getCatalogOptions := &watsonxdatav2.GetCatalogOptions{ - CatalogID: core.StringPtr("testString"), + It(`ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptions *ListMilvusDatabaseCollectionsOptions)`, func() { + listMilvusDatabaseCollectionsOptions := &watsonxdatav3.ListMilvusDatabaseCollectionsOptions{ + ServiceID: core.StringPtr("testString"), + DatabaseID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - catalog, response, err := watsonxDataService.GetCatalog(getCatalogOptions) + milvusDatabaseCollections, response, err := watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(catalog).ToNot(BeNil()) + Expect(milvusDatabaseCollections).ToNot(BeNil()) }) }) - Describe(`ListSchemas - List all schemas`, func() { + Describe(`ListMilvusDatabasePartitions - Get milvus database collection partitions`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListSchemas(listSchemasOptions *ListSchemasOptions)`, func() { - listSchemasOptions := &watsonxdatav2.ListSchemasOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), + It(`ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptions *ListMilvusDatabasePartitionsOptions)`, func() { + listMilvusDatabasePartitionsOptions := &watsonxdatav3.ListMilvusDatabasePartitionsOptions{ + ServiceID: core.StringPtr("testString"), + DatabaseID: core.StringPtr("testString"), + CollectionName: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - listSchemasOkBody, response, err := watsonxDataService.ListSchemas(listSchemasOptions) + milvusDatabasePartitions, response, err := watsonxDataService.ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(listSchemasOkBody).ToNot(BeNil()) + Expect(milvusDatabasePartitions).ToNot(BeNil()) }) }) - Describe(`CreateSchema - Create schema`, func() { + Describe(`UpdateMilvusServiceBucket - Update milvus service storage`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateSchema(createSchemaOptions *CreateSchemaOptions)`, func() { - createSchemaOptions := &watsonxdatav2.CreateSchemaOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - CustomPath: core.StringPtr("sample-path"), - SchemaName: core.StringPtr("SampleSchema1"), - BucketName: core.StringPtr("sample-bucket"), - Hostname: core.StringPtr("db2@hostname.com"), - Port: core.Int64Ptr(int64(4553)), + It(`UpdateMilvusServiceBucket(updateMilvusServiceBucketOptions *UpdateMilvusServiceBucketOptions)`, func() { + jsonPatchOperationModel := &watsonxdatav3.JSONPatchOperation{ + Op: core.StringPtr("add"), + Path: core.StringPtr("testString"), + From: core.StringPtr("testString"), + Value: "testString", + } + + updateMilvusServiceBucketOptions := &watsonxdatav3.UpdateMilvusServiceBucketOptions{ + ServiceID: core.StringPtr("testString"), + Body: []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel}, AuthInstanceID: core.StringPtr("testString"), } - createSchemaCreatedBody, response, err := watsonxDataService.CreateSchema(createSchemaOptions) + milvusService, response, err := watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(createSchemaCreatedBody).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(milvusService).ToNot(BeNil()) }) }) - Describe(`ListTables - List all tables`, func() { + Describe(`GetSalIntegration - Get semantic automation layer Integration of the instance`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListTables(listTablesOptions *ListTablesOptions)`, func() { - listTablesOptions := &watsonxdatav2.ListTablesOptions{ - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - EngineID: core.StringPtr("testString"), + It(`GetSalIntegration(getSalIntegrationOptions *GetSalIntegrationOptions)`, func() { + getSalIntegrationOptions := &watsonxdatav3.GetSalIntegrationOptions{ AuthInstanceID: core.StringPtr("testString"), } - tableCollection, response, err := watsonxDataService.ListTables(listTablesOptions) + salIntegration, response, err := watsonxDataService.GetSalIntegration(getSalIntegrationOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(tableCollection).ToNot(BeNil()) + Expect(salIntegration).ToNot(BeNil()) }) }) - Describe(`GetTable - Get table details`, func() { + Describe(`CreateSalIntegration - Create semantic automation layer integration with IBM Knowledge Catalog`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetTable(getTableOptions *GetTableOptions)`, func() { - getTableOptions := &watsonxdatav2.GetTableOptions{ - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - TableID: core.StringPtr("testString"), - EngineID: core.StringPtr("testString"), - Type: core.StringPtr("testString"), + It(`CreateSalIntegration(createSalIntegrationOptions *CreateSalIntegrationOptions)`, func() { + createSalIntegrationOptions := &watsonxdatav3.CreateSalIntegrationOptions{ + Apikey: core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK"), + EngineID: core.StringPtr("presto-01"), + StorageResourceCrn: core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161"), + StorageType: core.StringPtr("bmcos_object_storage"), + TrialPlan: core.BoolPtr(true), AuthInstanceID: core.StringPtr("testString"), } - table, response, err := watsonxDataService.GetTable(getTableOptions) + salIntegration, response, err := watsonxDataService.CreateSalIntegration(createSalIntegrationOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(table).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(salIntegration).ToNot(BeNil()) }) }) - Describe(`UpdateTable - Rename table`, func() { + Describe(`UpdateSalIntegration - Patch Semantic automation layer integration`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`UpdateTable(updateTableOptions *UpdateTableOptions)`, func() { - tablePatchModel := &watsonxdatav2.TablePatch{ - TableName: core.StringPtr("updated_table_name"), + It(`UpdateSalIntegration(updateSalIntegrationOptions *UpdateSalIntegrationOptions)`, func() { + salIntegrationPatchModel := &watsonxdatav3.SalIntegrationPatch{ + Apikey: core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK"), + EngineID: core.StringPtr("presto-01"), } - tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() + salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - updateTableOptions := &watsonxdatav2.UpdateTableOptions{ - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - TableID: core.StringPtr("testString"), - EngineID: core.StringPtr("testString"), - Body: tablePatchModelAsPatch, - Type: core.StringPtr("testString"), + updateSalIntegrationOptions := &watsonxdatav3.UpdateSalIntegrationOptions{ + SalIntegrationPatch: salIntegrationPatchModelAsPatch, AuthInstanceID: core.StringPtr("testString"), } - table, response, err := watsonxDataService.UpdateTable(updateTableOptions) + salIntegration, response, err := watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(table).ToNot(BeNil()) + Expect(salIntegration).ToNot(BeNil()) }) }) - Describe(`ListColumns - List all columns of a table`, func() { + Describe(`CreateSalIntegrationEnrichment - create enrichment jobs of schema(or tables in schema)`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListColumns(listColumnsOptions *ListColumnsOptions)`, func() { - listColumnsOptions := &watsonxdatav2.ListColumnsOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - TableID: core.StringPtr("testString"), + It(`CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptions *CreateSalIntegrationEnrichmentOptions)`, func() { + enrichmentObjModel := &watsonxdatav3.EnrichmentObj{ + Catalog: core.StringPtr("iceberg_data"), + Operation: core.StringPtr("create"), + Schema: core.StringPtr("schema1"), + Tables: []string{"table1"}, + } + + createSalIntegrationEnrichmentOptions := &watsonxdatav3.CreateSalIntegrationEnrichmentOptions{ + Changes: []watsonxdatav3.EnrichmentObj{*enrichmentObjModel}, AuthInstanceID: core.StringPtr("testString"), } - columnCollection, response, err := watsonxDataService.ListColumns(listColumnsOptions) + response, err := watsonxDataService.CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(columnCollection).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`CreateColumns - Add column(s)`, func() { + Describe(`ListSalIntegrationEnrichmentAssets - List semantic enriched data_assets in IBM Knowledge catalog`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateColumns(createColumnsOptions *CreateColumnsOptions)`, func() { - columnModel := &watsonxdatav2.Column{ - ColumnName: core.StringPtr("expenses"), - Comment: core.StringPtr("expenses column"), - Extra: core.StringPtr("varchar"), - Length: core.StringPtr("30"), - Scale: core.StringPtr("2"), - Precision: core.StringPtr("10"), - Type: core.StringPtr("varchar"), - } - - createColumnsOptions := &watsonxdatav2.CreateColumnsOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - TableID: core.StringPtr("testString"), - Columns: []watsonxdatav2.Column{*columnModel}, + It(`ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptions *ListSalIntegrationEnrichmentAssetsOptions)`, func() { + listSalIntegrationEnrichmentAssetsOptions := &watsonxdatav3.ListSalIntegrationEnrichmentAssetsOptions{ + ProjectID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - columnCollection, response, err := watsonxDataService.CreateColumns(createColumnsOptions) + salEnrichmentDataAssetCollection, response, err := watsonxDataService.ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(columnCollection).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(salEnrichmentDataAssetCollection).ToNot(BeNil()) }) }) - Describe(`UpdateColumn - Alter column`, func() { + Describe(`GetSalIntegrationEnrichmentAssetsByID - Get semantic enrichment data_asset associated with the table`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`UpdateColumn(updateColumnOptions *UpdateColumnOptions)`, func() { - columnPatchModel := &watsonxdatav2.ColumnPatch{ - ColumnName: core.StringPtr("expenses"), - } - columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - updateColumnOptions := &watsonxdatav2.UpdateColumnOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - TableID: core.StringPtr("testString"), - ColumnID: core.StringPtr("testString"), - Body: columnPatchModelAsPatch, + It(`GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptions *GetSalIntegrationEnrichmentAssetsByIdOptions)`, func() { + getSalIntegrationEnrichmentAssetsByIdOptions := &watsonxdatav3.GetSalIntegrationEnrichmentAssetsByIdOptions{ + ProjectID: core.StringPtr("testString"), + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - column, response, err := watsonxDataService.UpdateColumn(updateColumnOptions) + salEnrichmentDataAsset, response, err := watsonxDataService.GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(column).ToNot(BeNil()) + Expect(salEnrichmentDataAsset).ToNot(BeNil()) }) }) - Describe(`ListTableSnapshots - Get table snapshots`, func() { + Describe(`GetSalIntegrationEnrichmentGlobalSettings - Get metadata enrichment global settings`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListTableSnapshots(listTableSnapshotsOptions *ListTableSnapshotsOptions)`, func() { - listTableSnapshotsOptions := &watsonxdatav2.ListTableSnapshotsOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - TableID: core.StringPtr("testString"), + It(`GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptions *GetSalIntegrationEnrichmentGlobalSettingsOptions)`, func() { + getSalIntegrationEnrichmentGlobalSettingsOptions := &watsonxdatav3.GetSalIntegrationEnrichmentGlobalSettingsOptions{ AuthInstanceID: core.StringPtr("testString"), } - tableSnapshotCollection, response, err := watsonxDataService.ListTableSnapshots(listTableSnapshotsOptions) + salEnrichmentSettings, response, err := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(tableSnapshotCollection).ToNot(BeNil()) + Expect(salEnrichmentSettings).ToNot(BeNil()) }) }) - Describe(`RollbackTable - Rollback table to snapshot`, func() { + Describe(`ReplaceSalIntegrationEnrichmentGlobalSettings - Create or update metadata enrichment global settings`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`RollbackTable(rollbackTableOptions *RollbackTableOptions)`, func() { - rollbackTableOptions := &watsonxdatav2.RollbackTableOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - TableID: core.StringPtr("testString"), - SnapshotID: core.StringPtr("testString"), + It(`ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptions *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions)`, func() { + salEnrichmentSettingsExpansionDescriptionConfigurationModel := &watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration{ + AssignmentThreshold: core.Float64Ptr(float64(0.14)), + SuggestionThreshold: core.Float64Ptr(float64(0.9)), + } + + salEnrichmentSettingsExpansionNameConfigurationModel := &watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration{ + AssignmentThreshold: core.Float64Ptr(float64(0.1)), + SuggestionThreshold: core.Float64Ptr(float64(0.1)), + } + + salEnrichmentSettingsExpansionModel := &watsonxdatav3.SalEnrichmentSettingsExpansion{ + Description: core.BoolPtr(true), + DescriptionConfiguration: salEnrichmentSettingsExpansionDescriptionConfigurationModel, + Name: core.BoolPtr(true), + NameConfiguration: salEnrichmentSettingsExpansionNameConfigurationModel, + } + + salEnrichmentSettingsTermAssignmentModel := &watsonxdatav3.SalEnrichmentSettingsTermAssignment{ + ClassBasedAssignments: core.BoolPtr(false), + EvaluateNegativeAssignments: core.BoolPtr(false), + LlmBasedAssignments: core.BoolPtr(false), + MlBasedAssignmentsCustom: core.BoolPtr(false), + MlBasedAssignmentsDefault: core.BoolPtr(false), + NameMatching: core.BoolPtr(false), + TermAssignmentThreshold: core.Float64Ptr(float64(0.3)), + TermSuggestionThreshold: core.Float64Ptr(float64(0.4)), + } + + replaceSalIntegrationEnrichmentGlobalSettingsOptions := &watsonxdatav3.ReplaceSalIntegrationEnrichmentGlobalSettingsOptions{ + Expansion: salEnrichmentSettingsExpansionModel, + TermAssignment: salEnrichmentSettingsTermAssignmentModel, AuthInstanceID: core.StringPtr("testString"), } - replaceSnapshotCreatedBody, response, err := watsonxDataService.RollbackTable(rollbackTableOptions) + salEnrichmentSettings, response, err := watsonxDataService.ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(replaceSnapshotCreatedBody).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(salEnrichmentSettings).ToNot(BeNil()) }) }) - Describe(`UpdateSyncCatalog - External Iceberg table registration`, func() { + Describe(`ListSalIntegrationEnrichmentJobs - List semantic enrichment jobs associated with the schema`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`UpdateSyncCatalog(updateSyncCatalogOptions *UpdateSyncCatalogOptions)`, func() { - syncCatalogsModel := &watsonxdatav2.SyncCatalogs{ - AutoAddNewTables: core.BoolPtr(true), - SyncIcebergMd: core.BoolPtr(true), - } - syncCatalogsModelAsPatch, asPatchErr := syncCatalogsModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - updateSyncCatalogOptions := &watsonxdatav2.UpdateSyncCatalogOptions{ - CatalogID: core.StringPtr("testString"), - Body: syncCatalogsModelAsPatch, + It(`ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptions *ListSalIntegrationEnrichmentJobsOptions)`, func() { + listSalIntegrationEnrichmentJobsOptions := &watsonxdatav3.ListSalIntegrationEnrichmentJobsOptions{ + ProjectID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - updateSyncCatalogOkBody, response, err := watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptions) + salEnrichmentJobs, response, err := watsonxDataService.ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(updateSyncCatalogOkBody).ToNot(BeNil()) + Expect(salEnrichmentJobs).ToNot(BeNil()) }) }) - Describe(`ListMilvusServices - Get list of milvus services`, func() { + Describe(`ListSalIntegrationEnrichmentJobRuns - List semantic enrichment job runs associated with the schema`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListMilvusServices(listMilvusServicesOptions *ListMilvusServicesOptions)`, func() { - listMilvusServicesOptions := &watsonxdatav2.ListMilvusServicesOptions{ + It(`ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptions *ListSalIntegrationEnrichmentJobRunsOptions)`, func() { + listSalIntegrationEnrichmentJobRunsOptions := &watsonxdatav3.ListSalIntegrationEnrichmentJobRunsOptions{ + JobID: core.StringPtr("testString"), + ProjectID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - milvusServiceCollection, response, err := watsonxDataService.ListMilvusServices(listMilvusServicesOptions) + salEnrichmentJobRuns, response, err := watsonxDataService.ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(milvusServiceCollection).ToNot(BeNil()) + Expect(salEnrichmentJobRuns).ToNot(BeNil()) }) }) - Describe(`CreateMilvusService - Create milvus service`, func() { + Describe(`GetSalIntegrationEnrichmentJobRunLogs - Get semantic enrichment job run logs associated with the job run`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateMilvusService(createMilvusServiceOptions *CreateMilvusServiceOptions)`, func() { - createMilvusServiceOptions := &watsonxdatav2.CreateMilvusServiceOptions{ - BucketName: core.StringPtr("Sample bucket name"), - Origin: core.StringPtr("native"), - RootPath: core.StringPtr("Sample path"), - ServiceDisplayName: core.StringPtr("sampleService"), - BucketType: core.StringPtr("Sample bucket type"), - Description: core.StringPtr("milvus service for running sql queries"), - Tags: []string{"tag1", "tag2"}, - TshirtSize: core.StringPtr("small"), + It(`GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptions *GetSalIntegrationEnrichmentJobRunLogsOptions)`, func() { + getSalIntegrationEnrichmentJobRunLogsOptions := &watsonxdatav3.GetSalIntegrationEnrichmentJobRunLogsOptions{ + JobID: core.StringPtr("testString"), + RunID: core.StringPtr("testString"), + ProjectID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - milvusService, response, err := watsonxDataService.CreateMilvusService(createMilvusServiceOptions) + salEnrichmentJobRunLogs, response, err := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(milvusService).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(salEnrichmentJobRunLogs).ToNot(BeNil()) }) }) - Describe(`GetMilvusService - Get milvus service`, func() { + Describe(`GetSalIntegrationEnrichmentProjectSettings - get metadata enrichment settings for a IBM Knowledge Catalog project(schema)`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetMilvusService(getMilvusServiceOptions *GetMilvusServiceOptions)`, func() { - getMilvusServiceOptions := &watsonxdatav2.GetMilvusServiceOptions{ - ServiceID: core.StringPtr("testString"), + It(`GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptions *GetSalIntegrationEnrichmentProjectSettingsOptions)`, func() { + getSalIntegrationEnrichmentProjectSettingsOptions := &watsonxdatav3.GetSalIntegrationEnrichmentProjectSettingsOptions{ + ProjectID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - milvusService, response, err := watsonxDataService.GetMilvusService(getMilvusServiceOptions) + salEnrichmentSettings, response, err := watsonxDataService.GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(milvusService).ToNot(BeNil()) + Expect(salEnrichmentSettings).ToNot(BeNil()) }) }) - Describe(`UpdateMilvusService - Update milvus service`, func() { + Describe(`ReplaceSalIntegrationEnrichmentProjectSettings - Create or update project level metadata enrichment settings`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`UpdateMilvusService(updateMilvusServiceOptions *UpdateMilvusServiceOptions)`, func() { - milvusServicePatchModel := &watsonxdatav2.MilvusServicePatch{ - Description: core.StringPtr("updated description for milvus service"), - ServiceDisplayName: core.StringPtr("sampleService"), - Tags: []string{"tag1", "tag2"}, + It(`ReplaceSalIntegrationEnrichmentProjectSettings(replaceSalIntegrationEnrichmentProjectSettingsOptions *ReplaceSalIntegrationEnrichmentProjectSettingsOptions)`, func() { + salEnrichmentSettingsExpansionDescriptionConfigurationModel := &watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration{ + AssignmentThreshold: core.Float64Ptr(float64(0.14)), + SuggestionThreshold: core.Float64Ptr(float64(0.9)), } - milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - updateMilvusServiceOptions := &watsonxdatav2.UpdateMilvusServiceOptions{ - ServiceID: core.StringPtr("testString"), - Body: milvusServicePatchModelAsPatch, + salEnrichmentSettingsExpansionNameConfigurationModel := &watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration{ + AssignmentThreshold: core.Float64Ptr(float64(0.1)), + SuggestionThreshold: core.Float64Ptr(float64(0.1)), + } + + salEnrichmentSettingsExpansionModel := &watsonxdatav3.SalEnrichmentSettingsExpansion{ + Description: core.BoolPtr(true), + DescriptionConfiguration: salEnrichmentSettingsExpansionDescriptionConfigurationModel, + Name: core.BoolPtr(true), + NameConfiguration: salEnrichmentSettingsExpansionNameConfigurationModel, + } + + salEnrichmentSettingsTermAssignmentModel := &watsonxdatav3.SalEnrichmentSettingsTermAssignment{ + ClassBasedAssignments: core.BoolPtr(false), + EvaluateNegativeAssignments: core.BoolPtr(false), + LlmBasedAssignments: core.BoolPtr(false), + MlBasedAssignmentsCustom: core.BoolPtr(false), + MlBasedAssignmentsDefault: core.BoolPtr(false), + NameMatching: core.BoolPtr(false), + TermAssignmentThreshold: core.Float64Ptr(float64(0.3)), + TermSuggestionThreshold: core.Float64Ptr(float64(0.4)), + } + + replaceSalIntegrationEnrichmentProjectSettingsOptions := &watsonxdatav3.ReplaceSalIntegrationEnrichmentProjectSettingsOptions{ + ProjectID: core.StringPtr("testString"), + Expansion: salEnrichmentSettingsExpansionModel, + TermAssignment: salEnrichmentSettingsTermAssignmentModel, AuthInstanceID: core.StringPtr("testString"), } - milvusService, response, err := watsonxDataService.UpdateMilvusService(updateMilvusServiceOptions) + response, err := watsonxDataService.ReplaceSalIntegrationEnrichmentProjectSettings(replaceSalIntegrationEnrichmentProjectSettingsOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(milvusService).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(202)) }) }) - Describe(`UpdateMilvusServiceBucket - Update milvus service bucket`, func() { + Describe(`GetSalIntegrationGlossaryTerms - Get list of uploaded glossary terms`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`UpdateMilvusServiceBucket(updateMilvusServiceBucketOptions *UpdateMilvusServiceBucketOptions)`, func() { - milvusServiceBucketPatchModel := &watsonxdatav2.MilvusServiceBucketPatch{ - BucketName: core.StringPtr("Sample bucket name"), - ManagedBy: core.StringPtr("customer"), - RootPath: core.StringPtr("Sample path"), - TshirtSize: core.StringPtr("small"), - } - milvusServiceBucketPatchModelAsPatch, asPatchErr := milvusServiceBucketPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - updateMilvusServiceBucketOptions := &watsonxdatav2.UpdateMilvusServiceBucketOptions{ - ServiceID: core.StringPtr("testString"), - Body: milvusServiceBucketPatchModelAsPatch, + It(`GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptions *GetSalIntegrationGlossaryTermsOptions)`, func() { + getSalIntegrationGlossaryTermsOptions := &watsonxdatav3.GetSalIntegrationGlossaryTermsOptions{ AuthInstanceID: core.StringPtr("testString"), } - milvusService, response, err := watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptions) + salGlossaryTerms, response, err := watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(milvusService).ToNot(BeNil()) + Expect(salGlossaryTerms).ToNot(BeNil()) }) }) - Describe(`ListMilvusServiceDatabases - Get milvus service databases`, func() { + Describe(`CreateSalIntegrationUploadGlossary - Upload semantic enrichment business terms glossary`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListMilvusServiceDatabases(listMilvusServiceDatabasesOptions *ListMilvusServiceDatabasesOptions)`, func() { - listMilvusServiceDatabasesOptions := &watsonxdatav2.ListMilvusServiceDatabasesOptions{ - ServiceID: core.StringPtr("testString"), + It(`CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptions *CreateSalIntegrationUploadGlossaryOptions)`, func() { + createSalIntegrationUploadGlossaryOptions := &watsonxdatav3.CreateSalIntegrationUploadGlossaryOptions{ + ReplaceOption: core.StringPtr("all"), + GlossaryCsv: CreateMockReader("This is a mock file."), + GlossaryCsvContentType: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - milvusServiceDatabases, response, err := watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptions) + salGlossaryUploadProcess, response, err := watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(milvusServiceDatabases).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(salGlossaryUploadProcess).ToNot(BeNil()) }) }) - Describe(`ListMilvusDatabaseCollections - Get milvus database collections`, func() { + Describe(`GetSalIntegrationUploadGlossaryStatus - Get status of glossary uploading process(job)`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptions *ListMilvusDatabaseCollectionsOptions)`, func() { - listMilvusDatabaseCollectionsOptions := &watsonxdatav2.ListMilvusDatabaseCollectionsOptions{ - ServiceID: core.StringPtr("testString"), - DatabaseID: core.StringPtr("testString"), + It(`GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptions *GetSalIntegrationUploadGlossaryStatusOptions)`, func() { + getSalIntegrationUploadGlossaryStatusOptions := &watsonxdatav3.GetSalIntegrationUploadGlossaryStatusOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - milvusDatabaseCollections, response, err := watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptions) + salGlossaryUploadStatus, response, err := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(milvusDatabaseCollections).ToNot(BeNil()) + Expect(salGlossaryUploadStatus).ToNot(BeNil()) }) }) - Describe(`CreateMilvusServicePause - Pause milvus service`, func() { + Describe(`ListSalIntegrationEnrichmentMappings - Post watsonx.data schema to fetch mapped catalog and project`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateMilvusServicePause(createMilvusServicePauseOptions *CreateMilvusServicePauseOptions)`, func() { - createMilvusServicePauseOptions := &watsonxdatav2.CreateMilvusServicePauseOptions{ - ServiceID: core.StringPtr("testString"), + It(`ListSalIntegrationEnrichmentMappings(listSalIntegrationEnrichmentMappingsOptions *ListSalIntegrationEnrichmentMappingsOptions)`, func() { + listSalIntegrationEnrichmentMappingsOptions := &watsonxdatav3.ListSalIntegrationEnrichmentMappingsOptions{ + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), + Next: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - successResponse, response, err := watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptions) + salIntegrationMappings, response, err := watsonxDataService.ListSalIntegrationEnrichmentMappings(listSalIntegrationEnrichmentMappingsOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(successResponse).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(salIntegrationMappings).ToNot(BeNil()) }) }) - Describe(`CreateMilvusServiceResume - Resume milvus service`, func() { + Describe(`ListSemanticSearchQueries - List Semantic Search queries snapshot`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateMilvusServiceResume(createMilvusServiceResumeOptions *CreateMilvusServiceResumeOptions)`, func() { - createMilvusServiceResumeOptions := &watsonxdatav2.CreateMilvusServiceResumeOptions{ - ServiceID: core.StringPtr("testString"), + It(`ListSemanticSearchQueries(listSemanticSearchQueriesOptions *ListSemanticSearchQueriesOptions)`, func() { + listSemanticSearchQueriesOptions := &watsonxdatav3.ListSemanticSearchQueriesOptions{ + EngineID: core.StringPtr("testString"), + SchemaSearchEnabled: core.BoolPtr(true), + ColumnSearchEnabled: core.BoolPtr(true), + MaxResultNumber: core.Int64Ptr(int64(5)), + RunSearch: core.BoolPtr(true), AuthInstanceID: core.StringPtr("testString"), } - successResponse, response, err := watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptions) + semanticSearchList, response, err := watsonxDataService.ListSemanticSearchQueries(listSemanticSearchQueriesOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(successResponse).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(semanticSearchList).ToNot(BeNil()) }) }) - Describe(`CreateMilvusServiceScale - Scale a milvus service`, func() { + Describe(`CreateSemanticSearchQueries - Trigger a global search among IBM Knowledge Catalog metadata by given query`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateMilvusServiceScale(createMilvusServiceScaleOptions *CreateMilvusServiceScaleOptions)`, func() { - createMilvusServiceScaleOptions := &watsonxdatav2.CreateMilvusServiceScaleOptions{ - ServiceID: core.StringPtr("testString"), - TshirtSize: core.StringPtr("small"), + It(`CreateSemanticSearchQueries(createSemanticSearchQueriesOptions *CreateSemanticSearchQueriesOptions)`, func() { + semanticSearchBodySearchConfigModel := &watsonxdatav3.SemanticSearchBodySearchConfig{ + ColumnSearchEnabled: core.BoolPtr(true), + Fields: []string{"metadata.name", "metadata.description", "metadata.tags"}, + MaxResultNumber: core.Int64Ptr(int64(1)), + SchemaSearchEnabled: core.BoolPtr(true), + } + + createSemanticSearchQueriesOptions := &watsonxdatav3.CreateSemanticSearchQueriesOptions{ + EngineID: core.StringPtr("presto01"), + QueryInput: core.StringPtr("catalog_table"), + SearchConfig: semanticSearchBodySearchConfigModel, AuthInstanceID: core.StringPtr("testString"), } - successResponse, response, err := watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptions) + semanticSearch, response, err := watsonxDataService.CreateSemanticSearchQueries(createSemanticSearchQueriesOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(201)) - Expect(successResponse).ToNot(BeNil()) + Expect(semanticSearch).ToNot(BeNil()) }) }) - Describe(`ListIngestionJobs - Get ingestion jobs`, func() { + Describe(`ListIngestionJobs - List ingestion jobs`, func() { BeforeEach(func() { shouldSkipTest() }) It(`ListIngestionJobs(listIngestionJobsOptions *ListIngestionJobsOptions) with pagination`, func(){ - listIngestionJobsOptions := &watsonxdatav2.ListIngestionJobsOptions{ + listIngestionJobsOptions := &watsonxdatav3.ListIngestionJobsOptions{ AuthInstanceID: core.StringPtr("testString"), - Start: core.StringPtr("1"), - JobsPerPage: core.Int64Ptr(int64(1)), + Start: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), } listIngestionJobsOptions.Start = nil + listIngestionJobsOptions.Limit = core.Int64Ptr(1) - var allResults []watsonxdatav2.IngestionJob + var allResults []watsonxdatav3.IngestionJob for { ingestionJobCollection, response, err := watsonxDataService.ListIngestionJobs(listIngestionJobsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) Expect(ingestionJobCollection).ToNot(BeNil()) - allResults = append(allResults, ingestionJobCollection.IngestionJobs...) + allResults = append(allResults, ingestionJobCollection.Jobs...) listIngestionJobsOptions.Start, err = ingestionJobCollection.GetNextStart() Expect(err).To(BeNil()) @@ -2837,9 +3204,9 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { fmt.Fprintf(GinkgoWriter, "Retrieved a total of %d item(s) with pagination.\n", len(allResults)) }) It(`ListIngestionJobs(listIngestionJobsOptions *ListIngestionJobsOptions) using IngestionJobsPager`, func(){ - listIngestionJobsOptions := &watsonxdatav2.ListIngestionJobsOptions{ + listIngestionJobsOptions := &watsonxdatav3.ListIngestionJobsOptions{ AuthInstanceID: core.StringPtr("testString"), - JobsPerPage: core.Int64Ptr(int64(1)), + Limit: core.Int64Ptr(int64(10)), } // Test GetNext(). @@ -2847,7 +3214,7 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { Expect(err).To(BeNil()) Expect(pager).ToNot(BeNil()) - var allResults []watsonxdatav2.IngestionJob + var allResults []watsonxdatav3.IngestionJob for pager.HasNext() { nextPage, err := pager.GetNext() Expect(err).To(BeNil()) @@ -2864,348 +3231,557 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { Expect(err).To(BeNil()) Expect(allItems).ToNot(BeNil()) - Expect(len(allItems)).To(Equal(len(allResults))) - fmt.Fprintf(GinkgoWriter, "ListIngestionJobs() returned a total of %d item(s) using IngestionJobsPager.\n", len(allResults)) + Expect(len(allItems)).To(Equal(len(allResults))) + fmt.Fprintf(GinkgoWriter, "ListIngestionJobs() returned a total of %d item(s) using IngestionJobsPager.\n", len(allResults)) + }) + }) + + Describe(`CreateIngestionJob - Submit ingestion job`, func() { + BeforeEach(func() { + shouldSkipTest() + }) + It(`CreateIngestionJob(createIngestionJobOptions *CreateIngestionJobOptions)`, func() { + schemaTransformationModel := &watsonxdatav3.SchemaTransformation{ + OldColumn: core.StringPtr("old_column_name"), + NewColumn: core.StringPtr("new_column_name"), + NewType: core.StringPtr("string"), + } + + bucketDetailsModel := &watsonxdatav3.BucketDetails{ + AccessKey: core.StringPtr("testString"), + AccountName: core.StringPtr("testString"), + ApplicationID: core.StringPtr("testString"), + ContainerName: core.StringPtr("testString"), + DirectoryID: core.StringPtr("testString"), + Endpoint: core.StringPtr("testString"), + Region: core.StringPtr("testString"), + SecretKey: core.StringPtr("testString"), + AuthMode: core.StringPtr("aws_assume_role"), + RoleArn: core.StringPtr("testString"), + ManagedBy: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Type: core.StringPtr("adls_gen1"), + } + + icebergSourceTableModel := &watsonxdatav3.IcebergSourceTable{ + SchemaName: core.StringPtr("testString"), + TableName: core.StringPtr("testString"), + CatalogName: core.StringPtr("testString"), + WarehouseName: core.StringPtr("testString"), + SnapshotID: core.Int64Ptr(int64(0)), + } + + dbConnectionModelModel := &watsonxdatav3.DbConnectionModel{ + DatabaseID: core.StringPtr("testString"), + DbType: core.StringPtr("testString"), + Host: core.StringPtr("testString"), + Port: core.StringPtr("testString"), + DbName: core.StringPtr("testString"), + DbUsername: core.StringPtr("testString"), + Password: core.StringPtr("testString"), + AuthenticationValue: core.StringPtr("testString"), + IsSsl: core.BoolPtr(false), + CertExtension: core.StringPtr("testString"), + CertContent: core.StringPtr("testString"), + ConnectionMode: core.StringPtr("testString"), + ConnectionModeValue: core.StringPtr("testString"), + JdbcURL: core.StringPtr("testString"), + } + + fileFormatPropertiesModel := &watsonxdatav3.FileFormatProperties{ + Encoding: core.StringPtr("testString"), + EscapeCharacter: core.StringPtr("testString"), + FieldDelimiter: core.StringPtr("testString"), + Header: core.BoolPtr(true), + LineDelimiter: core.StringPtr("testString"), + } + + sourceDetailsModel := &watsonxdatav3.SourceDetails{ + FilePaths: core.StringPtr("testString"), + FileType: core.StringPtr("csv"), + SourceType: core.StringPtr("STORAGE"), + SchemaTransformations: []watsonxdatav3.SchemaTransformation{*schemaTransformationModel}, + SchemaName: core.StringPtr("testString"), + TableName: core.StringPtr("testString"), + BucketDetails: bucketDetailsModel, + IcebergSourceTable: icebergSourceTableModel, + SourceDatabase: dbConnectionModelModel, + FileFormatProperties: fileFormatPropertiesModel, + IsLocalIngestion: core.BoolPtr(false), + } + + targetDetailsModel := &watsonxdatav3.TargetDetails{ + Catalog: core.StringPtr("testString"), + Schema: core.StringPtr("testString"), + Table: core.StringPtr("testString"), + WriteMode: core.StringPtr("testString"), + MergeOnRead: core.BoolPtr(false), + SchemaMode: core.StringPtr("testString"), + SchemaInfer: core.BoolPtr(true), + CatalogURI: core.StringPtr("testString"), + BucketDetails: bucketDetailsModel, + Location: core.StringPtr("testString"), + IsNewSchema: core.BoolPtr(false), + IsNewTable: core.BoolPtr(false), + } + + executeConfigModel := &watsonxdatav3.ExecuteConfig{ + DriverMemory: core.StringPtr("testString"), + DriverCores: core.Int64Ptr(int64(1)), + ExecutorMemory: core.StringPtr("testString"), + ExecutorCores: core.Int64Ptr(int64(1)), + NumExecutors: core.Int64Ptr(int64(1)), + } + + ingestionEngineModel := &watsonxdatav3.IngestionEngine{ + EngineID: core.StringPtr("testString"), + Name: core.StringPtr("testString"), + Endpoint: core.StringPtr("testString"), + Origin: core.StringPtr("testString"), + ExecuteConfig: executeConfigModel, + BucketDetails: bucketDetailsModel, + LogPath: core.StringPtr("testString"), + } + + capacityDetailsModel := &watsonxdatav3.CapacityDetails{ + ID: CreateMockUUID("6f51248a-4cda-459a-b141-eb9b76bb6689"), + } + + createIngestionJobOptions := &watsonxdatav3.CreateIngestionJobOptions{ + AuthInstanceID: core.StringPtr("testString"), + ID: core.StringPtr("testString"), + Source: sourceDetailsModel, + Target: targetDetailsModel, + Engine: ingestionEngineModel, + EngineID: core.StringPtr("spark123"), + ExecuteConfig: executeConfigModel, + SourceIcebergTable: icebergSourceTableModel, + PartitionBy: core.StringPtr("column1,column2"), + Capacity: capacityDetailsModel, + } + + ingestionJob, response, err := watsonxDataService.CreateIngestionJob(createIngestionJobOptions) + Expect(err).To(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(ingestionJob).ToNot(BeNil()) }) }) - Describe(`CreateIngestionJobs - Create an ingestion job`, func() { + Describe(`GetIngestionJob - Get ingestion job by ID`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateIngestionJobs(createIngestionJobsOptions *CreateIngestionJobsOptions)`, func() { - ingestionJobPrototypeCsvPropertyModel := &watsonxdatav2.IngestionJobPrototypeCsvProperty{ - Encoding: core.StringPtr("utf-8"), - EscapeCharacter: core.StringPtr("\\\\"), - FieldDelimiter: core.StringPtr(","), - Header: core.BoolPtr(true), - LineDelimiter: core.StringPtr("\\n"), - } - - ingestionJobPrototypeExecuteConfigModel := &watsonxdatav2.IngestionJobPrototypeExecuteConfig{ - DriverCores: core.Int64Ptr(int64(1)), - DriverMemory: core.StringPtr("2G"), - ExecutorCores: core.Int64Ptr(int64(1)), - ExecutorMemory: core.StringPtr("2G"), - NumExecutors: core.Int64Ptr(int64(1)), - } - - createIngestionJobsOptions := &watsonxdatav2.CreateIngestionJobsOptions{ + It(`GetIngestionJob(getIngestionJobOptions *GetIngestionJobOptions)`, func() { + getIngestionJobOptions := &watsonxdatav3.GetIngestionJobOptions{ AuthInstanceID: core.StringPtr("testString"), - JobID: core.StringPtr("ingestion-1699459946935"), - SourceDataFiles: core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet"), - TargetTable: core.StringPtr("demodb.test.targettable"), - Username: core.StringPtr("user1"), - CreateIfNotExist: core.BoolPtr(false), - CsvProperty: ingestionJobPrototypeCsvPropertyModel, - EngineID: core.StringPtr("spark123"), - ExecuteConfig: ingestionJobPrototypeExecuteConfigModel, - PartitionBy: core.StringPtr("col1, col2"), - Schema: core.StringPtr("{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}"), - SourceFileType: core.StringPtr("csv"), - ValidateCsvHeader: core.BoolPtr(false), + ID: core.StringPtr("testString"), } - ingestionJob, response, err := watsonxDataService.CreateIngestionJobs(createIngestionJobsOptions) + ingestionJob, response, err := watsonxDataService.GetIngestionJob(getIngestionJobOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) + Expect(response.StatusCode).To(Equal(200)) Expect(ingestionJob).ToNot(BeNil()) }) }) - Describe(`CreateIngestionJobsLocalFiles - Create an ingestion job for user local files`, func() { + Describe(`ListResourceAccessPolicies - List Resource Access Policies`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptions *CreateIngestionJobsLocalFilesOptions)`, func() { - createIngestionJobsLocalFilesOptions := &watsonxdatav2.CreateIngestionJobsLocalFilesOptions{ + It(`ListResourceAccessPolicies(listResourceAccessPoliciesOptions *ListResourceAccessPoliciesOptions)`, func() { + listResourceAccessPoliciesOptions := &watsonxdatav3.ListResourceAccessPoliciesOptions{ AuthInstanceID: core.StringPtr("testString"), - SourceDataFile: CreateMockReader("This is a mock file."), - TargetTable: core.StringPtr("testString"), - JobID: core.StringPtr("testString"), - Username: core.StringPtr("testString"), - SourceDataFileContentType: core.StringPtr("testString"), - SourceFileType: core.StringPtr("csv"), - CsvProperty: core.StringPtr("testString"), - CreateIfNotExist: core.BoolPtr(false), - ValidateCsvHeader: core.BoolPtr(false), - ExecuteConfig: core.StringPtr("testString"), - EngineID: core.StringPtr("testString"), + ResourceType: core.StringPtr("catalog"), + ResourceID: []string{"testString"}, + ResourceName: []string{"testString"}, } - ingestionJob, response, err := watsonxDataService.CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptions) + accessPolicies, response, err := watsonxDataService.ListResourceAccessPolicies(listResourceAccessPoliciesOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(202)) - Expect(ingestionJob).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(accessPolicies).ToNot(BeNil()) }) }) - Describe(`GetIngestionJob - Get ingestion job`, func() { + Describe(`BulkUpdateResourceAccessPolicies - Bulk Update Resource Access Policies`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetIngestionJob(getIngestionJobOptions *GetIngestionJobOptions)`, func() { - getIngestionJobOptions := &watsonxdatav2.GetIngestionJobOptions{ - JobID: core.StringPtr("testString"), + It(`BulkUpdateResourceAccessPolicies(bulkUpdateResourceAccessPoliciesOptions *BulkUpdateResourceAccessPoliciesOptions)`, func() { + resourceDetailsBulkUpdateModel := &watsonxdatav3.ResourceDetailsBulkUpdate{ + ID: core.StringPtr("presto01"), + Name: core.StringPtr("hive_data"), + Type: core.StringPtr("presto"), + } + + subjectModel := &watsonxdatav3.Subject{ + Type: core.StringPtr("user"), + Value: core.StringPtr("user1"), + } + + subjectBulkUpdateModel := &watsonxdatav3.SubjectBulkUpdate{ + Permissions: []string{"testString"}, + Subject: subjectModel, + } + + accessPolicyBulkUpdateModel := &watsonxdatav3.AccessPolicyBulkUpdate{ + Resources: []watsonxdatav3.ResourceDetailsBulkUpdate{*resourceDetailsBulkUpdateModel}, + Subjects: []watsonxdatav3.SubjectBulkUpdate{*subjectBulkUpdateModel}, + } + + bulkUpdateResourceAccessPoliciesOptions := &watsonxdatav3.BulkUpdateResourceAccessPoliciesOptions{ + AccessPolicies: []watsonxdatav3.AccessPolicyBulkUpdate{*accessPolicyBulkUpdateModel}, AuthInstanceID: core.StringPtr("testString"), } - ingestionJob, response, err := watsonxDataService.GetIngestionJob(getIngestionJobOptions) + accessPolicyBulkUpdateResponse, response, err := watsonxDataService.BulkUpdateResourceAccessPolicies(bulkUpdateResourceAccessPoliciesOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(ingestionJob).ToNot(BeNil()) + Expect(accessPolicyBulkUpdateResponse).ToNot(BeNil()) }) }) - Describe(`CreatePreviewIngestionFile - Generate a preview of source file(s)`, func() { + Describe(`RevokeResourceAccessPolicies - Revoke Resource Access Policies`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`CreatePreviewIngestionFile(createPreviewIngestionFileOptions *CreatePreviewIngestionFileOptions)`, func() { - previewIngestionFilePrototypeCsvPropertyModel := &watsonxdatav2.PreviewIngestionFilePrototypeCsvProperty{ - Encoding: core.StringPtr("utf-8"), - EscapeCharacter: core.StringPtr("\\\\"), - FieldDelimiter: core.StringPtr(","), - Header: core.BoolPtr(true), - LineDelimiter: core.StringPtr("\\n"), + It(`RevokeResourceAccessPolicies(revokeResourceAccessPoliciesOptions *RevokeResourceAccessPoliciesOptions)`, func() { + resourceDetailsModel := &watsonxdatav3.ResourceDetails{ + ID: core.StringPtr("presto01"), + Name: core.StringPtr("hive_data"), + Type: core.StringPtr("presto"), + } + + subjectModel := &watsonxdatav3.Subject{ + Type: core.StringPtr("user"), + Value: core.StringPtr("user1"), + } + + subjectRevokeModel := &watsonxdatav3.SubjectRevoke{ + Permissions: []string{"testString"}, + Subject: subjectModel, } - createPreviewIngestionFileOptions := &watsonxdatav2.CreatePreviewIngestionFileOptions{ + revokeResourceAccessPoliciesOptions := &watsonxdatav3.RevokeResourceAccessPoliciesOptions{ + Resources: []watsonxdatav3.ResourceDetails{*resourceDetailsModel}, + Subjects: []watsonxdatav3.SubjectRevoke{*subjectRevokeModel}, AuthInstanceID: core.StringPtr("testString"), - SourceDataFiles: core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet"), - CsvProperty: previewIngestionFilePrototypeCsvPropertyModel, - SourceFileType: core.StringPtr("csv"), } - previewIngestionFile, response, err := watsonxDataService.CreatePreviewIngestionFile(createPreviewIngestionFileOptions) + response, err := watsonxDataService.RevokeResourceAccessPolicies(revokeResourceAccessPoliciesOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(previewIngestionFile).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`GetEndpoints - Get CPG and DAS endpoints`, func() { + Describe(`FilterResourceAccessPoliciesOnUsersAndUsergroups - Filter Resource Access Policies On Users And User Groups`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetEndpoints(getEndpointsOptions *GetEndpointsOptions)`, func() { - getEndpointsOptions := &watsonxdatav2.GetEndpointsOptions{ + It(`FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptions *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions)`, func() { + resourceDetailsModel := &watsonxdatav3.ResourceDetails{ + ID: core.StringPtr("presto01"), + Name: core.StringPtr("hive_data"), + Type: core.StringPtr("presto"), + } + + subjectModel := &watsonxdatav3.Subject{ + Type: core.StringPtr("user"), + Value: core.StringPtr("user1"), + } + + accessPoliciesSearchModel := &watsonxdatav3.AccessPoliciesSearch{ + Resources: []watsonxdatav3.ResourceDetails{*resourceDetailsModel}, + SubjectsToSearch: []watsonxdatav3.Subject{*subjectModel}, + } + + filterResourceAccessPoliciesOnUsersAndUsergroupsOptions := &watsonxdatav3.FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions{ + AccessPoliciesSearch: []watsonxdatav3.AccessPoliciesSearch{*accessPoliciesSearchModel}, AuthInstanceID: core.StringPtr("testString"), } - endpointCollection, response, err := watsonxDataService.GetEndpoints(getEndpointsOptions) + accessPolicies, response, err := watsonxDataService.FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(endpointCollection).ToNot(BeNil()) + Expect(accessPolicies).ToNot(BeNil()) }) }) - Describe(`RegisterTable - Register table`, func() { + Describe(`ListDataPolicies - List data policies`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`RegisterTable(registerTableOptions *RegisterTableOptions)`, func() { - registerTableOptions := &watsonxdatav2.RegisterTableOptions{ - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - MetadataLocation: core.StringPtr("s3a://bucketname/path/to/table/metadata_location/_delta_log"), - TableName: core.StringPtr("table1"), + It(`ListDataPolicies(listDataPoliciesOptions *ListDataPoliciesOptions)`, func() { + listDataPoliciesOptions := &watsonxdatav3.ListDataPoliciesOptions{ AuthInstanceID: core.StringPtr("testString"), + CatalogName: core.StringPtr("testString"), + ResourceID: core.StringPtr("testString"), + Status: core.StringPtr("testString"), + IncludeMetadata: core.BoolPtr(true), + IncludeRules: core.BoolPtr(true), + BucketName: core.StringPtr("testString"), + ServiceName: core.StringPtr("testString"), + DataArtifact: core.StringPtr("testString"), } - registerTableCreatedBody, response, err := watsonxDataService.RegisterTable(registerTableOptions) + policyV2Collection, response, err := watsonxDataService.ListDataPolicies(listDataPoliciesOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(201)) - Expect(registerTableCreatedBody).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(200)) + Expect(policyV2Collection).ToNot(BeNil()) }) }) - Describe(`LoadTable - Load table metadata`, func() { + Describe(`CreateDataPolicy - Create a new data policy`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`LoadTable(loadTableOptions *LoadTableOptions)`, func() { - loadTableOptions := &watsonxdatav2.LoadTableOptions{ - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - TableID: core.StringPtr("testString"), + It(`CreateDataPolicy(createDataPolicyOptions *CreateDataPolicyOptions)`, func() { + ruleGranteeModel := &watsonxdatav3.RuleGrantee{ + Key: core.StringPtr("user_name"), + Type: core.StringPtr("user_identity"), + Value: core.StringPtr("user1"), + } + + transformColumnPropertiesModel := &watsonxdatav3.TransformColumnProperties{ + MaskCondition: core.StringPtr("NIL"), + MaskType: core.StringPtr("mask_show_last_4"), + MaskValue: core.StringPtr("NIL"), + } + + rowFilterPropertiesModel := &watsonxdatav3.RowFilterProperties{ + FilterCondition: core.StringPtr("NIL"), + RowFilter: core.StringPtr("addr_country='US'"), + } + + ruleV2Model := &watsonxdatav3.RuleV2{ + Actions: []string{"alter", "create"}, + Effect: core.StringPtr("allow"), + Grantees: []watsonxdatav3.RuleGrantee{*ruleGranteeModel}, + TransformColumns: transformColumnPropertiesModel, + TransformRows: rowFilterPropertiesModel, + } + + createDataPolicyOptions := &watsonxdatav3.CreateDataPolicyOptions{ + DataArtifact: core.StringPtr("schema1/table1/(column1|column2)"), + Rules: []watsonxdatav3.RuleV2{*ruleV2Model}, + CatalogName: core.StringPtr("catalog1"), + CatalogType: core.StringPtr("catalog1"), + Description: core.StringPtr("policy description"), + PolicyName: core.StringPtr("policy1"), + ResourceID: core.StringPtr("catalog1"), + Status: core.StringPtr("active"), AuthInstanceID: core.StringPtr("testString"), } - loadTableResponse, response, err := watsonxDataService.LoadTable(loadTableOptions) + policyV2, response, err := watsonxDataService.CreateDataPolicy(createDataPolicyOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(loadTableResponse).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(policyV2).ToNot(BeNil()) }) }) - Describe(`GetAllColumns - Get all columns`, func() { + Describe(`GetDataPolicy - Get data policy`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetAllColumns(getAllColumnsOptions *GetAllColumnsOptions)`, func() { - getAllColumnsOptions := &watsonxdatav2.GetAllColumnsOptions{ - TableName: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), - SchemaName: core.StringPtr("testString"), + It(`GetDataPolicy(getDataPolicyOptions *GetDataPolicyOptions)`, func() { + getDataPolicyOptions := &watsonxdatav3.GetDataPolicyOptions{ + Name: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - columnsResponse, response, err := watsonxDataService.GetAllColumns(getAllColumnsOptions) + policyV2, response, err := watsonxDataService.GetDataPolicy(getDataPolicyOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(columnsResponse).ToNot(BeNil()) + Expect(policyV2).ToNot(BeNil()) }) }) - Describe(`ListAllSchemas - Get all schemas for a given catalog`, func() { + Describe(`ReplaceDataPolicy - Replace data policy`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListAllSchemas(listAllSchemasOptions *ListAllSchemasOptions)`, func() { - listAllSchemasOptions := &watsonxdatav2.ListAllSchemasOptions{ - CatalogName: core.StringPtr("testString"), + It(`ReplaceDataPolicy(replaceDataPolicyOptions *ReplaceDataPolicyOptions)`, func() { + ruleGranteeModel := &watsonxdatav3.RuleGrantee{ + Key: core.StringPtr("user_name"), + Type: core.StringPtr("user_identity"), + Value: core.StringPtr("user1"), + } + + transformColumnPropertiesModel := &watsonxdatav3.TransformColumnProperties{ + MaskCondition: core.StringPtr("NIL"), + MaskType: core.StringPtr("mask_show_last_4"), + MaskValue: core.StringPtr("NIL"), + } + + rowFilterPropertiesModel := &watsonxdatav3.RowFilterProperties{ + FilterCondition: core.StringPtr("NIL"), + RowFilter: core.StringPtr("addr_country='US'"), + } + + ruleV2Model := &watsonxdatav3.RuleV2{ + Actions: []string{"alter", "create"}, + Effect: core.StringPtr("allow"), + Grantees: []watsonxdatav3.RuleGrantee{*ruleGranteeModel}, + TransformColumns: transformColumnPropertiesModel, + TransformRows: rowFilterPropertiesModel, + } + + replaceDataPolicyOptions := &watsonxdatav3.ReplaceDataPolicyOptions{ + Name: core.StringPtr("testString"), + DataArtifact: core.StringPtr("schema1/table1/(column1|column2)"), + Rules: []watsonxdatav3.RuleV2{*ruleV2Model}, + CatalogName: core.StringPtr("catalog1"), + CatalogType: core.StringPtr("catalog1"), + Description: core.StringPtr("policy description"), + PolicyName: core.StringPtr("policy1"), + ResourceID: core.StringPtr("catalog1"), + Status: core.StringPtr("active"), AuthInstanceID: core.StringPtr("testString"), } - schemaResponseCollection, response, err := watsonxDataService.ListAllSchemas(listAllSchemasOptions) + policyV2, response, err := watsonxDataService.ReplaceDataPolicy(replaceDataPolicyOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(schemaResponseCollection).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(201)) + Expect(policyV2).ToNot(BeNil()) }) }) - Describe(`GetSchemaDetails - Get schema details`, func() { + Describe(`UpdateDataPolicy - Update data policy`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetSchemaDetails(getSchemaDetailsOptions *GetSchemaDetailsOptions)`, func() { - getSchemaDetailsOptions := &watsonxdatav2.GetSchemaDetailsOptions{ - SchemaName: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), + It(`UpdateDataPolicy(updateDataPolicyOptions *UpdateDataPolicyOptions)`, func() { + jsonPatchOperationModel := &watsonxdatav3.JSONPatchOperation{ + Op: core.StringPtr("add"), + Path: core.StringPtr("testString"), + From: core.StringPtr("testString"), + Value: "testString", + } + + updateDataPolicyOptions := &watsonxdatav3.UpdateDataPolicyOptions{ + Name: core.StringPtr("testString"), + Body: []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel}, AuthInstanceID: core.StringPtr("testString"), } - schemaResponse, response, err := watsonxDataService.GetSchemaDetails(getSchemaDetailsOptions) + policyV2, response, err := watsonxDataService.UpdateDataPolicy(updateDataPolicyOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(200)) - Expect(schemaResponse).ToNot(BeNil()) + Expect(policyV2).ToNot(BeNil()) }) }) - Describe(`ListAllTables - Get all tables`, func() { + Describe(`DeleteStorageRegistration - Unregister Storage`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`ListAllTables(listAllTablesOptions *ListAllTablesOptions)`, func() { - listAllTablesOptions := &watsonxdatav2.ListAllTablesOptions{ - CatalogName: core.StringPtr("testString"), - SchemaName: core.StringPtr("testString"), + It(`DeleteStorageRegistration(deleteStorageRegistrationOptions *DeleteStorageRegistrationOptions)`, func() { + deleteStorageRegistrationOptions := &watsonxdatav3.DeleteStorageRegistrationOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), + SkipMdsCall: core.BoolPtr(false), } - tableResponseCollection, response, err := watsonxDataService.ListAllTables(listAllTablesOptions) + response, err := watsonxDataService.DeleteStorageRegistration(deleteStorageRegistrationOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(tableResponseCollection).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`GetTableDetails - Get table details`, func() { + Describe(`DeleteDatabaseCatalog - Delete database`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`GetTableDetails(getTableDetailsOptions *GetTableDetailsOptions)`, func() { - getTableDetailsOptions := &watsonxdatav2.GetTableDetailsOptions{ - TableName: core.StringPtr("testString"), - CatalogName: core.StringPtr("testString"), - SchemaName: core.StringPtr("testString"), + It(`DeleteDatabaseCatalog(deleteDatabaseCatalogOptions *DeleteDatabaseCatalogOptions)`, func() { + deleteDatabaseCatalogOptions := &watsonxdatav3.DeleteDatabaseCatalogOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - tableResponse, response, err := watsonxDataService.GetTableDetails(getTableDetailsOptions) + response, err := watsonxDataService.DeleteDatabaseCatalog(deleteDatabaseCatalogOptions) Expect(err).To(BeNil()) - Expect(response.StatusCode).To(Equal(200)) - Expect(tableResponse).ToNot(BeNil()) + Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteBucketRegistration - Deregister Bucket`, func() { + Describe(`DeletePrestoEngineCatalogs - Disassociate catalogs from a presto engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteBucketRegistration(deleteBucketRegistrationOptions *DeleteBucketRegistrationOptions)`, func() { - deleteBucketRegistrationOptions := &watsonxdatav2.DeleteBucketRegistrationOptions{ - BucketID: core.StringPtr("testString"), + It(`DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptions *DeletePrestoEngineCatalogsOptions)`, func() { + deletePrestoEngineCatalogsOptions := &watsonxdatav3.DeletePrestoEngineCatalogsOptions{ + EngineID: core.StringPtr("testString"), + CatalogNames: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteBucketRegistration(deleteBucketRegistrationOptions) + response, err := watsonxDataService.DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteDeactivateBucket - Deactivate Bucket`, func() { + Describe(`DeleteEngine - Delete presto engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteDeactivateBucket(deleteDeactivateBucketOptions *DeleteDeactivateBucketOptions)`, func() { - deleteDeactivateBucketOptions := &watsonxdatav2.DeleteDeactivateBucketOptions{ - BucketID: core.StringPtr("testString"), + It(`DeleteEngine(deleteEngineOptions *DeleteEngineOptions)`, func() { + deleteEngineOptions := &watsonxdatav3.DeleteEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteDeactivateBucket(deleteDeactivateBucketOptions) + response, err := watsonxDataService.DeleteEngine(deleteEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteDatabaseCatalog - Delete database`, func() { + Describe(`DeletePrestissimoEngine - Delete prestissimo engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteDatabaseCatalog(deleteDatabaseCatalogOptions *DeleteDatabaseCatalogOptions)`, func() { - deleteDatabaseCatalogOptions := &watsonxdatav2.DeleteDatabaseCatalogOptions{ - DatabaseID: core.StringPtr("testString"), + It(`DeletePrestissimoEngine(deletePrestissimoEngineOptions *DeletePrestissimoEngineOptions)`, func() { + deletePrestissimoEngineOptions := &watsonxdatav3.DeletePrestissimoEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteDatabaseCatalog(deleteDatabaseCatalogOptions) + response, err := watsonxDataService.DeletePrestissimoEngine(deletePrestissimoEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteDriverRegistration - Delete driver`, func() { + Describe(`DeletePrestissimoEngineCatalogs - Disassociate catalogs from a prestissimo engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteDriverRegistration(deleteDriverRegistrationOptions *DeleteDriverRegistrationOptions)`, func() { - deleteDriverRegistrationOptions := &watsonxdatav2.DeleteDriverRegistrationOptions{ - DriverID: core.StringPtr("testString"), + It(`DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptions *DeletePrestissimoEngineCatalogsOptions)`, func() { + deletePrestissimoEngineCatalogsOptions := &watsonxdatav3.DeletePrestissimoEngineCatalogsOptions{ + ID: core.StringPtr("testString"), + CatalogNames: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteDriverRegistration(deleteDriverRegistrationOptions) + response, err := watsonxDataService.DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteDriverEngines - Disassociate engines from driver`, func() { + Describe(`DeleteDb2Engine - Delete db2 engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteDriverEngines(deleteDriverEnginesOptions *DeleteDriverEnginesOptions)`, func() { - deleteDriverEnginesOptions := &watsonxdatav2.DeleteDriverEnginesOptions{ - DriverID: core.StringPtr("testString"), - EngineIds: core.StringPtr("testString"), + It(`DeleteDb2Engine(deleteDb2EngineOptions *DeleteDb2EngineOptions)`, func() { + deleteDb2EngineOptions := &watsonxdatav3.DeleteDb2EngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteDriverEngines(deleteDriverEnginesOptions) + response, err := watsonxDataService.DeleteDb2Engine(deleteDb2EngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) @@ -3216,8 +3792,8 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { shouldSkipTest() }) It(`DeleteOtherEngine(deleteOtherEngineOptions *DeleteOtherEngineOptions)`, func() { - deleteOtherEngineOptions := &watsonxdatav2.DeleteOtherEngineOptions{ - EngineID: core.StringPtr("testString"), + deleteOtherEngineOptions := &watsonxdatav3.DeleteOtherEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } @@ -3227,286 +3803,282 @@ var _ = Describe(`WatsonxDataV2 Integration Tests`, func() { }) }) - Describe(`DeleteIntegration - Remove an Integration`, func() { + Describe(`DeleteNetezzaEngine - Delete netezza engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteIntegration(deleteIntegrationOptions *DeleteIntegrationOptions)`, func() { - deleteIntegrationOptions := &watsonxdatav2.DeleteIntegrationOptions{ - IntegrationID: core.StringPtr("testString"), + It(`DeleteNetezzaEngine(deleteNetezzaEngineOptions *DeleteNetezzaEngineOptions)`, func() { + deleteNetezzaEngineOptions := &watsonxdatav3.DeleteNetezzaEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteIntegration(deleteIntegrationOptions) + response, err := watsonxDataService.DeleteNetezzaEngine(deleteNetezzaEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteDb2Engine - Delete db2 engine`, func() { + Describe(`DeleteSparkEngine - Delete spark engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteDb2Engine(deleteDb2EngineOptions *DeleteDb2EngineOptions)`, func() { - deleteDb2EngineOptions := &watsonxdatav2.DeleteDb2EngineOptions{ - EngineID: core.StringPtr("testString"), + It(`DeleteSparkEngine(deleteSparkEngineOptions *DeleteSparkEngineOptions)`, func() { + deleteSparkEngineOptions := &watsonxdatav3.DeleteSparkEngineOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteDb2Engine(deleteDb2EngineOptions) + response, err := watsonxDataService.DeleteSparkEngine(deleteSparkEngineOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteNetezzaEngine - Delete netezza engine`, func() { + Describe(`DeleteSparkEngineCatalogs - Disassociate catalogs from a spark engine`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteNetezzaEngine(deleteNetezzaEngineOptions *DeleteNetezzaEngineOptions)`, func() { - deleteNetezzaEngineOptions := &watsonxdatav2.DeleteNetezzaEngineOptions{ - EngineID: core.StringPtr("testString"), + It(`DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptions *DeleteSparkEngineCatalogsOptions)`, func() { + deleteSparkEngineCatalogsOptions := &watsonxdatav3.DeleteSparkEngineCatalogsOptions{ + ID: core.StringPtr("testString"), + CatalogNames: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteNetezzaEngine(deleteNetezzaEngineOptions) + response, err := watsonxDataService.DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeletePrestissimoEngine - Delete prestissimo engine`, func() { + Describe(`DeleteSparkEngineApplication - Stop Spark Applications`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeletePrestissimoEngine(deletePrestissimoEngineOptions *DeletePrestissimoEngineOptions)`, func() { - deletePrestissimoEngineOptions := &watsonxdatav2.DeletePrestissimoEngineOptions{ + It(`DeleteSparkEngineApplication(deleteSparkEngineApplicationOptions *DeleteSparkEngineApplicationOptions)`, func() { + deleteSparkEngineApplicationOptions := &watsonxdatav3.DeleteSparkEngineApplicationOptions{ EngineID: core.StringPtr("testString"), + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeletePrestissimoEngine(deletePrestissimoEngineOptions) + response, err := watsonxDataService.DeleteSparkEngineApplication(deleteSparkEngineApplicationOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeletePrestissimoEngineCatalogs - Disassociate catalogs from a prestissimo engine`, func() { + Describe(`DeleteSparkEngineHistoryServer - Stop spark history server`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptions *DeletePrestissimoEngineCatalogsOptions)`, func() { - deletePrestissimoEngineCatalogsOptions := &watsonxdatav2.DeletePrestissimoEngineCatalogsOptions{ - EngineID: core.StringPtr("testString"), - CatalogNames: core.StringPtr("testString"), + It(`DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptions *DeleteSparkEngineHistoryServerOptions)`, func() { + deleteSparkEngineHistoryServerOptions := &watsonxdatav3.DeleteSparkEngineHistoryServerOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptions) + response, err := watsonxDataService.DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteEngine - Delete presto engine`, func() { + Describe(`DeleteIntegration - Delete an Integration`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteEngine(deleteEngineOptions *DeleteEngineOptions)`, func() { - deleteEngineOptions := &watsonxdatav2.DeleteEngineOptions{ - EngineID: core.StringPtr("testString"), + It(`DeleteIntegration(deleteIntegrationOptions *DeleteIntegrationOptions)`, func() { + deleteIntegrationOptions := &watsonxdatav3.DeleteIntegrationOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteEngine(deleteEngineOptions) + response, err := watsonxDataService.DeleteIntegration(deleteIntegrationOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeletePrestoEngineCatalogs - Disassociate catalogs from a presto engine`, func() { + Describe(`DeleteSchema - Delete schema`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptions *DeletePrestoEngineCatalogsOptions)`, func() { - deletePrestoEngineCatalogsOptions := &watsonxdatav2.DeletePrestoEngineCatalogsOptions{ + It(`DeleteSchema(deleteSchemaOptions *DeleteSchemaOptions)`, func() { + deleteSchemaOptions := &watsonxdatav3.DeleteSchemaOptions{ EngineID: core.StringPtr("testString"), - CatalogNames: core.StringPtr("testString"), + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptions) + response, err := watsonxDataService.DeleteSchema(deleteSchemaOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteSalIntegration - Delete sal-wxd integration`, func() { + Describe(`DeleteTable - Delete table`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteSalIntegration(deleteSalIntegrationOptions *DeleteSalIntegrationOptions)`, func() { - deleteSalIntegrationOptions := &watsonxdatav2.DeleteSalIntegrationOptions{ + It(`DeleteTable(deleteTableOptions *DeleteTableOptions)`, func() { + deleteTableOptions := &watsonxdatav3.DeleteTableOptions{ + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), + TableName: core.StringPtr("testString"), + EngineID: core.StringPtr("testString"), + Type: core.StringPtr("testString"), + AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteSalIntegration(deleteSalIntegrationOptions) + response, err := watsonxDataService.DeleteTable(deleteTableOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteSparkEngine - Delete spark engine`, func() { + Describe(`DeleteColumn - Delete column`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteSparkEngine(deleteSparkEngineOptions *DeleteSparkEngineOptions)`, func() { - deleteSparkEngineOptions := &watsonxdatav2.DeleteSparkEngineOptions{ + It(`DeleteColumn(deleteColumnOptions *DeleteColumnOptions)`, func() { + deleteColumnOptions := &watsonxdatav3.DeleteColumnOptions{ EngineID: core.StringPtr("testString"), + CatalogName: core.StringPtr("testString"), + SchemaName: core.StringPtr("testString"), + TableName: core.StringPtr("testString"), + ColumnName: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteSparkEngine(deleteSparkEngineOptions) + response, err := watsonxDataService.DeleteColumn(deleteColumnOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteSparkEngineApplications - Stop Spark Applications`, func() { + Describe(`DeleteCatalog - Delete catalog catalog_id`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteSparkEngineApplications(deleteSparkEngineApplicationsOptions *DeleteSparkEngineApplicationsOptions)`, func() { - deleteSparkEngineApplicationsOptions := &watsonxdatav2.DeleteSparkEngineApplicationsOptions{ - EngineID: core.StringPtr("testString"), - ApplicationID: core.StringPtr("testString"), + It(`DeleteCatalog(deleteCatalogOptions *DeleteCatalogOptions)`, func() { + deleteCatalogOptions := &watsonxdatav3.DeleteCatalogOptions{ + Name: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), - State: []string{"testString"}, + SkipMdsCall: core.BoolPtr(false), } - response, err := watsonxDataService.DeleteSparkEngineApplications(deleteSparkEngineApplicationsOptions) + response, err := watsonxDataService.DeleteCatalog(deleteCatalogOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteSparkEngineCatalogs - Disassociate catalogs from a spark engine`, func() { + Describe(`DeleteMilvusService - Delete milvus service`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptions *DeleteSparkEngineCatalogsOptions)`, func() { - deleteSparkEngineCatalogsOptions := &watsonxdatav2.DeleteSparkEngineCatalogsOptions{ - EngineID: core.StringPtr("testString"), - CatalogNames: core.StringPtr("testString"), + It(`DeleteMilvusService(deleteMilvusServiceOptions *DeleteMilvusServiceOptions)`, func() { + deleteMilvusServiceOptions := &watsonxdatav3.DeleteMilvusServiceOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptions) + response, err := watsonxDataService.DeleteMilvusService(deleteMilvusServiceOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteSparkEngineHistoryServer - Stop spark history server`, func() { + Describe(`DeleteSalIntegration - Delete Semantic Automation Layer(SAL) integration`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptions *DeleteSparkEngineHistoryServerOptions)`, func() { - deleteSparkEngineHistoryServerOptions := &watsonxdatav2.DeleteSparkEngineHistoryServerOptions{ - EngineID: core.StringPtr("testString"), - AuthInstanceID: core.StringPtr("testString"), + It(`DeleteSalIntegration(deleteSalIntegrationOptions *DeleteSalIntegrationOptions)`, func() { + deleteSalIntegrationOptions := &watsonxdatav3.DeleteSalIntegrationOptions{ } - response, err := watsonxDataService.DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptions) + response, err := watsonxDataService.DeleteSalIntegration(deleteSalIntegrationOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteSchema - Delete schema`, func() { + Describe(`DeleteSemanticSearchQueries - Clear semantic search query history`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteSchema(deleteSchemaOptions *DeleteSchemaOptions)`, func() { - deleteSchemaOptions := &watsonxdatav2.DeleteSchemaOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), + It(`DeleteSemanticSearchQueries(deleteSemanticSearchQueriesOptions *DeleteSemanticSearchQueriesOptions)`, func() { + deleteSemanticSearchQueriesOptions := &watsonxdatav3.DeleteSemanticSearchQueriesOptions{ + BatchSize: core.Int64Ptr(int64(1)), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteSchema(deleteSchemaOptions) + response, err := watsonxDataService.DeleteSemanticSearchQueries(deleteSemanticSearchQueriesOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteTable - Delete table`, func() { + Describe(`DeleteSemanticSearchQueriesByID - Delete semantic search query history by record id`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteTable(deleteTableOptions *DeleteTableOptions)`, func() { - deleteTableOptions := &watsonxdatav2.DeleteTableOptions{ - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - TableID: core.StringPtr("testString"), - EngineID: core.StringPtr("testString"), - Type: core.StringPtr("testString"), + It(`DeleteSemanticSearchQueriesByID(deleteSemanticSearchQueriesByIdOptions *DeleteSemanticSearchQueriesByIdOptions)`, func() { + deleteSemanticSearchQueriesByIdOptions := &watsonxdatav3.DeleteSemanticSearchQueriesByIdOptions{ + ID: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteTable(deleteTableOptions) + response, err := watsonxDataService.DeleteSemanticSearchQueriesByID(deleteSemanticSearchQueriesByIdOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteColumn - Delete column`, func() { + Describe(`DeleteSalMetadata - Delete Semantic automation layer(SAL) integration metadata`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteColumn(deleteColumnOptions *DeleteColumnOptions)`, func() { - deleteColumnOptions := &watsonxdatav2.DeleteColumnOptions{ - EngineID: core.StringPtr("testString"), - CatalogID: core.StringPtr("testString"), - SchemaID: core.StringPtr("testString"), - TableID: core.StringPtr("testString"), - ColumnID: core.StringPtr("testString"), - AuthInstanceID: core.StringPtr("testString"), + It(`DeleteSalMetadata(deleteSalMetadataOptions *DeleteSalMetadataOptions)`, func() { + deleteSalMetadataOptions := &watsonxdatav3.DeleteSalMetadataOptions{ } - response, err := watsonxDataService.DeleteColumn(deleteColumnOptions) + response, err := watsonxDataService.DeleteSalMetadata(deleteSalMetadataOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteMilvusService - Delete milvus service`, func() { + Describe(`DeleteDataPolicies - Bulk delete data policies`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteMilvusService(deleteMilvusServiceOptions *DeleteMilvusServiceOptions)`, func() { - deleteMilvusServiceOptions := &watsonxdatav2.DeleteMilvusServiceOptions{ - ServiceID: core.StringPtr("testString"), + It(`DeleteDataPolicies(deleteDataPoliciesOptions *DeleteDataPoliciesOptions)`, func() { + deleteDataPoliciesOptions := &watsonxdatav3.DeleteDataPoliciesOptions{ AuthInstanceID: core.StringPtr("testString"), + Policies: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteMilvusService(deleteMilvusServiceOptions) + response, err := watsonxDataService.DeleteDataPolicies(deleteDataPoliciesOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) }) - Describe(`DeleteIngestionJobs - Delete an ingestion job`, func() { + Describe(`DeleteDataPolicy - Delete a data policy`, func() { BeforeEach(func() { shouldSkipTest() }) - It(`DeleteIngestionJobs(deleteIngestionJobsOptions *DeleteIngestionJobsOptions)`, func() { - deleteIngestionJobsOptions := &watsonxdatav2.DeleteIngestionJobsOptions{ - JobID: core.StringPtr("testString"), + It(`DeleteDataPolicy(deleteDataPolicyOptions *DeleteDataPolicyOptions)`, func() { + deleteDataPolicyOptions := &watsonxdatav3.DeleteDataPolicyOptions{ + Name: core.StringPtr("testString"), AuthInstanceID: core.StringPtr("testString"), } - response, err := watsonxDataService.DeleteIngestionJobs(deleteIngestionJobsOptions) + response, err := watsonxDataService.DeleteDataPolicy(deleteDataPolicyOptions) Expect(err).To(BeNil()) Expect(response.StatusCode).To(Equal(204)) }) diff --git a/watsonxdatav2/watsonx_data_v2_suite_test.go b/watsonxdatav3/watsonx_data_v3_suite_test.go similarity index 83% rename from watsonxdatav2/watsonx_data_v2_suite_test.go rename to watsonxdatav3/watsonx_data_v3_suite_test.go index 4b880f6..6ed0f61 100644 --- a/watsonxdatav2/watsonx_data_v2_suite_test.go +++ b/watsonxdatav3/watsonx_data_v3_suite_test.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2025. + * (C) Copyright IBM Corp. 2026. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package watsonxdatav2_test +package watsonxdatav3_test import ( "testing" @@ -23,7 +23,7 @@ import ( . "github.com/onsi/gomega" ) -func TestWatsonxDataV2(t *testing.T) { +func TestWatsonxDataV3(t *testing.T) { RegisterFailHandler(Fail) - RunSpecs(t, "WatsonxDataV2 Suite") + RunSpecs(t, "WatsonxDataV3 Suite") } diff --git a/watsonxdatav2/watsonx_data_v2_test.go b/watsonxdatav3/watsonx_data_v3_test.go similarity index 56% rename from watsonxdatav2/watsonx_data_v2_test.go rename to watsonxdatav3/watsonx_data_v3_test.go index 9904d79..f0f6ab8 100644 --- a/watsonxdatav2/watsonx_data_v2_test.go +++ b/watsonxdatav3/watsonx_data_v3_test.go @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2025. + * (C) Copyright IBM Corp. 2026. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -package watsonxdatav2_test +package watsonxdatav3_test import ( "bytes" @@ -29,32 +29,33 @@ import ( "time" "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/watsonxdata-go-sdk/watsonxdatav2" + "github.com/IBM/watsonxdata-go-sdk/watsonxdatav3" "github.com/go-openapi/strfmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gstruct" ) -var _ = Describe(`WatsonxDataV2`, func() { +var _ = Describe(`WatsonxDataV3`, func() { var testServer *httptest.Server Describe(`Service constructor tests`, func() { It(`Instantiate service client`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ Authenticator: &core.NoAuthAuthenticator{}, }) Expect(watsonxDataService).ToNot(BeNil()) Expect(serviceErr).To(BeNil()) }) It(`Instantiate service client with error: Invalid URL`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: "{BAD_URL_STRING", }) Expect(watsonxDataService).To(BeNil()) Expect(serviceErr).ToNot(BeNil()) }) It(`Instantiate service client with error: Invalid Auth`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: "https://watsonxdatav2/api", + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: "https://watsonxdatav3/api", Authenticator: &core.BasicAuthenticator{ Username: "", Password: "", @@ -68,13 +69,13 @@ var _ = Describe(`WatsonxDataV2`, func() { Context(`Using external config, construct service client instances`, func() { // Map containing environment variables used in testing. var testEnvironment = map[string]string{ - "WATSONX_DATA_URL": "https://watsonxdatav2/api", + "WATSONX_DATA_URL": "https://watsonxdatav3/api", "WATSONX_DATA_AUTH_TYPE": "noauth", } It(`Create service client using external config successfully`, func() { SetTestEnvironment(testEnvironment) - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2UsingExternalConfig(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3UsingExternalConfig(&watsonxdatav3.WatsonxDataV3Options{ }) Expect(watsonxDataService).ToNot(BeNil()) Expect(serviceErr).To(BeNil()) @@ -88,7 +89,7 @@ var _ = Describe(`WatsonxDataV2`, func() { }) It(`Create service client using external config and set url from constructor successfully`, func() { SetTestEnvironment(testEnvironment) - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2UsingExternalConfig(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3UsingExternalConfig(&watsonxdatav3.WatsonxDataV3Options{ URL: "https://testService/api", }) Expect(watsonxDataService).ToNot(BeNil()) @@ -104,7 +105,7 @@ var _ = Describe(`WatsonxDataV2`, func() { }) It(`Create service client using external config and set url programatically successfully`, func() { SetTestEnvironment(testEnvironment) - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2UsingExternalConfig(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3UsingExternalConfig(&watsonxdatav3.WatsonxDataV3Options{ }) err := watsonxDataService.SetServiceURL("https://testService/api") Expect(err).To(BeNil()) @@ -123,12 +124,12 @@ var _ = Describe(`WatsonxDataV2`, func() { Context(`Using external config, construct service client instances with error: Invalid Auth`, func() { // Map containing environment variables used in testing. var testEnvironment = map[string]string{ - "WATSONX_DATA_URL": "https://watsonxdatav2/api", + "WATSONX_DATA_URL": "https://watsonxdatav3/api", "WATSONX_DATA_AUTH_TYPE": "someOtherAuth", } SetTestEnvironment(testEnvironment) - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2UsingExternalConfig(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3UsingExternalConfig(&watsonxdatav3.WatsonxDataV3Options{ }) It(`Instantiate service client with error`, func() { @@ -144,7 +145,7 @@ var _ = Describe(`WatsonxDataV2`, func() { } SetTestEnvironment(testEnvironment) - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2UsingExternalConfig(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3UsingExternalConfig(&watsonxdatav3.WatsonxDataV3Options{ URL: "{BAD_URL_STRING", }) @@ -159,50 +160,69 @@ var _ = Describe(`WatsonxDataV2`, func() { It(`GetServiceURLForRegion(region string)`, func() { var url string var err error - url, err = watsonxdatav2.GetServiceURLForRegion("INVALID_REGION") + url, err = watsonxdatav3.GetServiceURLForRegion("INVALID_REGION") Expect(url).To(BeEmpty()) Expect(err).ToNot(BeNil()) fmt.Fprintf(GinkgoWriter, "Expected error: %s\n", err.Error()) }) }) - Describe(`ListBucketRegistrations(listBucketRegistrationsOptions *ListBucketRegistrationsOptions) - Operation response error`, func() { - listBucketRegistrationsPath := "/bucket_registrations" + Describe(`CreateHdfsStorage(createHdfsStorageOptions *CreateHdfsStorageOptions) - Operation response error`, func() { + createHdfsStoragePath := "/v3/storage_hdfs_registrations" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBucketRegistrationsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createHdfsStoragePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBucketRegistrations with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateHdfsStorage with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListBucketRegistrationsOptions model - listBucketRegistrationsOptionsModel := new(watsonxdatav2.ListBucketRegistrationsOptions) - listBucketRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listBucketRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateHdfsStorageOptions model + createHdfsStorageOptionsModel := new(watsonxdatav3.CreateHdfsStorageOptions) + createHdfsStorageOptionsModel.DisplayName = core.StringPtr("testString") + createHdfsStorageOptionsModel.Type = core.StringPtr("testString") + createHdfsStorageOptionsModel.HmsThriftURI = core.StringPtr("testString") + createHdfsStorageOptionsModel.HmsThriftPort = core.Int64Ptr(int64(1)) + createHdfsStorageOptionsModel.CoreSite = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsSite = core.StringPtr("testString") + createHdfsStorageOptionsModel.Kerberos = core.StringPtr("testString") + createHdfsStorageOptionsModel.CatalogName = core.StringPtr("testString") + createHdfsStorageOptionsModel.CatalogType = core.StringPtr("testString") + createHdfsStorageOptionsModel.Krb5Config = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveKeytab = CreateMockReader("This is a mock file.") + createHdfsStorageOptionsModel.HiveKeytabContentType = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsKeytab = CreateMockReader("This is a mock file.") + createHdfsStorageOptionsModel.HdfsKeytabContentType = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveServerPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveClientPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.Description = core.StringPtr("testString") + createHdfsStorageOptionsModel.CreatedAt = core.StringPtr("testString") + createHdfsStorageOptionsModel.AuthInstanceID = core.StringPtr("testString") + createHdfsStorageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListBucketRegistrations(listBucketRegistrationsOptionsModel) + result, response, operationErr := watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListBucketRegistrations(listBucketRegistrationsOptionsModel) + result, response, operationErr = watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -212,16 +232,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListBucketRegistrations(listBucketRegistrationsOptions *ListBucketRegistrationsOptions)`, func() { - listBucketRegistrationsPath := "/bucket_registrations" + Describe(`CreateHdfsStorage(createHdfsStorageOptions *CreateHdfsStorageOptions)`, func() { + createHdfsStoragePath := "/v3/storage_hdfs_registrations" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBucketRegistrationsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createHdfsStoragePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -230,12 +250,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bucket_registrations": [{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "bucket_details": {"access_key": "b9cbf248ea5c4c96947e64407108559j", "bucket_name": "sample-bucket", "endpoint": "https://s3..cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "provider": "ibm_cos", "region": "us-south", "secret_key": "13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87"}, "bucket_display_name": "sample-bucket-displayname", "bucket_id": "samplebucket123", "bucket_type": "ibm_cos", "created_by": "@.com", "created_on": "1686120645", "description": "COS bucket for customer data", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_details": {"access_key": "", "application_id": "", "auth_mode": "", "container_name": "sample-container", "directory_id": "", "endpoint": "abfss://@.dfs.core.windows.net/", "sas_token": "", "secret_key": "secret_key", "storage_account_name": "sample-storage"}, "tags": ["Tags"]}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "created_at": "1686120645", "created_by": "@.com", "description": "HDFS description for storage", "display_name": "sample hdfs displayname", "id": "hdfs123", "managed_by": "customer", "state": "active", "tags": ["Tags"], "type": "hdfs"}`) })) }) - It(`Invoke ListBucketRegistrations successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateHdfsStorage successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -243,21 +263,40 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListBucketRegistrationsOptions model - listBucketRegistrationsOptionsModel := new(watsonxdatav2.ListBucketRegistrationsOptions) - listBucketRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listBucketRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateHdfsStorageOptions model + createHdfsStorageOptionsModel := new(watsonxdatav3.CreateHdfsStorageOptions) + createHdfsStorageOptionsModel.DisplayName = core.StringPtr("testString") + createHdfsStorageOptionsModel.Type = core.StringPtr("testString") + createHdfsStorageOptionsModel.HmsThriftURI = core.StringPtr("testString") + createHdfsStorageOptionsModel.HmsThriftPort = core.Int64Ptr(int64(1)) + createHdfsStorageOptionsModel.CoreSite = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsSite = core.StringPtr("testString") + createHdfsStorageOptionsModel.Kerberos = core.StringPtr("testString") + createHdfsStorageOptionsModel.CatalogName = core.StringPtr("testString") + createHdfsStorageOptionsModel.CatalogType = core.StringPtr("testString") + createHdfsStorageOptionsModel.Krb5Config = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveKeytab = CreateMockReader("This is a mock file.") + createHdfsStorageOptionsModel.HiveKeytabContentType = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsKeytab = CreateMockReader("This is a mock file.") + createHdfsStorageOptionsModel.HdfsKeytabContentType = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveServerPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveClientPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.Description = core.StringPtr("testString") + createHdfsStorageOptionsModel.CreatedAt = core.StringPtr("testString") + createHdfsStorageOptionsModel.AuthInstanceID = core.StringPtr("testString") + createHdfsStorageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListBucketRegistrationsWithContext(ctx, listBucketRegistrationsOptionsModel) + _, _, operationErr := watsonxDataService.CreateHdfsStorageWithContext(ctx, createHdfsStorageOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListBucketRegistrations(listBucketRegistrationsOptionsModel) + result, response, operationErr := watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -265,7 +304,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListBucketRegistrationsWithContext(ctx, listBucketRegistrationsOptionsModel) + _, _, operationErr = watsonxDataService.CreateHdfsStorageWithContext(ctx, createHdfsStorageOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -279,19 +318,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBucketRegistrationsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createHdfsStoragePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bucket_registrations": [{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "bucket_details": {"access_key": "b9cbf248ea5c4c96947e64407108559j", "bucket_name": "sample-bucket", "endpoint": "https://s3..cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "provider": "ibm_cos", "region": "us-south", "secret_key": "13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87"}, "bucket_display_name": "sample-bucket-displayname", "bucket_id": "samplebucket123", "bucket_type": "ibm_cos", "created_by": "@.com", "created_on": "1686120645", "description": "COS bucket for customer data", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_details": {"access_key": "", "application_id": "", "auth_mode": "", "container_name": "sample-container", "directory_id": "", "endpoint": "abfss://@.dfs.core.windows.net/", "sas_token": "", "secret_key": "secret_key", "storage_account_name": "sample-storage"}, "tags": ["Tags"]}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "created_at": "1686120645", "created_by": "@.com", "description": "HDFS description for storage", "display_name": "sample hdfs displayname", "id": "hdfs123", "managed_by": "customer", "state": "active", "tags": ["Tags"], "type": "hdfs"}`) })) }) - It(`Invoke ListBucketRegistrations successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateHdfsStorage successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -299,43 +338,88 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListBucketRegistrations(nil) + result, response, operationErr := watsonxDataService.CreateHdfsStorage(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBucketRegistrationsOptions model - listBucketRegistrationsOptionsModel := new(watsonxdatav2.ListBucketRegistrationsOptions) - listBucketRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listBucketRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateHdfsStorageOptions model + createHdfsStorageOptionsModel := new(watsonxdatav3.CreateHdfsStorageOptions) + createHdfsStorageOptionsModel.DisplayName = core.StringPtr("testString") + createHdfsStorageOptionsModel.Type = core.StringPtr("testString") + createHdfsStorageOptionsModel.HmsThriftURI = core.StringPtr("testString") + createHdfsStorageOptionsModel.HmsThriftPort = core.Int64Ptr(int64(1)) + createHdfsStorageOptionsModel.CoreSite = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsSite = core.StringPtr("testString") + createHdfsStorageOptionsModel.Kerberos = core.StringPtr("testString") + createHdfsStorageOptionsModel.CatalogName = core.StringPtr("testString") + createHdfsStorageOptionsModel.CatalogType = core.StringPtr("testString") + createHdfsStorageOptionsModel.Krb5Config = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveKeytab = CreateMockReader("This is a mock file.") + createHdfsStorageOptionsModel.HiveKeytabContentType = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsKeytab = CreateMockReader("This is a mock file.") + createHdfsStorageOptionsModel.HdfsKeytabContentType = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveServerPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveClientPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.Description = core.StringPtr("testString") + createHdfsStorageOptionsModel.CreatedAt = core.StringPtr("testString") + createHdfsStorageOptionsModel.AuthInstanceID = core.StringPtr("testString") + createHdfsStorageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListBucketRegistrations(listBucketRegistrationsOptionsModel) + result, response, operationErr = watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBucketRegistrations with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateHdfsStorage with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListBucketRegistrationsOptions model - listBucketRegistrationsOptionsModel := new(watsonxdatav2.ListBucketRegistrationsOptions) - listBucketRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listBucketRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateHdfsStorageOptions model + createHdfsStorageOptionsModel := new(watsonxdatav3.CreateHdfsStorageOptions) + createHdfsStorageOptionsModel.DisplayName = core.StringPtr("testString") + createHdfsStorageOptionsModel.Type = core.StringPtr("testString") + createHdfsStorageOptionsModel.HmsThriftURI = core.StringPtr("testString") + createHdfsStorageOptionsModel.HmsThriftPort = core.Int64Ptr(int64(1)) + createHdfsStorageOptionsModel.CoreSite = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsSite = core.StringPtr("testString") + createHdfsStorageOptionsModel.Kerberos = core.StringPtr("testString") + createHdfsStorageOptionsModel.CatalogName = core.StringPtr("testString") + createHdfsStorageOptionsModel.CatalogType = core.StringPtr("testString") + createHdfsStorageOptionsModel.Krb5Config = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveKeytab = CreateMockReader("This is a mock file.") + createHdfsStorageOptionsModel.HiveKeytabContentType = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsKeytab = CreateMockReader("This is a mock file.") + createHdfsStorageOptionsModel.HdfsKeytabContentType = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveServerPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveClientPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.Description = core.StringPtr("testString") + createHdfsStorageOptionsModel.CreatedAt = core.StringPtr("testString") + createHdfsStorageOptionsModel.AuthInstanceID = core.StringPtr("testString") + createHdfsStorageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListBucketRegistrations(listBucketRegistrationsOptionsModel) + result, response, operationErr := watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the CreateHdfsStorageOptions model with no property values + createHdfsStorageOptionsModelNew := new(watsonxdatav3.CreateHdfsStorageOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -347,24 +431,43 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListBucketRegistrations successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateHdfsStorage successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListBucketRegistrationsOptions model - listBucketRegistrationsOptionsModel := new(watsonxdatav2.ListBucketRegistrationsOptions) - listBucketRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listBucketRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateHdfsStorageOptions model + createHdfsStorageOptionsModel := new(watsonxdatav3.CreateHdfsStorageOptions) + createHdfsStorageOptionsModel.DisplayName = core.StringPtr("testString") + createHdfsStorageOptionsModel.Type = core.StringPtr("testString") + createHdfsStorageOptionsModel.HmsThriftURI = core.StringPtr("testString") + createHdfsStorageOptionsModel.HmsThriftPort = core.Int64Ptr(int64(1)) + createHdfsStorageOptionsModel.CoreSite = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsSite = core.StringPtr("testString") + createHdfsStorageOptionsModel.Kerberos = core.StringPtr("testString") + createHdfsStorageOptionsModel.CatalogName = core.StringPtr("testString") + createHdfsStorageOptionsModel.CatalogType = core.StringPtr("testString") + createHdfsStorageOptionsModel.Krb5Config = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveKeytab = CreateMockReader("This is a mock file.") + createHdfsStorageOptionsModel.HiveKeytabContentType = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsKeytab = CreateMockReader("This is a mock file.") + createHdfsStorageOptionsModel.HdfsKeytabContentType = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveServerPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.HiveClientPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.HdfsPrincipal = core.StringPtr("testString") + createHdfsStorageOptionsModel.Description = core.StringPtr("testString") + createHdfsStorageOptionsModel.CreatedAt = core.StringPtr("testString") + createHdfsStorageOptionsModel.AuthInstanceID = core.StringPtr("testString") + createHdfsStorageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListBucketRegistrations(listBucketRegistrationsOptionsModel) + result, response, operationErr := watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -376,82 +479,44 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateBucketRegistration(createBucketRegistrationOptions *CreateBucketRegistrationOptions) - Operation response error`, func() { - createBucketRegistrationPath := "/bucket_registrations" + Describe(`ListStorageRegistrations(listStorageRegistrationsOptions *ListStorageRegistrationsOptions) - Operation response error`, func() { + listStorageRegistrationsPath := "/v3/storage_registrations" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBucketRegistrationPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listStorageRegistrationsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateBucketRegistration with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListStorageRegistrations with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the BucketCatalog model - bucketCatalogModel := new(watsonxdatav2.BucketCatalog) - bucketCatalogModel.BasePath = core.StringPtr("/abc/def") - bucketCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - bucketCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - bucketCatalogModel.CatalogType = core.StringPtr("iceberg") - - // Construct an instance of the BucketDetails model - bucketDetailsModel := new(watsonxdatav2.BucketDetails) - bucketDetailsModel.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - bucketDetailsModel.BucketName = core.StringPtr("sample-bucket") - bucketDetailsModel.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - bucketDetailsModel.KeyFile = core.StringPtr("key_file") - bucketDetailsModel.Provider = core.StringPtr("ibm_cos") - bucketDetailsModel.Region = core.StringPtr("us-south") - bucketDetailsModel.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") - - // Construct an instance of the StorageDetails model - storageDetailsModel := new(watsonxdatav2.StorageDetails) - storageDetailsModel.AccessKey = core.StringPtr("") - storageDetailsModel.ApplicationID = core.StringPtr("") - storageDetailsModel.AuthMode = core.StringPtr("") - storageDetailsModel.ContainerName = core.StringPtr("sample-container") - storageDetailsModel.DirectoryID = core.StringPtr("") - storageDetailsModel.Endpoint = core.StringPtr("abfss://@.dfs.core.windows.net/") - storageDetailsModel.SasToken = core.StringPtr("") - storageDetailsModel.SecretKey = core.StringPtr("secret_key") - storageDetailsModel.StorageAccountName = core.StringPtr("sample-storage") - - // Construct an instance of the CreateBucketRegistrationOptions model - createBucketRegistrationOptionsModel := new(watsonxdatav2.CreateBucketRegistrationOptions) - createBucketRegistrationOptionsModel.BucketType = core.StringPtr("ibm_cos") - createBucketRegistrationOptionsModel.Description = core.StringPtr("COS bucket for customer data") - createBucketRegistrationOptionsModel.ManagedBy = core.StringPtr("ibm") - createBucketRegistrationOptionsModel.AssociatedCatalog = bucketCatalogModel - createBucketRegistrationOptionsModel.BucketDetails = bucketDetailsModel - createBucketRegistrationOptionsModel.BucketDisplayName = core.StringPtr("sample-bucket-displayname") - createBucketRegistrationOptionsModel.Region = core.StringPtr("us-south") - createBucketRegistrationOptionsModel.StorageDetails = storageDetailsModel - createBucketRegistrationOptionsModel.Tags = []string{"bucket-tag1", "bucket-tag2"} - createBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListStorageRegistrationsOptions model + listStorageRegistrationsOptionsModel := new(watsonxdatav3.ListStorageRegistrationsOptions) + listStorageRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listStorageRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateBucketRegistration(createBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.ListStorageRegistrations(listStorageRegistrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateBucketRegistration(createBucketRegistrationOptionsModel) + result, response, operationErr = watsonxDataService.ListStorageRegistrations(listStorageRegistrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -461,32 +526,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateBucketRegistration(createBucketRegistrationOptions *CreateBucketRegistrationOptions)`, func() { - createBucketRegistrationPath := "/bucket_registrations" + Describe(`ListStorageRegistrations(listStorageRegistrationsOptions *ListStorageRegistrationsOptions)`, func() { + listStorageRegistrationsPath := "/v3/storage_registrations" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBucketRegistrationPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listStorageRegistrationsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -495,12 +544,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "bucket_details": {"access_key": "b9cbf248ea5c4c96947e64407108559j", "bucket_name": "sample-bucket", "endpoint": "https://s3..cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "provider": "ibm_cos", "region": "us-south", "secret_key": "13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87"}, "bucket_display_name": "sample-bucket-displayname", "bucket_id": "samplebucket123", "bucket_type": "ibm_cos", "created_by": "@.com", "created_on": "1686120645", "description": "COS bucket for customer data", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_details": {"access_key": "", "application_id": "", "auth_mode": "", "container_name": "sample-container", "directory_id": "", "endpoint": "abfss://@.dfs.core.windows.net/", "sas_token": "", "secret_key": "secret_key", "storage_account_name": "sample-storage"}, "tags": ["Tags"]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"storage_registrations": [{"actions": ["Actions"], "associated_catalogs": [{"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}], "connection": {"access_key": "", "access_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "account_name": "sample-storage", "application_id": "application-id", "auth_mode": "iam", "container_name": "sample-container", "directory_id": "directory-id", "endpoint": "https://s3.us-south.cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "name": "sample-storage", "provider": "ibm-cos", "region": "us-south", "role_arn": "arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9", "sas_token": "", "secret_key": "secret_key", "secret_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true}, "created_at": "1686120645", "created_by": "@.com", "description": "COS storage for customer data", "display_name": "sample-storage-displayname", "id": "samplestorage123", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_use": "acl", "system_storage_update_credentials": true, "tags": ["Tags"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "type": "ibm_cos", "vault_enabled": true}]}`) })) }) - It(`Invoke CreateBucketRegistration successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListStorageRegistrations successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -508,59 +557,21 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the BucketCatalog model - bucketCatalogModel := new(watsonxdatav2.BucketCatalog) - bucketCatalogModel.BasePath = core.StringPtr("/abc/def") - bucketCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - bucketCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - bucketCatalogModel.CatalogType = core.StringPtr("iceberg") - - // Construct an instance of the BucketDetails model - bucketDetailsModel := new(watsonxdatav2.BucketDetails) - bucketDetailsModel.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - bucketDetailsModel.BucketName = core.StringPtr("sample-bucket") - bucketDetailsModel.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - bucketDetailsModel.KeyFile = core.StringPtr("key_file") - bucketDetailsModel.Provider = core.StringPtr("ibm_cos") - bucketDetailsModel.Region = core.StringPtr("us-south") - bucketDetailsModel.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") - - // Construct an instance of the StorageDetails model - storageDetailsModel := new(watsonxdatav2.StorageDetails) - storageDetailsModel.AccessKey = core.StringPtr("") - storageDetailsModel.ApplicationID = core.StringPtr("") - storageDetailsModel.AuthMode = core.StringPtr("") - storageDetailsModel.ContainerName = core.StringPtr("sample-container") - storageDetailsModel.DirectoryID = core.StringPtr("") - storageDetailsModel.Endpoint = core.StringPtr("abfss://@.dfs.core.windows.net/") - storageDetailsModel.SasToken = core.StringPtr("") - storageDetailsModel.SecretKey = core.StringPtr("secret_key") - storageDetailsModel.StorageAccountName = core.StringPtr("sample-storage") - - // Construct an instance of the CreateBucketRegistrationOptions model - createBucketRegistrationOptionsModel := new(watsonxdatav2.CreateBucketRegistrationOptions) - createBucketRegistrationOptionsModel.BucketType = core.StringPtr("ibm_cos") - createBucketRegistrationOptionsModel.Description = core.StringPtr("COS bucket for customer data") - createBucketRegistrationOptionsModel.ManagedBy = core.StringPtr("ibm") - createBucketRegistrationOptionsModel.AssociatedCatalog = bucketCatalogModel - createBucketRegistrationOptionsModel.BucketDetails = bucketDetailsModel - createBucketRegistrationOptionsModel.BucketDisplayName = core.StringPtr("sample-bucket-displayname") - createBucketRegistrationOptionsModel.Region = core.StringPtr("us-south") - createBucketRegistrationOptionsModel.StorageDetails = storageDetailsModel - createBucketRegistrationOptionsModel.Tags = []string{"bucket-tag1", "bucket-tag2"} - createBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListStorageRegistrationsOptions model + listStorageRegistrationsOptionsModel := new(watsonxdatav3.ListStorageRegistrationsOptions) + listStorageRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listStorageRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateBucketRegistrationWithContext(ctx, createBucketRegistrationOptionsModel) + _, _, operationErr := watsonxDataService.ListStorageRegistrationsWithContext(ctx, listStorageRegistrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateBucketRegistration(createBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.ListStorageRegistrations(listStorageRegistrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -568,7 +579,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateBucketRegistrationWithContext(ctx, createBucketRegistrationOptionsModel) + _, _, operationErr = watsonxDataService.ListStorageRegistrationsWithContext(ctx, listStorageRegistrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -582,35 +593,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createBucketRegistrationPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listStorageRegistrationsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "bucket_details": {"access_key": "b9cbf248ea5c4c96947e64407108559j", "bucket_name": "sample-bucket", "endpoint": "https://s3..cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "provider": "ibm_cos", "region": "us-south", "secret_key": "13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87"}, "bucket_display_name": "sample-bucket-displayname", "bucket_id": "samplebucket123", "bucket_type": "ibm_cos", "created_by": "@.com", "created_on": "1686120645", "description": "COS bucket for customer data", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_details": {"access_key": "", "application_id": "", "auth_mode": "", "container_name": "sample-container", "directory_id": "", "endpoint": "abfss://@.dfs.core.windows.net/", "sas_token": "", "secret_key": "secret_key", "storage_account_name": "sample-storage"}, "tags": ["Tags"]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"storage_registrations": [{"actions": ["Actions"], "associated_catalogs": [{"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}], "connection": {"access_key": "", "access_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "account_name": "sample-storage", "application_id": "application-id", "auth_mode": "iam", "container_name": "sample-container", "directory_id": "directory-id", "endpoint": "https://s3.us-south.cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "name": "sample-storage", "provider": "ibm-cos", "region": "us-south", "role_arn": "arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9", "sas_token": "", "secret_key": "secret_key", "secret_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true}, "created_at": "1686120645", "created_by": "@.com", "description": "COS storage for customer data", "display_name": "sample-storage-displayname", "id": "samplestorage123", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_use": "acl", "system_storage_update_credentials": true, "tags": ["Tags"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "type": "ibm_cos", "vault_enabled": true}]}`) })) }) - It(`Invoke CreateBucketRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListStorageRegistrations successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -618,126 +613,43 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateBucketRegistration(nil) + result, response, operationErr := watsonxDataService.ListStorageRegistrations(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the BucketCatalog model - bucketCatalogModel := new(watsonxdatav2.BucketCatalog) - bucketCatalogModel.BasePath = core.StringPtr("/abc/def") - bucketCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - bucketCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - bucketCatalogModel.CatalogType = core.StringPtr("iceberg") - - // Construct an instance of the BucketDetails model - bucketDetailsModel := new(watsonxdatav2.BucketDetails) - bucketDetailsModel.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - bucketDetailsModel.BucketName = core.StringPtr("sample-bucket") - bucketDetailsModel.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - bucketDetailsModel.KeyFile = core.StringPtr("key_file") - bucketDetailsModel.Provider = core.StringPtr("ibm_cos") - bucketDetailsModel.Region = core.StringPtr("us-south") - bucketDetailsModel.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") - - // Construct an instance of the StorageDetails model - storageDetailsModel := new(watsonxdatav2.StorageDetails) - storageDetailsModel.AccessKey = core.StringPtr("") - storageDetailsModel.ApplicationID = core.StringPtr("") - storageDetailsModel.AuthMode = core.StringPtr("") - storageDetailsModel.ContainerName = core.StringPtr("sample-container") - storageDetailsModel.DirectoryID = core.StringPtr("") - storageDetailsModel.Endpoint = core.StringPtr("abfss://@.dfs.core.windows.net/") - storageDetailsModel.SasToken = core.StringPtr("") - storageDetailsModel.SecretKey = core.StringPtr("secret_key") - storageDetailsModel.StorageAccountName = core.StringPtr("sample-storage") - - // Construct an instance of the CreateBucketRegistrationOptions model - createBucketRegistrationOptionsModel := new(watsonxdatav2.CreateBucketRegistrationOptions) - createBucketRegistrationOptionsModel.BucketType = core.StringPtr("ibm_cos") - createBucketRegistrationOptionsModel.Description = core.StringPtr("COS bucket for customer data") - createBucketRegistrationOptionsModel.ManagedBy = core.StringPtr("ibm") - createBucketRegistrationOptionsModel.AssociatedCatalog = bucketCatalogModel - createBucketRegistrationOptionsModel.BucketDetails = bucketDetailsModel - createBucketRegistrationOptionsModel.BucketDisplayName = core.StringPtr("sample-bucket-displayname") - createBucketRegistrationOptionsModel.Region = core.StringPtr("us-south") - createBucketRegistrationOptionsModel.StorageDetails = storageDetailsModel - createBucketRegistrationOptionsModel.Tags = []string{"bucket-tag1", "bucket-tag2"} - createBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListStorageRegistrationsOptions model + listStorageRegistrationsOptionsModel := new(watsonxdatav3.ListStorageRegistrationsOptions) + listStorageRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listStorageRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateBucketRegistration(createBucketRegistrationOptionsModel) + result, response, operationErr = watsonxDataService.ListStorageRegistrations(listStorageRegistrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateBucketRegistration with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListStorageRegistrations with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the BucketCatalog model - bucketCatalogModel := new(watsonxdatav2.BucketCatalog) - bucketCatalogModel.BasePath = core.StringPtr("/abc/def") - bucketCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - bucketCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - bucketCatalogModel.CatalogType = core.StringPtr("iceberg") - - // Construct an instance of the BucketDetails model - bucketDetailsModel := new(watsonxdatav2.BucketDetails) - bucketDetailsModel.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - bucketDetailsModel.BucketName = core.StringPtr("sample-bucket") - bucketDetailsModel.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - bucketDetailsModel.KeyFile = core.StringPtr("key_file") - bucketDetailsModel.Provider = core.StringPtr("ibm_cos") - bucketDetailsModel.Region = core.StringPtr("us-south") - bucketDetailsModel.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") - - // Construct an instance of the StorageDetails model - storageDetailsModel := new(watsonxdatav2.StorageDetails) - storageDetailsModel.AccessKey = core.StringPtr("") - storageDetailsModel.ApplicationID = core.StringPtr("") - storageDetailsModel.AuthMode = core.StringPtr("") - storageDetailsModel.ContainerName = core.StringPtr("sample-container") - storageDetailsModel.DirectoryID = core.StringPtr("") - storageDetailsModel.Endpoint = core.StringPtr("abfss://@.dfs.core.windows.net/") - storageDetailsModel.SasToken = core.StringPtr("") - storageDetailsModel.SecretKey = core.StringPtr("secret_key") - storageDetailsModel.StorageAccountName = core.StringPtr("sample-storage") - - // Construct an instance of the CreateBucketRegistrationOptions model - createBucketRegistrationOptionsModel := new(watsonxdatav2.CreateBucketRegistrationOptions) - createBucketRegistrationOptionsModel.BucketType = core.StringPtr("ibm_cos") - createBucketRegistrationOptionsModel.Description = core.StringPtr("COS bucket for customer data") - createBucketRegistrationOptionsModel.ManagedBy = core.StringPtr("ibm") - createBucketRegistrationOptionsModel.AssociatedCatalog = bucketCatalogModel - createBucketRegistrationOptionsModel.BucketDetails = bucketDetailsModel - createBucketRegistrationOptionsModel.BucketDisplayName = core.StringPtr("sample-bucket-displayname") - createBucketRegistrationOptionsModel.Region = core.StringPtr("us-south") - createBucketRegistrationOptionsModel.StorageDetails = storageDetailsModel - createBucketRegistrationOptionsModel.Tags = []string{"bucket-tag1", "bucket-tag2"} - createBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListStorageRegistrationsOptions model + listStorageRegistrationsOptionsModel := new(watsonxdatav3.ListStorageRegistrationsOptions) + listStorageRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listStorageRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateBucketRegistration(createBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.ListStorageRegistrations(listStorageRegistrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateBucketRegistrationOptions model with no property values - createBucketRegistrationOptionsModelNew := new(watsonxdatav2.CreateBucketRegistrationOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateBucketRegistration(createBucketRegistrationOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -749,62 +661,24 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateBucketRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListStorageRegistrations successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the BucketCatalog model - bucketCatalogModel := new(watsonxdatav2.BucketCatalog) - bucketCatalogModel.BasePath = core.StringPtr("/abc/def") - bucketCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - bucketCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - bucketCatalogModel.CatalogType = core.StringPtr("iceberg") - - // Construct an instance of the BucketDetails model - bucketDetailsModel := new(watsonxdatav2.BucketDetails) - bucketDetailsModel.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - bucketDetailsModel.BucketName = core.StringPtr("sample-bucket") - bucketDetailsModel.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - bucketDetailsModel.KeyFile = core.StringPtr("key_file") - bucketDetailsModel.Provider = core.StringPtr("ibm_cos") - bucketDetailsModel.Region = core.StringPtr("us-south") - bucketDetailsModel.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") - - // Construct an instance of the StorageDetails model - storageDetailsModel := new(watsonxdatav2.StorageDetails) - storageDetailsModel.AccessKey = core.StringPtr("") - storageDetailsModel.ApplicationID = core.StringPtr("") - storageDetailsModel.AuthMode = core.StringPtr("") - storageDetailsModel.ContainerName = core.StringPtr("sample-container") - storageDetailsModel.DirectoryID = core.StringPtr("") - storageDetailsModel.Endpoint = core.StringPtr("abfss://@.dfs.core.windows.net/") - storageDetailsModel.SasToken = core.StringPtr("") - storageDetailsModel.SecretKey = core.StringPtr("secret_key") - storageDetailsModel.StorageAccountName = core.StringPtr("sample-storage") - - // Construct an instance of the CreateBucketRegistrationOptions model - createBucketRegistrationOptionsModel := new(watsonxdatav2.CreateBucketRegistrationOptions) - createBucketRegistrationOptionsModel.BucketType = core.StringPtr("ibm_cos") - createBucketRegistrationOptionsModel.Description = core.StringPtr("COS bucket for customer data") - createBucketRegistrationOptionsModel.ManagedBy = core.StringPtr("ibm") - createBucketRegistrationOptionsModel.AssociatedCatalog = bucketCatalogModel - createBucketRegistrationOptionsModel.BucketDetails = bucketDetailsModel - createBucketRegistrationOptionsModel.BucketDisplayName = core.StringPtr("sample-bucket-displayname") - createBucketRegistrationOptionsModel.Region = core.StringPtr("us-south") - createBucketRegistrationOptionsModel.StorageDetails = storageDetailsModel - createBucketRegistrationOptionsModel.Tags = []string{"bucket-tag1", "bucket-tag2"} - createBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListStorageRegistrationsOptions model + listStorageRegistrationsOptionsModel := new(watsonxdatav3.ListStorageRegistrationsOptions) + listStorageRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listStorageRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateBucketRegistration(createBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.ListStorageRegistrations(listStorageRegistrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -816,45 +690,86 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetBucketRegistration(getBucketRegistrationOptions *GetBucketRegistrationOptions) - Operation response error`, func() { - getBucketRegistrationPath := "/bucket_registrations/testString" + Describe(`CreateStorageRegistration(createStorageRegistrationOptions *CreateStorageRegistrationOptions) - Operation response error`, func() { + createStorageRegistrationPath := "/v3/storage_registrations" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBucketRegistrationPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createStorageRegistrationPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBucketRegistration with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateStorageRegistration with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetBucketRegistrationOptions model - getBucketRegistrationOptionsModel := new(watsonxdatav2.GetBucketRegistrationOptions) - getBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - getBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - getBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the StorageCatalogPrototype model + storageCatalogPrototypeModel := new(watsonxdatav3.StorageCatalogPrototype) + storageCatalogPrototypeModel.BasePath = core.StringPtr("/abc/def") + storageCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + storageCatalogPrototypeModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + storageCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + + // Construct an instance of the StorageDetailsAccesskeyVault model + storageDetailsAccesskeyVaultModel := new(watsonxdatav3.StorageDetailsAccesskeyVault) + storageDetailsAccesskeyVaultModel.Key = core.StringPtr("secret key") + storageDetailsAccesskeyVaultModel.SecretName = core.StringPtr("secret name") + storageDetailsAccesskeyVaultModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the StorageDetails model + storageDetailsModel := new(watsonxdatav3.StorageDetails) + storageDetailsModel.AccessKey = core.StringPtr("") + storageDetailsModel.AccessKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.AccountName = core.StringPtr("sample-storage") + storageDetailsModel.ApplicationID = core.StringPtr("application-id") + storageDetailsModel.AuthMode = core.StringPtr("iam") + storageDetailsModel.ContainerName = core.StringPtr("sample-container") + storageDetailsModel.DirectoryID = core.StringPtr("directory-id") + storageDetailsModel.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + storageDetailsModel.KeyFile = core.StringPtr("key_file") + storageDetailsModel.Name = core.StringPtr("sample-storage") + storageDetailsModel.Provider = core.StringPtr("ibm-cos") + storageDetailsModel.Region = core.StringPtr("us-south") + storageDetailsModel.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + storageDetailsModel.SasToken = core.StringPtr("") + storageDetailsModel.SecretKey = core.StringPtr("secret_key") + storageDetailsModel.SecretKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.VaultEnabled = core.BoolPtr(true) + + // Construct an instance of the CreateStorageRegistrationOptions model + createStorageRegistrationOptionsModel := new(watsonxdatav3.CreateStorageRegistrationOptions) + createStorageRegistrationOptionsModel.Description = core.StringPtr("COS storage for customer data") + createStorageRegistrationOptionsModel.DisplayName = core.StringPtr("sample-storage-displayname") + createStorageRegistrationOptionsModel.ManagedBy = core.StringPtr("ibm") + createStorageRegistrationOptionsModel.Type = core.StringPtr("ibm_cos") + createStorageRegistrationOptionsModel.AssociatedCatalog = storageCatalogPrototypeModel + createStorageRegistrationOptionsModel.Connection = storageDetailsModel + createStorageRegistrationOptionsModel.Region = core.StringPtr("us-south") + createStorageRegistrationOptionsModel.StorageUse = core.StringPtr("acl") + createStorageRegistrationOptionsModel.Tags = []string{"storage-tag1", "storage-tag2"} + createStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetBucketRegistration(getBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.CreateStorageRegistration(createStorageRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetBucketRegistration(getBucketRegistrationOptionsModel) + result, response, operationErr = watsonxDataService.CreateStorageRegistration(createStorageRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -864,16 +779,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetBucketRegistration(getBucketRegistrationOptions *GetBucketRegistrationOptions)`, func() { - getBucketRegistrationPath := "/bucket_registrations/testString" + Describe(`CreateStorageRegistration(createStorageRegistrationOptions *CreateStorageRegistrationOptions)`, func() { + createStorageRegistrationPath := "/v3/storage_registrations" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBucketRegistrationPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createStorageRegistrationPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -882,12 +813,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "bucket_details": {"access_key": "b9cbf248ea5c4c96947e64407108559j", "bucket_name": "sample-bucket", "endpoint": "https://s3..cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "provider": "ibm_cos", "region": "us-south", "secret_key": "13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87"}, "bucket_display_name": "sample-bucket-displayname", "bucket_id": "samplebucket123", "bucket_type": "ibm_cos", "created_by": "@.com", "created_on": "1686120645", "description": "COS bucket for customer data", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_details": {"access_key": "", "application_id": "", "auth_mode": "", "container_name": "sample-container", "directory_id": "", "endpoint": "abfss://@.dfs.core.windows.net/", "sas_token": "", "secret_key": "secret_key", "storage_account_name": "sample-storage"}, "tags": ["Tags"]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": [{"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}], "connection": {"access_key": "", "access_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "account_name": "sample-storage", "application_id": "application-id", "auth_mode": "iam", "container_name": "sample-container", "directory_id": "directory-id", "endpoint": "https://s3.us-south.cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "name": "sample-storage", "provider": "ibm-cos", "region": "us-south", "role_arn": "arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9", "sas_token": "", "secret_key": "secret_key", "secret_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true}, "created_at": "1686120645", "created_by": "@.com", "description": "COS storage for customer data", "display_name": "sample-storage-displayname", "id": "samplestorage123", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_use": "acl", "system_storage_update_credentials": true, "tags": ["Tags"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "type": "ibm_cos", "vault_enabled": true}`) })) }) - It(`Invoke GetBucketRegistration successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateStorageRegistration successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -895,22 +826,63 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetBucketRegistrationOptions model - getBucketRegistrationOptionsModel := new(watsonxdatav2.GetBucketRegistrationOptions) - getBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - getBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - getBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the StorageCatalogPrototype model + storageCatalogPrototypeModel := new(watsonxdatav3.StorageCatalogPrototype) + storageCatalogPrototypeModel.BasePath = core.StringPtr("/abc/def") + storageCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + storageCatalogPrototypeModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + storageCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + + // Construct an instance of the StorageDetailsAccesskeyVault model + storageDetailsAccesskeyVaultModel := new(watsonxdatav3.StorageDetailsAccesskeyVault) + storageDetailsAccesskeyVaultModel.Key = core.StringPtr("secret key") + storageDetailsAccesskeyVaultModel.SecretName = core.StringPtr("secret name") + storageDetailsAccesskeyVaultModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the StorageDetails model + storageDetailsModel := new(watsonxdatav3.StorageDetails) + storageDetailsModel.AccessKey = core.StringPtr("") + storageDetailsModel.AccessKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.AccountName = core.StringPtr("sample-storage") + storageDetailsModel.ApplicationID = core.StringPtr("application-id") + storageDetailsModel.AuthMode = core.StringPtr("iam") + storageDetailsModel.ContainerName = core.StringPtr("sample-container") + storageDetailsModel.DirectoryID = core.StringPtr("directory-id") + storageDetailsModel.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + storageDetailsModel.KeyFile = core.StringPtr("key_file") + storageDetailsModel.Name = core.StringPtr("sample-storage") + storageDetailsModel.Provider = core.StringPtr("ibm-cos") + storageDetailsModel.Region = core.StringPtr("us-south") + storageDetailsModel.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + storageDetailsModel.SasToken = core.StringPtr("") + storageDetailsModel.SecretKey = core.StringPtr("secret_key") + storageDetailsModel.SecretKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.VaultEnabled = core.BoolPtr(true) + + // Construct an instance of the CreateStorageRegistrationOptions model + createStorageRegistrationOptionsModel := new(watsonxdatav3.CreateStorageRegistrationOptions) + createStorageRegistrationOptionsModel.Description = core.StringPtr("COS storage for customer data") + createStorageRegistrationOptionsModel.DisplayName = core.StringPtr("sample-storage-displayname") + createStorageRegistrationOptionsModel.ManagedBy = core.StringPtr("ibm") + createStorageRegistrationOptionsModel.Type = core.StringPtr("ibm_cos") + createStorageRegistrationOptionsModel.AssociatedCatalog = storageCatalogPrototypeModel + createStorageRegistrationOptionsModel.Connection = storageDetailsModel + createStorageRegistrationOptionsModel.Region = core.StringPtr("us-south") + createStorageRegistrationOptionsModel.StorageUse = core.StringPtr("acl") + createStorageRegistrationOptionsModel.Tags = []string{"storage-tag1", "storage-tag2"} + createStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetBucketRegistrationWithContext(ctx, getBucketRegistrationOptionsModel) + _, _, operationErr := watsonxDataService.CreateStorageRegistrationWithContext(ctx, createStorageRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetBucketRegistration(getBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.CreateStorageRegistration(createStorageRegistrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -918,7 +890,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetBucketRegistrationWithContext(ctx, getBucketRegistrationOptionsModel) + _, _, operationErr = watsonxDataService.CreateStorageRegistrationWithContext(ctx, createStorageRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -932,19 +904,386 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBucketRegistrationPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createStorageRegistrationPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": [{"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}], "connection": {"access_key": "", "access_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "account_name": "sample-storage", "application_id": "application-id", "auth_mode": "iam", "container_name": "sample-container", "directory_id": "directory-id", "endpoint": "https://s3.us-south.cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "name": "sample-storage", "provider": "ibm-cos", "region": "us-south", "role_arn": "arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9", "sas_token": "", "secret_key": "secret_key", "secret_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true}, "created_at": "1686120645", "created_by": "@.com", "description": "COS storage for customer data", "display_name": "sample-storage-displayname", "id": "samplestorage123", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_use": "acl", "system_storage_update_credentials": true, "tags": ["Tags"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "type": "ibm_cos", "vault_enabled": true}`) + })) + }) + It(`Invoke CreateStorageRegistration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + result, response, operationErr := watsonxDataService.CreateStorageRegistration(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the StorageCatalogPrototype model + storageCatalogPrototypeModel := new(watsonxdatav3.StorageCatalogPrototype) + storageCatalogPrototypeModel.BasePath = core.StringPtr("/abc/def") + storageCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + storageCatalogPrototypeModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + storageCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + + // Construct an instance of the StorageDetailsAccesskeyVault model + storageDetailsAccesskeyVaultModel := new(watsonxdatav3.StorageDetailsAccesskeyVault) + storageDetailsAccesskeyVaultModel.Key = core.StringPtr("secret key") + storageDetailsAccesskeyVaultModel.SecretName = core.StringPtr("secret name") + storageDetailsAccesskeyVaultModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the StorageDetails model + storageDetailsModel := new(watsonxdatav3.StorageDetails) + storageDetailsModel.AccessKey = core.StringPtr("") + storageDetailsModel.AccessKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.AccountName = core.StringPtr("sample-storage") + storageDetailsModel.ApplicationID = core.StringPtr("application-id") + storageDetailsModel.AuthMode = core.StringPtr("iam") + storageDetailsModel.ContainerName = core.StringPtr("sample-container") + storageDetailsModel.DirectoryID = core.StringPtr("directory-id") + storageDetailsModel.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + storageDetailsModel.KeyFile = core.StringPtr("key_file") + storageDetailsModel.Name = core.StringPtr("sample-storage") + storageDetailsModel.Provider = core.StringPtr("ibm-cos") + storageDetailsModel.Region = core.StringPtr("us-south") + storageDetailsModel.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + storageDetailsModel.SasToken = core.StringPtr("") + storageDetailsModel.SecretKey = core.StringPtr("secret_key") + storageDetailsModel.SecretKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.VaultEnabled = core.BoolPtr(true) + + // Construct an instance of the CreateStorageRegistrationOptions model + createStorageRegistrationOptionsModel := new(watsonxdatav3.CreateStorageRegistrationOptions) + createStorageRegistrationOptionsModel.Description = core.StringPtr("COS storage for customer data") + createStorageRegistrationOptionsModel.DisplayName = core.StringPtr("sample-storage-displayname") + createStorageRegistrationOptionsModel.ManagedBy = core.StringPtr("ibm") + createStorageRegistrationOptionsModel.Type = core.StringPtr("ibm_cos") + createStorageRegistrationOptionsModel.AssociatedCatalog = storageCatalogPrototypeModel + createStorageRegistrationOptionsModel.Connection = storageDetailsModel + createStorageRegistrationOptionsModel.Region = core.StringPtr("us-south") + createStorageRegistrationOptionsModel.StorageUse = core.StringPtr("acl") + createStorageRegistrationOptionsModel.Tags = []string{"storage-tag1", "storage-tag2"} + createStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = watsonxDataService.CreateStorageRegistration(createStorageRegistrationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + }) + It(`Invoke CreateStorageRegistration with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the StorageCatalogPrototype model + storageCatalogPrototypeModel := new(watsonxdatav3.StorageCatalogPrototype) + storageCatalogPrototypeModel.BasePath = core.StringPtr("/abc/def") + storageCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + storageCatalogPrototypeModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + storageCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + + // Construct an instance of the StorageDetailsAccesskeyVault model + storageDetailsAccesskeyVaultModel := new(watsonxdatav3.StorageDetailsAccesskeyVault) + storageDetailsAccesskeyVaultModel.Key = core.StringPtr("secret key") + storageDetailsAccesskeyVaultModel.SecretName = core.StringPtr("secret name") + storageDetailsAccesskeyVaultModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the StorageDetails model + storageDetailsModel := new(watsonxdatav3.StorageDetails) + storageDetailsModel.AccessKey = core.StringPtr("") + storageDetailsModel.AccessKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.AccountName = core.StringPtr("sample-storage") + storageDetailsModel.ApplicationID = core.StringPtr("application-id") + storageDetailsModel.AuthMode = core.StringPtr("iam") + storageDetailsModel.ContainerName = core.StringPtr("sample-container") + storageDetailsModel.DirectoryID = core.StringPtr("directory-id") + storageDetailsModel.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + storageDetailsModel.KeyFile = core.StringPtr("key_file") + storageDetailsModel.Name = core.StringPtr("sample-storage") + storageDetailsModel.Provider = core.StringPtr("ibm-cos") + storageDetailsModel.Region = core.StringPtr("us-south") + storageDetailsModel.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + storageDetailsModel.SasToken = core.StringPtr("") + storageDetailsModel.SecretKey = core.StringPtr("secret_key") + storageDetailsModel.SecretKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.VaultEnabled = core.BoolPtr(true) + + // Construct an instance of the CreateStorageRegistrationOptions model + createStorageRegistrationOptionsModel := new(watsonxdatav3.CreateStorageRegistrationOptions) + createStorageRegistrationOptionsModel.Description = core.StringPtr("COS storage for customer data") + createStorageRegistrationOptionsModel.DisplayName = core.StringPtr("sample-storage-displayname") + createStorageRegistrationOptionsModel.ManagedBy = core.StringPtr("ibm") + createStorageRegistrationOptionsModel.Type = core.StringPtr("ibm_cos") + createStorageRegistrationOptionsModel.AssociatedCatalog = storageCatalogPrototypeModel + createStorageRegistrationOptionsModel.Connection = storageDetailsModel + createStorageRegistrationOptionsModel.Region = core.StringPtr("us-south") + createStorageRegistrationOptionsModel.StorageUse = core.StringPtr("acl") + createStorageRegistrationOptionsModel.Tags = []string{"storage-tag1", "storage-tag2"} + createStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := watsonxDataService.CreateStorageRegistration(createStorageRegistrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + // Construct a second instance of the CreateStorageRegistrationOptions model with no property values + createStorageRegistrationOptionsModelNew := new(watsonxdatav3.CreateStorageRegistrationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.CreateStorageRegistration(createStorageRegistrationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Set success status code with no respoonse body + res.WriteHeader(201) + })) + }) + It(`Invoke CreateStorageRegistration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the StorageCatalogPrototype model + storageCatalogPrototypeModel := new(watsonxdatav3.StorageCatalogPrototype) + storageCatalogPrototypeModel.BasePath = core.StringPtr("/abc/def") + storageCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + storageCatalogPrototypeModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + storageCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + + // Construct an instance of the StorageDetailsAccesskeyVault model + storageDetailsAccesskeyVaultModel := new(watsonxdatav3.StorageDetailsAccesskeyVault) + storageDetailsAccesskeyVaultModel.Key = core.StringPtr("secret key") + storageDetailsAccesskeyVaultModel.SecretName = core.StringPtr("secret name") + storageDetailsAccesskeyVaultModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the StorageDetails model + storageDetailsModel := new(watsonxdatav3.StorageDetails) + storageDetailsModel.AccessKey = core.StringPtr("") + storageDetailsModel.AccessKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.AccountName = core.StringPtr("sample-storage") + storageDetailsModel.ApplicationID = core.StringPtr("application-id") + storageDetailsModel.AuthMode = core.StringPtr("iam") + storageDetailsModel.ContainerName = core.StringPtr("sample-container") + storageDetailsModel.DirectoryID = core.StringPtr("directory-id") + storageDetailsModel.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + storageDetailsModel.KeyFile = core.StringPtr("key_file") + storageDetailsModel.Name = core.StringPtr("sample-storage") + storageDetailsModel.Provider = core.StringPtr("ibm-cos") + storageDetailsModel.Region = core.StringPtr("us-south") + storageDetailsModel.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + storageDetailsModel.SasToken = core.StringPtr("") + storageDetailsModel.SecretKey = core.StringPtr("secret_key") + storageDetailsModel.SecretKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.VaultEnabled = core.BoolPtr(true) + + // Construct an instance of the CreateStorageRegistrationOptions model + createStorageRegistrationOptionsModel := new(watsonxdatav3.CreateStorageRegistrationOptions) + createStorageRegistrationOptionsModel.Description = core.StringPtr("COS storage for customer data") + createStorageRegistrationOptionsModel.DisplayName = core.StringPtr("sample-storage-displayname") + createStorageRegistrationOptionsModel.ManagedBy = core.StringPtr("ibm") + createStorageRegistrationOptionsModel.Type = core.StringPtr("ibm_cos") + createStorageRegistrationOptionsModel.AssociatedCatalog = storageCatalogPrototypeModel + createStorageRegistrationOptionsModel.Connection = storageDetailsModel + createStorageRegistrationOptionsModel.Region = core.StringPtr("us-south") + createStorageRegistrationOptionsModel.StorageUse = core.StringPtr("acl") + createStorageRegistrationOptionsModel.Tags = []string{"storage-tag1", "storage-tag2"} + createStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation + result, response, operationErr := watsonxDataService.CreateStorageRegistration(createStorageRegistrationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetStorageRegistration(getStorageRegistrationOptions *GetStorageRegistrationOptions) - Operation response error`, func() { + getStorageRegistrationPath := "/v3/storage_registrations/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getStorageRegistrationPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for skip_mds_call query parameter + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetStorageRegistration with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the GetStorageRegistrationOptions model + getStorageRegistrationOptionsModel := new(watsonxdatav3.GetStorageRegistrationOptions) + getStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + getStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + getStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := watsonxDataService.GetStorageRegistration(getStorageRegistrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + watsonxDataService.EnableRetries(0, 0) + result, response, operationErr = watsonxDataService.GetStorageRegistration(getStorageRegistrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetStorageRegistration(getStorageRegistrationOptions *GetStorageRegistrationOptions)`, func() { + getStorageRegistrationPath := "/v3/storage_registrations/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getStorageRegistrationPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for skip_mds_call query parameter + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": [{"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}], "connection": {"access_key": "", "access_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "account_name": "sample-storage", "application_id": "application-id", "auth_mode": "iam", "container_name": "sample-container", "directory_id": "directory-id", "endpoint": "https://s3.us-south.cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "name": "sample-storage", "provider": "ibm-cos", "region": "us-south", "role_arn": "arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9", "sas_token": "", "secret_key": "secret_key", "secret_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true}, "created_at": "1686120645", "created_by": "@.com", "description": "COS storage for customer data", "display_name": "sample-storage-displayname", "id": "samplestorage123", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_use": "acl", "system_storage_update_credentials": true, "tags": ["Tags"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "type": "ibm_cos", "vault_enabled": true}`) + })) + }) + It(`Invoke GetStorageRegistration successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + watsonxDataService.EnableRetries(0, 0) + + // Construct an instance of the GetStorageRegistrationOptions model + getStorageRegistrationOptionsModel := new(watsonxdatav3.GetStorageRegistrationOptions) + getStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + getStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + getStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := watsonxDataService.GetStorageRegistrationWithContext(ctx, getStorageRegistrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + watsonxDataService.DisableRetries() + result, response, operationErr := watsonxDataService.GetStorageRegistration(getStorageRegistrationOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = watsonxDataService.GetStorageRegistrationWithContext(ctx, getStorageRegistrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getStorageRegistrationPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for skip_mds_call query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "bucket_details": {"access_key": "b9cbf248ea5c4c96947e64407108559j", "bucket_name": "sample-bucket", "endpoint": "https://s3..cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "provider": "ibm_cos", "region": "us-south", "secret_key": "13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87"}, "bucket_display_name": "sample-bucket-displayname", "bucket_id": "samplebucket123", "bucket_type": "ibm_cos", "created_by": "@.com", "created_on": "1686120645", "description": "COS bucket for customer data", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_details": {"access_key": "", "application_id": "", "auth_mode": "", "container_name": "sample-container", "directory_id": "", "endpoint": "abfss://@.dfs.core.windows.net/", "sas_token": "", "secret_key": "secret_key", "storage_account_name": "sample-storage"}, "tags": ["Tags"]}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": [{"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}], "connection": {"access_key": "", "access_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "account_name": "sample-storage", "application_id": "application-id", "auth_mode": "iam", "container_name": "sample-container", "directory_id": "directory-id", "endpoint": "https://s3.us-south.cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "name": "sample-storage", "provider": "ibm-cos", "region": "us-south", "role_arn": "arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9", "sas_token": "", "secret_key": "secret_key", "secret_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true}, "created_at": "1686120645", "created_by": "@.com", "description": "COS storage for customer data", "display_name": "sample-storage-displayname", "id": "samplestorage123", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_use": "acl", "system_storage_update_credentials": true, "tags": ["Tags"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "type": "ibm_cos", "vault_enabled": true}`) })) }) - It(`Invoke GetBucketRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetStorageRegistration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -952,49 +1291,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetBucketRegistration(nil) + result, response, operationErr := watsonxDataService.GetStorageRegistration(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetBucketRegistrationOptions model - getBucketRegistrationOptionsModel := new(watsonxdatav2.GetBucketRegistrationOptions) - getBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - getBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - getBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetStorageRegistrationOptions model + getStorageRegistrationOptionsModel := new(watsonxdatav3.GetStorageRegistrationOptions) + getStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + getStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + getStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetBucketRegistration(getBucketRegistrationOptionsModel) + result, response, operationErr = watsonxDataService.GetStorageRegistration(getStorageRegistrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBucketRegistration with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetStorageRegistration with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetBucketRegistrationOptions model - getBucketRegistrationOptionsModel := new(watsonxdatav2.GetBucketRegistrationOptions) - getBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - getBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - getBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetStorageRegistrationOptions model + getStorageRegistrationOptionsModel := new(watsonxdatav3.GetStorageRegistrationOptions) + getStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + getStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + getStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetBucketRegistration(getBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.GetStorageRegistration(getStorageRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBucketRegistrationOptions model with no property values - getBucketRegistrationOptionsModelNew := new(watsonxdatav2.GetBucketRegistrationOptions) + // Construct a second instance of the GetStorageRegistrationOptions model with no property values + getStorageRegistrationOptionsModelNew := new(watsonxdatav3.GetStorageRegistrationOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetBucketRegistration(getBucketRegistrationOptionsModelNew) + result, response, operationErr = watsonxDataService.GetStorageRegistration(getStorageRegistrationOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -1012,22 +1353,23 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetBucketRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetStorageRegistration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetBucketRegistrationOptions model - getBucketRegistrationOptionsModel := new(watsonxdatav2.GetBucketRegistrationOptions) - getBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - getBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - getBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetStorageRegistrationOptions model + getStorageRegistrationOptionsModel := new(watsonxdatav3.GetStorageRegistrationOptions) + getStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + getStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + getStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetBucketRegistration(getBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.GetStorageRegistration(getStorageRegistrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -1039,24 +1381,25 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteBucketRegistration(deleteBucketRegistrationOptions *DeleteBucketRegistrationOptions)`, func() { - deleteBucketRegistrationPath := "/bucket_registrations/testString" + Describe(`DeleteStorageRegistration(deleteStorageRegistrationOptions *DeleteStorageRegistrationOptions)`, func() { + deleteStorageRegistrationPath := "/v3/storage_registrations/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteBucketRegistrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteStorageRegistrationPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for skip_mds_call query parameter res.WriteHeader(204) })) }) - It(`Invoke DeleteBucketRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteStorageRegistration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -1064,45 +1407,47 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteBucketRegistration(nil) + response, operationErr := watsonxDataService.DeleteStorageRegistration(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteBucketRegistrationOptions model - deleteBucketRegistrationOptionsModel := new(watsonxdatav2.DeleteBucketRegistrationOptions) - deleteBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - deleteBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteStorageRegistrationOptions model + deleteStorageRegistrationOptionsModel := new(watsonxdatav3.DeleteStorageRegistrationOptions) + deleteStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + deleteStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + deleteStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteBucketRegistration(deleteBucketRegistrationOptionsModel) + response, operationErr = watsonxDataService.DeleteStorageRegistration(deleteStorageRegistrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteBucketRegistration with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteStorageRegistration with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DeleteBucketRegistrationOptions model - deleteBucketRegistrationOptionsModel := new(watsonxdatav2.DeleteBucketRegistrationOptions) - deleteBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - deleteBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteStorageRegistrationOptions model + deleteStorageRegistrationOptionsModel := new(watsonxdatav3.DeleteStorageRegistrationOptions) + deleteStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + deleteStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + deleteStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteBucketRegistration(deleteBucketRegistrationOptionsModel) + response, operationErr := watsonxDataService.DeleteStorageRegistration(deleteStorageRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteBucketRegistrationOptions model with no property values - deleteBucketRegistrationOptionsModelNew := new(watsonxdatav2.DeleteBucketRegistrationOptions) + // Construct a second instance of the DeleteStorageRegistrationOptions model with no property values + deleteStorageRegistrationOptionsModelNew := new(watsonxdatav3.DeleteStorageRegistrationOptions) // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteBucketRegistration(deleteBucketRegistrationOptionsModelNew) + response, operationErr = watsonxDataService.DeleteStorageRegistration(deleteStorageRegistrationOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -1111,65 +1456,84 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateBucketRegistration(updateBucketRegistrationOptions *UpdateBucketRegistrationOptions) - Operation response error`, func() { - updateBucketRegistrationPath := "/bucket_registrations/testString" + Describe(`UpdateStorageRegistration(updateStorageRegistrationOptions *UpdateStorageRegistrationOptions) - Operation response error`, func() { + updateStorageRegistrationPath := "/v3/storage_registrations/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBucketRegistrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateStorageRegistrationPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for skip_mds_call query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateBucketRegistration with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateStorageRegistration with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the BucketDetails model - bucketDetailsModel := new(watsonxdatav2.BucketDetails) - bucketDetailsModel.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - bucketDetailsModel.BucketName = core.StringPtr("sample-bucket") - bucketDetailsModel.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - bucketDetailsModel.KeyFile = core.StringPtr("key_file") - bucketDetailsModel.Provider = core.StringPtr("ibm_cos") - bucketDetailsModel.Region = core.StringPtr("us-south") - bucketDetailsModel.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") - - // Construct an instance of the BucketRegistrationPatch model - bucketRegistrationPatchModel := new(watsonxdatav2.BucketRegistrationPatch) - bucketRegistrationPatchModel.BucketDetails = bucketDetailsModel - bucketRegistrationPatchModel.BucketDisplayName = core.StringPtr("sample-bucket-displayname") - bucketRegistrationPatchModel.Description = core.StringPtr("COS bucket for customer data") - bucketRegistrationPatchModel.Tags = []string{"testbucket", "userbucket"} - bucketRegistrationPatchModelAsPatch, asPatchErr := bucketRegistrationPatchModel.AsPatch() + // Construct an instance of the StorageDetailsAccesskeyVault model + storageDetailsAccesskeyVaultModel := new(watsonxdatav3.StorageDetailsAccesskeyVault) + storageDetailsAccesskeyVaultModel.Key = core.StringPtr("secret key") + storageDetailsAccesskeyVaultModel.SecretName = core.StringPtr("secret name") + storageDetailsAccesskeyVaultModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the StorageDetails model + storageDetailsModel := new(watsonxdatav3.StorageDetails) + storageDetailsModel.AccessKey = core.StringPtr("") + storageDetailsModel.AccessKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.AccountName = core.StringPtr("sample-storage") + storageDetailsModel.ApplicationID = core.StringPtr("application-id") + storageDetailsModel.AuthMode = core.StringPtr("iam") + storageDetailsModel.ContainerName = core.StringPtr("sample-container") + storageDetailsModel.DirectoryID = core.StringPtr("directory-id") + storageDetailsModel.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + storageDetailsModel.KeyFile = core.StringPtr("key_file") + storageDetailsModel.Name = core.StringPtr("sample-storage") + storageDetailsModel.Provider = core.StringPtr("ibm-cos") + storageDetailsModel.Region = core.StringPtr("us-south") + storageDetailsModel.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + storageDetailsModel.SasToken = core.StringPtr("") + storageDetailsModel.SecretKey = core.StringPtr("secret_key") + storageDetailsModel.SecretKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.VaultEnabled = core.BoolPtr(true) + + // Construct an instance of the StorageRegistrationPatch model + storageRegistrationPatchModel := new(watsonxdatav3.StorageRegistrationPatch) + storageRegistrationPatchModel.Connection = storageDetailsModel + storageRegistrationPatchModel.Description = core.StringPtr("COS storage for customer data") + storageRegistrationPatchModel.DisplayName = core.StringPtr("sample-storage-displayname") + storageRegistrationPatchModel.SystemStorageUpdateCredentials = core.BoolPtr(true) + storageRegistrationPatchModel.Tags = []string{"teststorage", "userstorage"} + storageRegistrationPatchModelAsPatch, asPatchErr := storageRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateBucketRegistrationOptions model - updateBucketRegistrationOptionsModel := new(watsonxdatav2.UpdateBucketRegistrationOptions) - updateBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - updateBucketRegistrationOptionsModel.Body = bucketRegistrationPatchModelAsPatch - updateBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateStorageRegistrationOptions model + updateStorageRegistrationOptionsModel := new(watsonxdatav3.UpdateStorageRegistrationOptions) + updateStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + updateStorageRegistrationOptionsModel.Body = storageRegistrationPatchModelAsPatch + updateStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + updateStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateBucketRegistration(updateBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.UpdateStorageRegistration(updateStorageRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateBucketRegistration(updateBucketRegistrationOptionsModel) + result, response, operationErr = watsonxDataService.UpdateStorageRegistration(updateStorageRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -1179,15 +1543,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateBucketRegistration(updateBucketRegistrationOptions *UpdateBucketRegistrationOptions)`, func() { - updateBucketRegistrationPath := "/bucket_registrations/testString" + Describe(`UpdateStorageRegistration(updateStorageRegistrationOptions *UpdateStorageRegistrationOptions)`, func() { + updateStorageRegistrationPath := "/v3/storage_registrations/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBucketRegistrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateStorageRegistrationPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -1208,17 +1572,18 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for skip_mds_call query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "bucket_details": {"access_key": "b9cbf248ea5c4c96947e64407108559j", "bucket_name": "sample-bucket", "endpoint": "https://s3..cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "provider": "ibm_cos", "region": "us-south", "secret_key": "13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87"}, "bucket_display_name": "sample-bucket-displayname", "bucket_id": "samplebucket123", "bucket_type": "ibm_cos", "created_by": "@.com", "created_on": "1686120645", "description": "COS bucket for customer data", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_details": {"access_key": "", "application_id": "", "auth_mode": "", "container_name": "sample-container", "directory_id": "", "endpoint": "abfss://@.dfs.core.windows.net/", "sas_token": "", "secret_key": "secret_key", "storage_account_name": "sample-storage"}, "tags": ["Tags"]}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": [{"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}], "connection": {"access_key": "", "access_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "account_name": "sample-storage", "application_id": "application-id", "auth_mode": "iam", "container_name": "sample-container", "directory_id": "directory-id", "endpoint": "https://s3.us-south.cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "name": "sample-storage", "provider": "ibm-cos", "region": "us-south", "role_arn": "arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9", "sas_token": "", "secret_key": "secret_key", "secret_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true}, "created_at": "1686120645", "created_by": "@.com", "description": "COS storage for customer data", "display_name": "sample-storage-displayname", "id": "samplestorage123", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_use": "acl", "system_storage_update_credentials": true, "tags": ["Tags"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "type": "ibm_cos", "vault_enabled": true}`) })) }) - It(`Invoke UpdateBucketRegistration successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateStorageRegistration successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -1226,42 +1591,60 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the BucketDetails model - bucketDetailsModel := new(watsonxdatav2.BucketDetails) - bucketDetailsModel.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - bucketDetailsModel.BucketName = core.StringPtr("sample-bucket") - bucketDetailsModel.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - bucketDetailsModel.KeyFile = core.StringPtr("key_file") - bucketDetailsModel.Provider = core.StringPtr("ibm_cos") - bucketDetailsModel.Region = core.StringPtr("us-south") - bucketDetailsModel.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") - - // Construct an instance of the BucketRegistrationPatch model - bucketRegistrationPatchModel := new(watsonxdatav2.BucketRegistrationPatch) - bucketRegistrationPatchModel.BucketDetails = bucketDetailsModel - bucketRegistrationPatchModel.BucketDisplayName = core.StringPtr("sample-bucket-displayname") - bucketRegistrationPatchModel.Description = core.StringPtr("COS bucket for customer data") - bucketRegistrationPatchModel.Tags = []string{"testbucket", "userbucket"} - bucketRegistrationPatchModelAsPatch, asPatchErr := bucketRegistrationPatchModel.AsPatch() + // Construct an instance of the StorageDetailsAccesskeyVault model + storageDetailsAccesskeyVaultModel := new(watsonxdatav3.StorageDetailsAccesskeyVault) + storageDetailsAccesskeyVaultModel.Key = core.StringPtr("secret key") + storageDetailsAccesskeyVaultModel.SecretName = core.StringPtr("secret name") + storageDetailsAccesskeyVaultModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the StorageDetails model + storageDetailsModel := new(watsonxdatav3.StorageDetails) + storageDetailsModel.AccessKey = core.StringPtr("") + storageDetailsModel.AccessKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.AccountName = core.StringPtr("sample-storage") + storageDetailsModel.ApplicationID = core.StringPtr("application-id") + storageDetailsModel.AuthMode = core.StringPtr("iam") + storageDetailsModel.ContainerName = core.StringPtr("sample-container") + storageDetailsModel.DirectoryID = core.StringPtr("directory-id") + storageDetailsModel.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + storageDetailsModel.KeyFile = core.StringPtr("key_file") + storageDetailsModel.Name = core.StringPtr("sample-storage") + storageDetailsModel.Provider = core.StringPtr("ibm-cos") + storageDetailsModel.Region = core.StringPtr("us-south") + storageDetailsModel.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + storageDetailsModel.SasToken = core.StringPtr("") + storageDetailsModel.SecretKey = core.StringPtr("secret_key") + storageDetailsModel.SecretKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.VaultEnabled = core.BoolPtr(true) + + // Construct an instance of the StorageRegistrationPatch model + storageRegistrationPatchModel := new(watsonxdatav3.StorageRegistrationPatch) + storageRegistrationPatchModel.Connection = storageDetailsModel + storageRegistrationPatchModel.Description = core.StringPtr("COS storage for customer data") + storageRegistrationPatchModel.DisplayName = core.StringPtr("sample-storage-displayname") + storageRegistrationPatchModel.SystemStorageUpdateCredentials = core.BoolPtr(true) + storageRegistrationPatchModel.Tags = []string{"teststorage", "userstorage"} + storageRegistrationPatchModelAsPatch, asPatchErr := storageRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateBucketRegistrationOptions model - updateBucketRegistrationOptionsModel := new(watsonxdatav2.UpdateBucketRegistrationOptions) - updateBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - updateBucketRegistrationOptionsModel.Body = bucketRegistrationPatchModelAsPatch - updateBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateStorageRegistrationOptions model + updateStorageRegistrationOptionsModel := new(watsonxdatav3.UpdateStorageRegistrationOptions) + updateStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + updateStorageRegistrationOptionsModel.Body = storageRegistrationPatchModelAsPatch + updateStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + updateStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateBucketRegistrationWithContext(ctx, updateBucketRegistrationOptionsModel) + _, _, operationErr := watsonxDataService.UpdateStorageRegistrationWithContext(ctx, updateStorageRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateBucketRegistration(updateBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.UpdateStorageRegistration(updateStorageRegistrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -1269,7 +1652,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateBucketRegistrationWithContext(ctx, updateBucketRegistrationOptionsModel) + _, _, operationErr = watsonxDataService.UpdateStorageRegistrationWithContext(ctx, updateStorageRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -1283,7 +1666,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateBucketRegistrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateStorageRegistrationPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -1304,14 +1687,15 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for skip_mds_call query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "bucket_details": {"access_key": "b9cbf248ea5c4c96947e64407108559j", "bucket_name": "sample-bucket", "endpoint": "https://s3..cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "provider": "ibm_cos", "region": "us-south", "secret_key": "13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87"}, "bucket_display_name": "sample-bucket-displayname", "bucket_id": "samplebucket123", "bucket_type": "ibm_cos", "created_by": "@.com", "created_on": "1686120645", "description": "COS bucket for customer data", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_details": {"access_key": "", "application_id": "", "auth_mode": "", "container_name": "sample-container", "directory_id": "", "endpoint": "abfss://@.dfs.core.windows.net/", "sas_token": "", "secret_key": "secret_key", "storage_account_name": "sample-storage"}, "tags": ["Tags"]}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": [{"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}], "connection": {"access_key": "", "access_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "account_name": "sample-storage", "application_id": "application-id", "auth_mode": "iam", "container_name": "sample-container", "directory_id": "directory-id", "endpoint": "https://s3.us-south.cloud-object-storage.appdomain.cloud/", "key_file": "key_file", "name": "sample-storage", "provider": "ibm-cos", "region": "us-south", "role_arn": "arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9", "sas_token": "", "secret_key": "secret_key", "secret_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true}, "created_at": "1686120645", "created_by": "@.com", "description": "COS storage for customer data", "display_name": "sample-storage-displayname", "id": "samplestorage123", "managed_by": "ibm", "region": "us-south", "state": "active", "storage_use": "acl", "system_storage_update_credentials": true, "tags": ["Tags"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "type": "ibm_cos", "vault_enabled": true}`) })) }) - It(`Invoke UpdateBucketRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateStorageRegistration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -1319,89 +1703,125 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateBucketRegistration(nil) + result, response, operationErr := watsonxDataService.UpdateStorageRegistration(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the BucketDetails model - bucketDetailsModel := new(watsonxdatav2.BucketDetails) - bucketDetailsModel.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - bucketDetailsModel.BucketName = core.StringPtr("sample-bucket") - bucketDetailsModel.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - bucketDetailsModel.KeyFile = core.StringPtr("key_file") - bucketDetailsModel.Provider = core.StringPtr("ibm_cos") - bucketDetailsModel.Region = core.StringPtr("us-south") - bucketDetailsModel.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") - - // Construct an instance of the BucketRegistrationPatch model - bucketRegistrationPatchModel := new(watsonxdatav2.BucketRegistrationPatch) - bucketRegistrationPatchModel.BucketDetails = bucketDetailsModel - bucketRegistrationPatchModel.BucketDisplayName = core.StringPtr("sample-bucket-displayname") - bucketRegistrationPatchModel.Description = core.StringPtr("COS bucket for customer data") - bucketRegistrationPatchModel.Tags = []string{"testbucket", "userbucket"} - bucketRegistrationPatchModelAsPatch, asPatchErr := bucketRegistrationPatchModel.AsPatch() + // Construct an instance of the StorageDetailsAccesskeyVault model + storageDetailsAccesskeyVaultModel := new(watsonxdatav3.StorageDetailsAccesskeyVault) + storageDetailsAccesskeyVaultModel.Key = core.StringPtr("secret key") + storageDetailsAccesskeyVaultModel.SecretName = core.StringPtr("secret name") + storageDetailsAccesskeyVaultModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the StorageDetails model + storageDetailsModel := new(watsonxdatav3.StorageDetails) + storageDetailsModel.AccessKey = core.StringPtr("") + storageDetailsModel.AccessKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.AccountName = core.StringPtr("sample-storage") + storageDetailsModel.ApplicationID = core.StringPtr("application-id") + storageDetailsModel.AuthMode = core.StringPtr("iam") + storageDetailsModel.ContainerName = core.StringPtr("sample-container") + storageDetailsModel.DirectoryID = core.StringPtr("directory-id") + storageDetailsModel.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + storageDetailsModel.KeyFile = core.StringPtr("key_file") + storageDetailsModel.Name = core.StringPtr("sample-storage") + storageDetailsModel.Provider = core.StringPtr("ibm-cos") + storageDetailsModel.Region = core.StringPtr("us-south") + storageDetailsModel.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + storageDetailsModel.SasToken = core.StringPtr("") + storageDetailsModel.SecretKey = core.StringPtr("secret_key") + storageDetailsModel.SecretKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.VaultEnabled = core.BoolPtr(true) + + // Construct an instance of the StorageRegistrationPatch model + storageRegistrationPatchModel := new(watsonxdatav3.StorageRegistrationPatch) + storageRegistrationPatchModel.Connection = storageDetailsModel + storageRegistrationPatchModel.Description = core.StringPtr("COS storage for customer data") + storageRegistrationPatchModel.DisplayName = core.StringPtr("sample-storage-displayname") + storageRegistrationPatchModel.SystemStorageUpdateCredentials = core.BoolPtr(true) + storageRegistrationPatchModel.Tags = []string{"teststorage", "userstorage"} + storageRegistrationPatchModelAsPatch, asPatchErr := storageRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateBucketRegistrationOptions model - updateBucketRegistrationOptionsModel := new(watsonxdatav2.UpdateBucketRegistrationOptions) - updateBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - updateBucketRegistrationOptionsModel.Body = bucketRegistrationPatchModelAsPatch - updateBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateStorageRegistrationOptions model + updateStorageRegistrationOptionsModel := new(watsonxdatav3.UpdateStorageRegistrationOptions) + updateStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + updateStorageRegistrationOptionsModel.Body = storageRegistrationPatchModelAsPatch + updateStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + updateStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateBucketRegistration(updateBucketRegistrationOptionsModel) + result, response, operationErr = watsonxDataService.UpdateStorageRegistration(updateStorageRegistrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateBucketRegistration with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateStorageRegistration with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the BucketDetails model - bucketDetailsModel := new(watsonxdatav2.BucketDetails) - bucketDetailsModel.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - bucketDetailsModel.BucketName = core.StringPtr("sample-bucket") - bucketDetailsModel.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - bucketDetailsModel.KeyFile = core.StringPtr("key_file") - bucketDetailsModel.Provider = core.StringPtr("ibm_cos") - bucketDetailsModel.Region = core.StringPtr("us-south") - bucketDetailsModel.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") - - // Construct an instance of the BucketRegistrationPatch model - bucketRegistrationPatchModel := new(watsonxdatav2.BucketRegistrationPatch) - bucketRegistrationPatchModel.BucketDetails = bucketDetailsModel - bucketRegistrationPatchModel.BucketDisplayName = core.StringPtr("sample-bucket-displayname") - bucketRegistrationPatchModel.Description = core.StringPtr("COS bucket for customer data") - bucketRegistrationPatchModel.Tags = []string{"testbucket", "userbucket"} - bucketRegistrationPatchModelAsPatch, asPatchErr := bucketRegistrationPatchModel.AsPatch() + // Construct an instance of the StorageDetailsAccesskeyVault model + storageDetailsAccesskeyVaultModel := new(watsonxdatav3.StorageDetailsAccesskeyVault) + storageDetailsAccesskeyVaultModel.Key = core.StringPtr("secret key") + storageDetailsAccesskeyVaultModel.SecretName = core.StringPtr("secret name") + storageDetailsAccesskeyVaultModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the StorageDetails model + storageDetailsModel := new(watsonxdatav3.StorageDetails) + storageDetailsModel.AccessKey = core.StringPtr("") + storageDetailsModel.AccessKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.AccountName = core.StringPtr("sample-storage") + storageDetailsModel.ApplicationID = core.StringPtr("application-id") + storageDetailsModel.AuthMode = core.StringPtr("iam") + storageDetailsModel.ContainerName = core.StringPtr("sample-container") + storageDetailsModel.DirectoryID = core.StringPtr("directory-id") + storageDetailsModel.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + storageDetailsModel.KeyFile = core.StringPtr("key_file") + storageDetailsModel.Name = core.StringPtr("sample-storage") + storageDetailsModel.Provider = core.StringPtr("ibm-cos") + storageDetailsModel.Region = core.StringPtr("us-south") + storageDetailsModel.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + storageDetailsModel.SasToken = core.StringPtr("") + storageDetailsModel.SecretKey = core.StringPtr("secret_key") + storageDetailsModel.SecretKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.VaultEnabled = core.BoolPtr(true) + + // Construct an instance of the StorageRegistrationPatch model + storageRegistrationPatchModel := new(watsonxdatav3.StorageRegistrationPatch) + storageRegistrationPatchModel.Connection = storageDetailsModel + storageRegistrationPatchModel.Description = core.StringPtr("COS storage for customer data") + storageRegistrationPatchModel.DisplayName = core.StringPtr("sample-storage-displayname") + storageRegistrationPatchModel.SystemStorageUpdateCredentials = core.BoolPtr(true) + storageRegistrationPatchModel.Tags = []string{"teststorage", "userstorage"} + storageRegistrationPatchModelAsPatch, asPatchErr := storageRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateBucketRegistrationOptions model - updateBucketRegistrationOptionsModel := new(watsonxdatav2.UpdateBucketRegistrationOptions) - updateBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - updateBucketRegistrationOptionsModel.Body = bucketRegistrationPatchModelAsPatch - updateBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateStorageRegistrationOptions model + updateStorageRegistrationOptionsModel := new(watsonxdatav3.UpdateStorageRegistrationOptions) + updateStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + updateStorageRegistrationOptionsModel.Body = storageRegistrationPatchModelAsPatch + updateStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + updateStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateBucketRegistration(updateBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.UpdateStorageRegistration(updateStorageRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateBucketRegistrationOptions model with no property values - updateBucketRegistrationOptionsModelNew := new(watsonxdatav2.UpdateBucketRegistrationOptions) + // Construct a second instance of the UpdateStorageRegistrationOptions model with no property values + updateStorageRegistrationOptionsModelNew := new(watsonxdatav3.UpdateStorageRegistrationOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateBucketRegistration(updateBucketRegistrationOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdateStorageRegistration(updateStorageRegistrationOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -1419,42 +1839,60 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateBucketRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateStorageRegistration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the BucketDetails model - bucketDetailsModel := new(watsonxdatav2.BucketDetails) - bucketDetailsModel.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - bucketDetailsModel.BucketName = core.StringPtr("sample-bucket") - bucketDetailsModel.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - bucketDetailsModel.KeyFile = core.StringPtr("key_file") - bucketDetailsModel.Provider = core.StringPtr("ibm_cos") - bucketDetailsModel.Region = core.StringPtr("us-south") - bucketDetailsModel.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") - - // Construct an instance of the BucketRegistrationPatch model - bucketRegistrationPatchModel := new(watsonxdatav2.BucketRegistrationPatch) - bucketRegistrationPatchModel.BucketDetails = bucketDetailsModel - bucketRegistrationPatchModel.BucketDisplayName = core.StringPtr("sample-bucket-displayname") - bucketRegistrationPatchModel.Description = core.StringPtr("COS bucket for customer data") - bucketRegistrationPatchModel.Tags = []string{"testbucket", "userbucket"} - bucketRegistrationPatchModelAsPatch, asPatchErr := bucketRegistrationPatchModel.AsPatch() + // Construct an instance of the StorageDetailsAccesskeyVault model + storageDetailsAccesskeyVaultModel := new(watsonxdatav3.StorageDetailsAccesskeyVault) + storageDetailsAccesskeyVaultModel.Key = core.StringPtr("secret key") + storageDetailsAccesskeyVaultModel.SecretName = core.StringPtr("secret name") + storageDetailsAccesskeyVaultModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the StorageDetails model + storageDetailsModel := new(watsonxdatav3.StorageDetails) + storageDetailsModel.AccessKey = core.StringPtr("") + storageDetailsModel.AccessKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.AccountName = core.StringPtr("sample-storage") + storageDetailsModel.ApplicationID = core.StringPtr("application-id") + storageDetailsModel.AuthMode = core.StringPtr("iam") + storageDetailsModel.ContainerName = core.StringPtr("sample-container") + storageDetailsModel.DirectoryID = core.StringPtr("directory-id") + storageDetailsModel.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + storageDetailsModel.KeyFile = core.StringPtr("key_file") + storageDetailsModel.Name = core.StringPtr("sample-storage") + storageDetailsModel.Provider = core.StringPtr("ibm-cos") + storageDetailsModel.Region = core.StringPtr("us-south") + storageDetailsModel.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + storageDetailsModel.SasToken = core.StringPtr("") + storageDetailsModel.SecretKey = core.StringPtr("secret_key") + storageDetailsModel.SecretKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.VaultEnabled = core.BoolPtr(true) + + // Construct an instance of the StorageRegistrationPatch model + storageRegistrationPatchModel := new(watsonxdatav3.StorageRegistrationPatch) + storageRegistrationPatchModel.Connection = storageDetailsModel + storageRegistrationPatchModel.Description = core.StringPtr("COS storage for customer data") + storageRegistrationPatchModel.DisplayName = core.StringPtr("sample-storage-displayname") + storageRegistrationPatchModel.SystemStorageUpdateCredentials = core.BoolPtr(true) + storageRegistrationPatchModel.Tags = []string{"teststorage", "userstorage"} + storageRegistrationPatchModelAsPatch, asPatchErr := storageRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateBucketRegistrationOptions model - updateBucketRegistrationOptionsModel := new(watsonxdatav2.UpdateBucketRegistrationOptions) - updateBucketRegistrationOptionsModel.BucketID = core.StringPtr("testString") - updateBucketRegistrationOptionsModel.Body = bucketRegistrationPatchModelAsPatch - updateBucketRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateBucketRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateStorageRegistrationOptions model + updateStorageRegistrationOptionsModel := new(watsonxdatav3.UpdateStorageRegistrationOptions) + updateStorageRegistrationOptionsModel.ID = core.StringPtr("testString") + updateStorageRegistrationOptionsModel.Body = storageRegistrationPatchModelAsPatch + updateStorageRegistrationOptionsModel.SkipMdsCall = core.BoolPtr(false) + updateStorageRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateStorageRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdateBucketRegistration(updateBucketRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.UpdateStorageRegistration(updateStorageRegistrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -1466,45 +1904,51 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateActivateBucket(createActivateBucketOptions *CreateActivateBucketOptions) - Operation response error`, func() { - createActivateBucketPath := "/bucket_registrations/testString/activate" + Describe(`AddStorageCatalog(addStorageCatalogOptions *AddStorageCatalogOptions) - Operation response error`, func() { + addStorageCatalogPath := "/v3/storage_registrations/testString/catalogs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createActivateBucketPath)) + Expect(req.URL.EscapedPath()).To(Equal(addStorageCatalogPath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for skip_mds_call query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateActivateBucket with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke AddStorageCatalog with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateActivateBucketOptions model - createActivateBucketOptionsModel := new(watsonxdatav2.CreateActivateBucketOptions) - createActivateBucketOptionsModel.BucketID = core.StringPtr("testString") - createActivateBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - createActivateBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddStorageCatalogOptions model + addStorageCatalogOptionsModel := new(watsonxdatav3.AddStorageCatalogOptions) + addStorageCatalogOptionsModel.StorageID = core.StringPtr("testString") + addStorageCatalogOptionsModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + addStorageCatalogOptionsModel.BasePath = core.StringPtr("/abc/def") + addStorageCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") + addStorageCatalogOptionsModel.CatalogType = core.StringPtr("iceberg") + addStorageCatalogOptionsModel.SkipMdsCall = core.BoolPtr(false) + addStorageCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + addStorageCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateActivateBucket(createActivateBucketOptionsModel) + result, response, operationErr := watsonxDataService.AddStorageCatalog(addStorageCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateActivateBucket(createActivateBucketOptionsModel) + result, response, operationErr = watsonxDataService.AddStorageCatalog(addStorageCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -1514,30 +1958,47 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateActivateBucket(createActivateBucketOptions *CreateActivateBucketOptions)`, func() { - createActivateBucketPath := "/bucket_registrations/testString/activate" + Describe(`AddStorageCatalog(addStorageCatalogOptions *AddStorageCatalogOptions)`, func() { + addStorageCatalogPath := "/v3/storage_registrations/testString/catalogs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createActivateBucketPath)) + Expect(req.URL.EscapedPath()).To(Equal(addStorageCatalogPath)) Expect(req.Method).To(Equal("POST")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for skip_mds_call query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke CreateActivateBucket successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke AddStorageCatalog successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -1545,22 +2006,27 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateActivateBucketOptions model - createActivateBucketOptionsModel := new(watsonxdatav2.CreateActivateBucketOptions) - createActivateBucketOptionsModel.BucketID = core.StringPtr("testString") - createActivateBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - createActivateBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddStorageCatalogOptions model + addStorageCatalogOptionsModel := new(watsonxdatav3.AddStorageCatalogOptions) + addStorageCatalogOptionsModel.StorageID = core.StringPtr("testString") + addStorageCatalogOptionsModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + addStorageCatalogOptionsModel.BasePath = core.StringPtr("/abc/def") + addStorageCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") + addStorageCatalogOptionsModel.CatalogType = core.StringPtr("iceberg") + addStorageCatalogOptionsModel.SkipMdsCall = core.BoolPtr(false) + addStorageCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + addStorageCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateActivateBucketWithContext(ctx, createActivateBucketOptionsModel) + _, _, operationErr := watsonxDataService.AddStorageCatalogWithContext(ctx, addStorageCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateActivateBucket(createActivateBucketOptionsModel) + result, response, operationErr := watsonxDataService.AddStorageCatalog(addStorageCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -1568,7 +2034,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateActivateBucketWithContext(ctx, createActivateBucketOptionsModel) + _, _, operationErr = watsonxDataService.AddStorageCatalogWithContext(ctx, addStorageCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -1582,19 +2048,36 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createActivateBucketPath)) + Expect(req.URL.EscapedPath()).To(Equal(addStorageCatalogPath)) Expect(req.Method).To(Equal("POST")) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for skip_mds_call query parameter + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke CreateActivateBucket successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke AddStorageCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -1602,49 +2085,59 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateActivateBucket(nil) + result, response, operationErr := watsonxDataService.AddStorageCatalog(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateActivateBucketOptions model - createActivateBucketOptionsModel := new(watsonxdatav2.CreateActivateBucketOptions) - createActivateBucketOptionsModel.BucketID = core.StringPtr("testString") - createActivateBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - createActivateBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddStorageCatalogOptions model + addStorageCatalogOptionsModel := new(watsonxdatav3.AddStorageCatalogOptions) + addStorageCatalogOptionsModel.StorageID = core.StringPtr("testString") + addStorageCatalogOptionsModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + addStorageCatalogOptionsModel.BasePath = core.StringPtr("/abc/def") + addStorageCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") + addStorageCatalogOptionsModel.CatalogType = core.StringPtr("iceberg") + addStorageCatalogOptionsModel.SkipMdsCall = core.BoolPtr(false) + addStorageCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + addStorageCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateActivateBucket(createActivateBucketOptionsModel) + result, response, operationErr = watsonxDataService.AddStorageCatalog(addStorageCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateActivateBucket with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke AddStorageCatalog with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateActivateBucketOptions model - createActivateBucketOptionsModel := new(watsonxdatav2.CreateActivateBucketOptions) - createActivateBucketOptionsModel.BucketID = core.StringPtr("testString") - createActivateBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - createActivateBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddStorageCatalogOptions model + addStorageCatalogOptionsModel := new(watsonxdatav3.AddStorageCatalogOptions) + addStorageCatalogOptionsModel.StorageID = core.StringPtr("testString") + addStorageCatalogOptionsModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + addStorageCatalogOptionsModel.BasePath = core.StringPtr("/abc/def") + addStorageCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") + addStorageCatalogOptionsModel.CatalogType = core.StringPtr("iceberg") + addStorageCatalogOptionsModel.SkipMdsCall = core.BoolPtr(false) + addStorageCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + addStorageCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateActivateBucket(createActivateBucketOptionsModel) + result, response, operationErr := watsonxDataService.AddStorageCatalog(addStorageCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateActivateBucketOptions model with no property values - createActivateBucketOptionsModelNew := new(watsonxdatav2.CreateActivateBucketOptions) + // Construct a second instance of the AddStorageCatalogOptions model with no property values + addStorageCatalogOptionsModelNew := new(watsonxdatav3.AddStorageCatalogOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateActivateBucket(createActivateBucketOptionsModelNew) + result, response, operationErr = watsonxDataService.AddStorageCatalog(addStorageCatalogOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -1662,22 +2155,27 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateActivateBucket successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke AddStorageCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateActivateBucketOptions model - createActivateBucketOptionsModel := new(watsonxdatav2.CreateActivateBucketOptions) - createActivateBucketOptionsModel.BucketID = core.StringPtr("testString") - createActivateBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - createActivateBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddStorageCatalogOptions model + addStorageCatalogOptionsModel := new(watsonxdatav3.AddStorageCatalogOptions) + addStorageCatalogOptionsModel.StorageID = core.StringPtr("testString") + addStorageCatalogOptionsModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + addStorageCatalogOptionsModel.BasePath = core.StringPtr("/abc/def") + addStorageCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") + addStorageCatalogOptionsModel.CatalogType = core.StringPtr("iceberg") + addStorageCatalogOptionsModel.SkipMdsCall = core.BoolPtr(false) + addStorageCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + addStorageCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateActivateBucket(createActivateBucketOptionsModel) + result, response, operationErr := watsonxDataService.AddStorageCatalog(addStorageCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -1689,15 +2187,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`AddBucketCatalog(addBucketCatalogOptions *AddBucketCatalogOptions) - Operation response error`, func() { - addBucketCatalogPath := "/bucket_registrations/testString/catalogs" + Describe(`GetStorageObjectProperties(getStorageObjectPropertiesOptions *GetStorageObjectPropertiesOptions) - Operation response error`, func() { + getStorageObjectPropertiesPath := "/v3/storage_registrations/testString/object_properties" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addBucketCatalogPath)) + Expect(req.URL.EscapedPath()).To(Equal(getStorageObjectPropertiesPath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -1706,32 +2204,33 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke AddBucketCatalog with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetStorageObjectProperties with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the AddBucketCatalogOptions model - addBucketCatalogOptionsModel := new(watsonxdatav2.AddBucketCatalogOptions) - addBucketCatalogOptionsModel.BucketID = core.StringPtr("testString") - addBucketCatalogOptionsModel.BasePath = core.StringPtr("/abc/def") - addBucketCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") - addBucketCatalogOptionsModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - addBucketCatalogOptionsModel.CatalogType = core.StringPtr("iceberg") - addBucketCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - addBucketCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Path model + pathModel := new(watsonxdatav3.Path) + pathModel.Path = core.StringPtr("testString") + + // Construct an instance of the GetStorageObjectPropertiesOptions model + getStorageObjectPropertiesOptionsModel := new(watsonxdatav3.GetStorageObjectPropertiesOptions) + getStorageObjectPropertiesOptionsModel.StorageID = core.StringPtr("testString") + getStorageObjectPropertiesOptionsModel.Paths = []watsonxdatav3.Path{*pathModel} + getStorageObjectPropertiesOptionsModel.AuthInstanceID = core.StringPtr("testString") + getStorageObjectPropertiesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.AddBucketCatalog(addBucketCatalogOptionsModel) + result, response, operationErr := watsonxDataService.GetStorageObjectProperties(getStorageObjectPropertiesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.AddBucketCatalog(addBucketCatalogOptionsModel) + result, response, operationErr = watsonxDataService.GetStorageObjectProperties(getStorageObjectPropertiesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -1741,15 +2240,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`AddBucketCatalog(addBucketCatalogOptions *AddBucketCatalogOptions)`, func() { - addBucketCatalogPath := "/bucket_registrations/testString/catalogs" + Describe(`GetStorageObjectProperties(getStorageObjectPropertiesOptions *GetStorageObjectPropertiesOptions)`, func() { + getStorageObjectPropertiesPath := "/v3/storage_registrations/testString/object_properties" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addBucketCatalogPath)) + Expect(req.URL.EscapedPath()).To(Equal(getStorageObjectPropertiesPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -1776,11 +2275,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + fmt.Fprintf(res, "%s", `{"object_properties": [{"content_type": "string", "file_type": "string", "last_modified": "utc-2014-07", "metadata": {"mapKey": "Inner"}, "path": "abc/abc/data", "size": "1024"}]}`) })) }) - It(`Invoke AddBucketCatalog successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetStorageObjectProperties successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -1788,26 +2287,27 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the AddBucketCatalogOptions model - addBucketCatalogOptionsModel := new(watsonxdatav2.AddBucketCatalogOptions) - addBucketCatalogOptionsModel.BucketID = core.StringPtr("testString") - addBucketCatalogOptionsModel.BasePath = core.StringPtr("/abc/def") - addBucketCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") - addBucketCatalogOptionsModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - addBucketCatalogOptionsModel.CatalogType = core.StringPtr("iceberg") - addBucketCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - addBucketCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Path model + pathModel := new(watsonxdatav3.Path) + pathModel.Path = core.StringPtr("testString") + + // Construct an instance of the GetStorageObjectPropertiesOptions model + getStorageObjectPropertiesOptionsModel := new(watsonxdatav3.GetStorageObjectPropertiesOptions) + getStorageObjectPropertiesOptionsModel.StorageID = core.StringPtr("testString") + getStorageObjectPropertiesOptionsModel.Paths = []watsonxdatav3.Path{*pathModel} + getStorageObjectPropertiesOptionsModel.AuthInstanceID = core.StringPtr("testString") + getStorageObjectPropertiesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.AddBucketCatalogWithContext(ctx, addBucketCatalogOptionsModel) + _, _, operationErr := watsonxDataService.GetStorageObjectPropertiesWithContext(ctx, getStorageObjectPropertiesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.AddBucketCatalog(addBucketCatalogOptionsModel) + result, response, operationErr := watsonxDataService.GetStorageObjectProperties(getStorageObjectPropertiesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -1815,7 +2315,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.AddBucketCatalogWithContext(ctx, addBucketCatalogOptionsModel) + _, _, operationErr = watsonxDataService.GetStorageObjectPropertiesWithContext(ctx, getStorageObjectPropertiesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -1829,7 +2329,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(addBucketCatalogPath)) + Expect(req.URL.EscapedPath()).To(Equal(getStorageObjectPropertiesPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -1853,11 +2353,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + fmt.Fprintf(res, "%s", `{"object_properties": [{"content_type": "string", "file_type": "string", "last_modified": "utc-2014-07", "metadata": {"mapKey": "Inner"}, "path": "abc/abc/data", "size": "1024"}]}`) })) }) - It(`Invoke AddBucketCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetStorageObjectProperties successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -1865,57 +2365,59 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.AddBucketCatalog(nil) + result, response, operationErr := watsonxDataService.GetStorageObjectProperties(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the AddBucketCatalogOptions model - addBucketCatalogOptionsModel := new(watsonxdatav2.AddBucketCatalogOptions) - addBucketCatalogOptionsModel.BucketID = core.StringPtr("testString") - addBucketCatalogOptionsModel.BasePath = core.StringPtr("/abc/def") - addBucketCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") - addBucketCatalogOptionsModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - addBucketCatalogOptionsModel.CatalogType = core.StringPtr("iceberg") - addBucketCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - addBucketCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Path model + pathModel := new(watsonxdatav3.Path) + pathModel.Path = core.StringPtr("testString") + + // Construct an instance of the GetStorageObjectPropertiesOptions model + getStorageObjectPropertiesOptionsModel := new(watsonxdatav3.GetStorageObjectPropertiesOptions) + getStorageObjectPropertiesOptionsModel.StorageID = core.StringPtr("testString") + getStorageObjectPropertiesOptionsModel.Paths = []watsonxdatav3.Path{*pathModel} + getStorageObjectPropertiesOptionsModel.AuthInstanceID = core.StringPtr("testString") + getStorageObjectPropertiesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.AddBucketCatalog(addBucketCatalogOptionsModel) + result, response, operationErr = watsonxDataService.GetStorageObjectProperties(getStorageObjectPropertiesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke AddBucketCatalog with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetStorageObjectProperties with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the AddBucketCatalogOptions model - addBucketCatalogOptionsModel := new(watsonxdatav2.AddBucketCatalogOptions) - addBucketCatalogOptionsModel.BucketID = core.StringPtr("testString") - addBucketCatalogOptionsModel.BasePath = core.StringPtr("/abc/def") - addBucketCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") - addBucketCatalogOptionsModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - addBucketCatalogOptionsModel.CatalogType = core.StringPtr("iceberg") - addBucketCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - addBucketCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Path model + pathModel := new(watsonxdatav3.Path) + pathModel.Path = core.StringPtr("testString") + + // Construct an instance of the GetStorageObjectPropertiesOptions model + getStorageObjectPropertiesOptionsModel := new(watsonxdatav3.GetStorageObjectPropertiesOptions) + getStorageObjectPropertiesOptionsModel.StorageID = core.StringPtr("testString") + getStorageObjectPropertiesOptionsModel.Paths = []watsonxdatav3.Path{*pathModel} + getStorageObjectPropertiesOptionsModel.AuthInstanceID = core.StringPtr("testString") + getStorageObjectPropertiesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.AddBucketCatalog(addBucketCatalogOptionsModel) + result, response, operationErr := watsonxDataService.GetStorageObjectProperties(getStorageObjectPropertiesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the AddBucketCatalogOptions model with no property values - addBucketCatalogOptionsModelNew := new(watsonxdatav2.AddBucketCatalogOptions) + // Construct a second instance of the GetStorageObjectPropertiesOptions model with no property values + getStorageObjectPropertiesOptionsModelNew := new(watsonxdatav3.GetStorageObjectPropertiesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.AddBucketCatalog(addBucketCatalogOptionsModelNew) + result, response, operationErr = watsonxDataService.GetStorageObjectProperties(getStorageObjectPropertiesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -1933,26 +2435,27 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(201) })) }) - It(`Invoke AddBucketCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetStorageObjectProperties successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the AddBucketCatalogOptions model - addBucketCatalogOptionsModel := new(watsonxdatav2.AddBucketCatalogOptions) - addBucketCatalogOptionsModel.BucketID = core.StringPtr("testString") - addBucketCatalogOptionsModel.BasePath = core.StringPtr("/abc/def") - addBucketCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") - addBucketCatalogOptionsModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - addBucketCatalogOptionsModel.CatalogType = core.StringPtr("iceberg") - addBucketCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - addBucketCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Path model + pathModel := new(watsonxdatav3.Path) + pathModel.Path = core.StringPtr("testString") + + // Construct an instance of the GetStorageObjectPropertiesOptions model + getStorageObjectPropertiesOptionsModel := new(watsonxdatav3.GetStorageObjectPropertiesOptions) + getStorageObjectPropertiesOptionsModel.StorageID = core.StringPtr("testString") + getStorageObjectPropertiesOptionsModel.Paths = []watsonxdatav3.Path{*pathModel} + getStorageObjectPropertiesOptionsModel.AuthInstanceID = core.StringPtr("testString") + getStorageObjectPropertiesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.AddBucketCatalog(addBucketCatalogOptionsModel) + result, response, operationErr := watsonxDataService.GetStorageObjectProperties(getStorageObjectPropertiesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -1964,119 +2467,55 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteDeactivateBucket(deleteDeactivateBucketOptions *DeleteDeactivateBucketOptions)`, func() { - deleteDeactivateBucketPath := "/bucket_registrations/testString/deactivate" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteDeactivateBucketPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteDeactivateBucket successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteDeactivateBucket(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteDeactivateBucketOptions model - deleteDeactivateBucketOptionsModel := new(watsonxdatav2.DeleteDeactivateBucketOptions) - deleteDeactivateBucketOptionsModel.BucketID = core.StringPtr("testString") - deleteDeactivateBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteDeactivateBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteDeactivateBucket(deleteDeactivateBucketOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteDeactivateBucket with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeleteDeactivateBucketOptions model - deleteDeactivateBucketOptionsModel := new(watsonxdatav2.DeleteDeactivateBucketOptions) - deleteDeactivateBucketOptionsModel.BucketID = core.StringPtr("testString") - deleteDeactivateBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteDeactivateBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteDeactivateBucket(deleteDeactivateBucketOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteDeactivateBucketOptions model with no property values - deleteDeactivateBucketOptionsModelNew := new(watsonxdatav2.DeleteDeactivateBucketOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteDeactivateBucket(deleteDeactivateBucketOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListBucketObjects(listBucketObjectsOptions *ListBucketObjectsOptions) - Operation response error`, func() { - listBucketObjectsPath := "/bucket_registrations/testString/objects" + Describe(`ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptions *ListStorageRegistrationsObjectsOptions) - Operation response error`, func() { + listStorageRegistrationsObjectsPath := "/v3/storage_registrations/testString/objects" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBucketObjectsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listStorageRegistrationsObjectsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) Expect(req.URL.Query()["path"]).To(Equal([]string{"testString"})) + // TODO: Add check for paginated query parameter + Expect(req.URL.Query()["page_size"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["prefix"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start_after"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListBucketObjects with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListStorageRegistrationsObjects with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListBucketObjectsOptions model - listBucketObjectsOptionsModel := new(watsonxdatav2.ListBucketObjectsOptions) - listBucketObjectsOptionsModel.BucketID = core.StringPtr("testString") - listBucketObjectsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listBucketObjectsOptionsModel.Path = core.StringPtr("testString") - listBucketObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListStorageRegistrationsObjectsOptions model + listStorageRegistrationsObjectsOptionsModel := new(watsonxdatav3.ListStorageRegistrationsObjectsOptions) + listStorageRegistrationsObjectsOptionsModel.StorageID = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Path = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Paginated = core.BoolPtr(true) + listStorageRegistrationsObjectsOptionsModel.PageSize = core.Int64Ptr(int64(1)) + listStorageRegistrationsObjectsOptionsModel.Prefix = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.StartAfter = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListBucketObjects(listBucketObjectsOptionsModel) + result, response, operationErr := watsonxDataService.ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListBucketObjects(listBucketObjectsOptionsModel) + result, response, operationErr = watsonxDataService.ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -2086,20 +2525,24 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListBucketObjects(listBucketObjectsOptions *ListBucketObjectsOptions)`, func() { - listBucketObjectsPath := "/bucket_registrations/testString/objects" + Describe(`ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptions *ListStorageRegistrationsObjectsOptions)`, func() { + listStorageRegistrationsObjectsPath := "/v3/storage_registrations/testString/objects" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBucketObjectsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listStorageRegistrationsObjectsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) Expect(req.URL.Query()["path"]).To(Equal([]string{"testString"})) + // TODO: Add check for paginated query parameter + Expect(req.URL.Query()["page_size"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["prefix"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start_after"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) @@ -2109,8 +2552,8 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprintf(res, "%s", `{"objects": ["Objects"]}`) })) }) - It(`Invoke ListBucketObjects successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListStorageRegistrationsObjects successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -2118,23 +2561,27 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListBucketObjectsOptions model - listBucketObjectsOptionsModel := new(watsonxdatav2.ListBucketObjectsOptions) - listBucketObjectsOptionsModel.BucketID = core.StringPtr("testString") - listBucketObjectsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listBucketObjectsOptionsModel.Path = core.StringPtr("testString") - listBucketObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListStorageRegistrationsObjectsOptions model + listStorageRegistrationsObjectsOptionsModel := new(watsonxdatav3.ListStorageRegistrationsObjectsOptions) + listStorageRegistrationsObjectsOptionsModel.StorageID = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Path = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Paginated = core.BoolPtr(true) + listStorageRegistrationsObjectsOptionsModel.PageSize = core.Int64Ptr(int64(1)) + listStorageRegistrationsObjectsOptionsModel.Prefix = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.StartAfter = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListBucketObjectsWithContext(ctx, listBucketObjectsOptionsModel) + _, _, operationErr := watsonxDataService.ListStorageRegistrationsObjectsWithContext(ctx, listStorageRegistrationsObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListBucketObjects(listBucketObjectsOptionsModel) + result, response, operationErr := watsonxDataService.ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -2142,7 +2589,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListBucketObjectsWithContext(ctx, listBucketObjectsOptionsModel) + _, _, operationErr = watsonxDataService.ListStorageRegistrationsObjectsWithContext(ctx, listStorageRegistrationsObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -2156,20 +2603,24 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listBucketObjectsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listStorageRegistrationsObjectsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) Expect(req.URL.Query()["path"]).To(Equal([]string{"testString"})) + // TODO: Add check for paginated query parameter + Expect(req.URL.Query()["page_size"]).To(Equal([]string{fmt.Sprint(int64(1))})) + Expect(req.URL.Query()["prefix"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start_after"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprintf(res, "%s", `{"objects": ["Objects"]}`) })) }) - It(`Invoke ListBucketObjects successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListStorageRegistrationsObjects successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -2177,51 +2628,59 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListBucketObjects(nil) + result, response, operationErr := watsonxDataService.ListStorageRegistrationsObjects(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListBucketObjectsOptions model - listBucketObjectsOptionsModel := new(watsonxdatav2.ListBucketObjectsOptions) - listBucketObjectsOptionsModel.BucketID = core.StringPtr("testString") - listBucketObjectsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listBucketObjectsOptionsModel.Path = core.StringPtr("testString") - listBucketObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListStorageRegistrationsObjectsOptions model + listStorageRegistrationsObjectsOptionsModel := new(watsonxdatav3.ListStorageRegistrationsObjectsOptions) + listStorageRegistrationsObjectsOptionsModel.StorageID = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Path = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Paginated = core.BoolPtr(true) + listStorageRegistrationsObjectsOptionsModel.PageSize = core.Int64Ptr(int64(1)) + listStorageRegistrationsObjectsOptionsModel.Prefix = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.StartAfter = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListBucketObjects(listBucketObjectsOptionsModel) + result, response, operationErr = watsonxDataService.ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListBucketObjects with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListStorageRegistrationsObjects with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListBucketObjectsOptions model - listBucketObjectsOptionsModel := new(watsonxdatav2.ListBucketObjectsOptions) - listBucketObjectsOptionsModel.BucketID = core.StringPtr("testString") - listBucketObjectsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listBucketObjectsOptionsModel.Path = core.StringPtr("testString") - listBucketObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListStorageRegistrationsObjectsOptions model + listStorageRegistrationsObjectsOptionsModel := new(watsonxdatav3.ListStorageRegistrationsObjectsOptions) + listStorageRegistrationsObjectsOptionsModel.StorageID = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Path = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Paginated = core.BoolPtr(true) + listStorageRegistrationsObjectsOptionsModel.PageSize = core.Int64Ptr(int64(1)) + listStorageRegistrationsObjectsOptionsModel.Prefix = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.StartAfter = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListBucketObjects(listBucketObjectsOptionsModel) + result, response, operationErr := watsonxDataService.ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListBucketObjectsOptions model with no property values - listBucketObjectsOptionsModelNew := new(watsonxdatav2.ListBucketObjectsOptions) + // Construct a second instance of the ListStorageRegistrationsObjectsOptions model with no property values + listStorageRegistrationsObjectsOptionsModelNew := new(watsonxdatav3.ListStorageRegistrationsObjectsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListBucketObjects(listBucketObjectsOptionsModelNew) + result, response, operationErr = watsonxDataService.ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -2239,23 +2698,27 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListBucketObjects successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListStorageRegistrationsObjects successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListBucketObjectsOptions model - listBucketObjectsOptionsModel := new(watsonxdatav2.ListBucketObjectsOptions) - listBucketObjectsOptionsModel.BucketID = core.StringPtr("testString") - listBucketObjectsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listBucketObjectsOptionsModel.Path = core.StringPtr("testString") - listBucketObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListStorageRegistrationsObjectsOptions model + listStorageRegistrationsObjectsOptionsModel := new(watsonxdatav3.ListStorageRegistrationsObjectsOptions) + listStorageRegistrationsObjectsOptionsModel.StorageID = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Path = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Paginated = core.BoolPtr(true) + listStorageRegistrationsObjectsOptionsModel.PageSize = core.Int64Ptr(int64(1)) + listStorageRegistrationsObjectsOptionsModel.Prefix = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.StartAfter = core.StringPtr("testString") + listStorageRegistrationsObjectsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListBucketObjects(listBucketObjectsOptionsModel) + result, response, operationErr := watsonxDataService.ListStorageRegistrationsObjects(listStorageRegistrationsObjectsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -2267,50 +2730,44 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetBucketObjectProperties(getBucketObjectPropertiesOptions *GetBucketObjectPropertiesOptions) - Operation response error`, func() { - getBucketObjectPropertiesPath := "/bucket_registrations/testString/object_properties" + Describe(`ListDatabaseRegistrations(listDatabaseRegistrationsOptions *ListDatabaseRegistrationsOptions) - Operation response error`, func() { + listDatabaseRegistrationsPath := "/v3/database_registrations" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBucketObjectPropertiesPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listDatabaseRegistrationsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetBucketObjectProperties with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDatabaseRegistrations with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the Path model - pathModel := new(watsonxdatav2.Path) - pathModel.Path = core.StringPtr("string") - - // Construct an instance of the GetBucketObjectPropertiesOptions model - getBucketObjectPropertiesOptionsModel := new(watsonxdatav2.GetBucketObjectPropertiesOptions) - getBucketObjectPropertiesOptionsModel.BucketID = core.StringPtr("testString") - getBucketObjectPropertiesOptionsModel.Paths = []watsonxdatav2.Path{*pathModel} - getBucketObjectPropertiesOptionsModel.AuthInstanceID = core.StringPtr("testString") - getBucketObjectPropertiesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDatabaseRegistrationsOptions model + listDatabaseRegistrationsOptionsModel := new(watsonxdatav3.ListDatabaseRegistrationsOptions) + listDatabaseRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDatabaseRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetBucketObjectProperties(getBucketObjectPropertiesOptionsModel) + result, response, operationErr := watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetBucketObjectProperties(getBucketObjectPropertiesOptionsModel) + result, response, operationErr = watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -2320,32 +2777,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetBucketObjectProperties(getBucketObjectPropertiesOptions *GetBucketObjectPropertiesOptions)`, func() { - getBucketObjectPropertiesPath := "/bucket_registrations/testString/object_properties" + Describe(`ListDatabaseRegistrations(listDatabaseRegistrationsOptions *ListDatabaseRegistrationsOptions)`, func() { + listDatabaseRegistrationsPath := "/v3/database_registrations" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBucketObjectPropertiesPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listDatabaseRegistrationsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -2354,12 +2795,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"object_properties": [{"content_type": "string", "file_type": "string", "last_modified": "utc-2014-07", "metadata": {"mapKey": "Inner"}, "path": "abc/abc/data", "size": "1024"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"database_registrations": [{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "connection": {"authentication_type": "LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword", "authentication_value": "LDAP", "authentication_value_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "broker_host": "samplehost", "broker_port": 4553, "certificate": "exampleCertificate", "certificate_extension": "pem", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "password_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "controller_authentication_user": "sampleuser", "coordinator_host": "samplehost", "coordinator_port": 4553, "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "domain_name": "conops-mssql.conops.local", "hostname": "http://db2@localhost:9900.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "name": "new_database", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "sasl": true, "sasl_mechanism": "plain", "schema_name": "sampleSchema", "schemas": "redis__name", "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name, redis_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true, "sslcertificate_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true, "username_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "warehouse_name": "samplewrehouse"}, "created_at": "1686792721", "created_by": "user1@ibm.com", "description": "Description of the external database", "display_name": "new_database", "id": "mysql123", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "target_catalog_id": "cc85d899-9ec3-496a-be36-99cff9000116", "source_asset_id": "cc85d899-9ec3-496a-be36-99cabc62f123", "source_catalog_id": "cc85d899-9ec3-496a-be36-99cff962f000", "source_project_id": "cc85d899-9ec3-496a-be36-99cff9000116", "tables": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "test.json", "schema_name": "customer", "table_name": "customer"}], "tags": ["Tags"], "topics": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "employee.json", "topic_name": "customer"}], "type": "netezza", "vault_enabled": true}]}`) })) }) - It(`Invoke GetBucketObjectProperties successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDatabaseRegistrations successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -2367,27 +2808,21 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the Path model - pathModel := new(watsonxdatav2.Path) - pathModel.Path = core.StringPtr("string") - - // Construct an instance of the GetBucketObjectPropertiesOptions model - getBucketObjectPropertiesOptionsModel := new(watsonxdatav2.GetBucketObjectPropertiesOptions) - getBucketObjectPropertiesOptionsModel.BucketID = core.StringPtr("testString") - getBucketObjectPropertiesOptionsModel.Paths = []watsonxdatav2.Path{*pathModel} - getBucketObjectPropertiesOptionsModel.AuthInstanceID = core.StringPtr("testString") - getBucketObjectPropertiesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDatabaseRegistrationsOptions model + listDatabaseRegistrationsOptionsModel := new(watsonxdatav3.ListDatabaseRegistrationsOptions) + listDatabaseRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDatabaseRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetBucketObjectPropertiesWithContext(ctx, getBucketObjectPropertiesOptionsModel) + _, _, operationErr := watsonxDataService.ListDatabaseRegistrationsWithContext(ctx, listDatabaseRegistrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetBucketObjectProperties(getBucketObjectPropertiesOptionsModel) + result, response, operationErr := watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -2395,7 +2830,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetBucketObjectPropertiesWithContext(ctx, getBucketObjectPropertiesOptionsModel) + _, _, operationErr = watsonxDataService.ListDatabaseRegistrationsWithContext(ctx, listDatabaseRegistrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -2409,35 +2844,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getBucketObjectPropertiesPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listDatabaseRegistrationsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"object_properties": [{"content_type": "string", "file_type": "string", "last_modified": "utc-2014-07", "metadata": {"mapKey": "Inner"}, "path": "abc/abc/data", "size": "1024"}]}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"database_registrations": [{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "connection": {"authentication_type": "LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword", "authentication_value": "LDAP", "authentication_value_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "broker_host": "samplehost", "broker_port": 4553, "certificate": "exampleCertificate", "certificate_extension": "pem", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "password_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "controller_authentication_user": "sampleuser", "coordinator_host": "samplehost", "coordinator_port": 4553, "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "domain_name": "conops-mssql.conops.local", "hostname": "http://db2@localhost:9900.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "name": "new_database", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "sasl": true, "sasl_mechanism": "plain", "schema_name": "sampleSchema", "schemas": "redis__name", "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name, redis_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true, "sslcertificate_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true, "username_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "warehouse_name": "samplewrehouse"}, "created_at": "1686792721", "created_by": "user1@ibm.com", "description": "Description of the external database", "display_name": "new_database", "id": "mysql123", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "target_catalog_id": "cc85d899-9ec3-496a-be36-99cff9000116", "source_asset_id": "cc85d899-9ec3-496a-be36-99cabc62f123", "source_catalog_id": "cc85d899-9ec3-496a-be36-99cff962f000", "source_project_id": "cc85d899-9ec3-496a-be36-99cff9000116", "tables": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "test.json", "schema_name": "customer", "table_name": "customer"}], "tags": ["Tags"], "topics": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "employee.json", "topic_name": "customer"}], "type": "netezza", "vault_enabled": true}]}`) })) }) - It(`Invoke GetBucketObjectProperties successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDatabaseRegistrations successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -2445,62 +2864,43 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetBucketObjectProperties(nil) + result, response, operationErr := watsonxDataService.ListDatabaseRegistrations(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the Path model - pathModel := new(watsonxdatav2.Path) - pathModel.Path = core.StringPtr("string") - - // Construct an instance of the GetBucketObjectPropertiesOptions model - getBucketObjectPropertiesOptionsModel := new(watsonxdatav2.GetBucketObjectPropertiesOptions) - getBucketObjectPropertiesOptionsModel.BucketID = core.StringPtr("testString") - getBucketObjectPropertiesOptionsModel.Paths = []watsonxdatav2.Path{*pathModel} - getBucketObjectPropertiesOptionsModel.AuthInstanceID = core.StringPtr("testString") - getBucketObjectPropertiesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDatabaseRegistrationsOptions model + listDatabaseRegistrationsOptionsModel := new(watsonxdatav3.ListDatabaseRegistrationsOptions) + listDatabaseRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDatabaseRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetBucketObjectProperties(getBucketObjectPropertiesOptionsModel) + result, response, operationErr = watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetBucketObjectProperties with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDatabaseRegistrations with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the Path model - pathModel := new(watsonxdatav2.Path) - pathModel.Path = core.StringPtr("string") - - // Construct an instance of the GetBucketObjectPropertiesOptions model - getBucketObjectPropertiesOptionsModel := new(watsonxdatav2.GetBucketObjectPropertiesOptions) - getBucketObjectPropertiesOptionsModel.BucketID = core.StringPtr("testString") - getBucketObjectPropertiesOptionsModel.Paths = []watsonxdatav2.Path{*pathModel} - getBucketObjectPropertiesOptionsModel.AuthInstanceID = core.StringPtr("testString") - getBucketObjectPropertiesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDatabaseRegistrationsOptions model + listDatabaseRegistrationsOptionsModel := new(watsonxdatav3.ListDatabaseRegistrationsOptions) + listDatabaseRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDatabaseRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetBucketObjectProperties(getBucketObjectPropertiesOptionsModel) + result, response, operationErr := watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetBucketObjectPropertiesOptions model with no property values - getBucketObjectPropertiesOptionsModelNew := new(watsonxdatav2.GetBucketObjectPropertiesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetBucketObjectProperties(getBucketObjectPropertiesOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -2512,30 +2912,24 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke GetBucketObjectProperties successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDatabaseRegistrations successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the Path model - pathModel := new(watsonxdatav2.Path) - pathModel.Path = core.StringPtr("string") - - // Construct an instance of the GetBucketObjectPropertiesOptions model - getBucketObjectPropertiesOptionsModel := new(watsonxdatav2.GetBucketObjectPropertiesOptions) - getBucketObjectPropertiesOptionsModel.BucketID = core.StringPtr("testString") - getBucketObjectPropertiesOptionsModel.Paths = []watsonxdatav2.Path{*pathModel} - getBucketObjectPropertiesOptionsModel.AuthInstanceID = core.StringPtr("testString") - getBucketObjectPropertiesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDatabaseRegistrationsOptions model + listDatabaseRegistrationsOptionsModel := new(watsonxdatav3.ListDatabaseRegistrationsOptions) + listDatabaseRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDatabaseRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetBucketObjectProperties(getBucketObjectPropertiesOptionsModel) + result, response, operationErr := watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -2547,15 +2941,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateHdfsStorage(createHdfsStorageOptions *CreateHdfsStorageOptions) - Operation response error`, func() { - createHdfsStoragePath := "/storage_hdfs_registrations" + Describe(`CreateDatabaseRegistration(createDatabaseRegistrationOptions *CreateDatabaseRegistrationOptions) - Operation response error`, func() { + createDatabaseRegistrationPath := "/v3/database_registrations" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createHdfsStoragePath)) + Expect(req.URL.EscapedPath()).To(Equal(createDatabaseRegistrationPath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -2564,46 +2958,110 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateHdfsStorage with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) + It(`Invoke CreateDatabaseRegistration with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DatabaseCatalogPrototype model + databaseCatalogPrototypeModel := new(watsonxdatav3.DatabaseCatalogPrototype) + databaseCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + databaseCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + + // Construct an instance of the SecretDetails model + secretDetailsModel := new(watsonxdatav3.SecretDetails) + secretDetailsModel.Key = core.StringPtr("secret key") + secretDetailsModel.SecretName = core.StringPtr("secret name") + secretDetailsModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the DatabaseDetailsPrototype model + databaseDetailsPrototypeModel := new(watsonxdatav3.DatabaseDetailsPrototype) + databaseDetailsPrototypeModel.AuthenticationType = core.StringPtr("LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword") + databaseDetailsPrototypeModel.AuthenticationValue = core.StringPtr("LDAP") + databaseDetailsPrototypeModel.AuthenticationValueKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.BrokerHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.BrokerPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.Certificate = core.StringPtr("exampleCertificate") + databaseDetailsPrototypeModel.CertificateExtension = core.StringPtr("pem") + databaseDetailsPrototypeModel.ConnectionMethod = core.StringPtr("basic, apikey") + databaseDetailsPrototypeModel.ConnectionMode = core.StringPtr("service_name") + databaseDetailsPrototypeModel.ConnectionModeValue = core.StringPtr("orclpdb") + databaseDetailsPrototypeModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") + databaseDetailsPrototypeModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.CoordinatorHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.CoordinatorPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.CpdHostname = core.StringPtr("samplecpdhostname") + databaseDetailsPrototypeModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") + databaseDetailsPrototypeModel.DomainName = core.StringPtr("conops-mssql.conops.local") + databaseDetailsPrototypeModel.Hostname = core.StringPtr("http://db2@localhost:9900.com") + databaseDetailsPrototypeModel.HostnameInCertificate = core.StringPtr("samplehostname") + databaseDetailsPrototypeModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") + databaseDetailsPrototypeModel.InformixServer = core.StringPtr("ol_informix1410") + databaseDetailsPrototypeModel.Name = core.StringPtr("new_database") + databaseDetailsPrototypeModel.Password = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.PasswordKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Port = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.ProjectID = core.StringPtr("conops-bigquery") + databaseDetailsPrototypeModel.Sasl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SaslMechanism = core.StringPtr("plain") + databaseDetailsPrototypeModel.SchemaName = core.StringPtr("sampleSchema") + databaseDetailsPrototypeModel.Schemas = core.StringPtr("redis__name") + databaseDetailsPrototypeModel.ServiceApiKey = core.StringPtr("sampleapikey") + databaseDetailsPrototypeModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") + databaseDetailsPrototypeModel.ServicePassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ServicePort = core.Int64Ptr(int64(443)) + databaseDetailsPrototypeModel.ServiceSsl = core.BoolPtr(true) + databaseDetailsPrototypeModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") + databaseDetailsPrototypeModel.ServiceUsername = core.StringPtr("sampleusername") + databaseDetailsPrototypeModel.Ssl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SslcertificateKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Tables = core.StringPtr("kafka_table_name, redis_table_name") + databaseDetailsPrototypeModel.Username = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.UsernameKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.ValidateServerCertificate = core.BoolPtr(true) + databaseDetailsPrototypeModel.VaultEnabled = core.BoolPtr(true) + databaseDetailsPrototypeModel.VerifyHostName = core.BoolPtr(true) + databaseDetailsPrototypeModel.WarehouseName = core.StringPtr("samplewrehouse") - // Construct an instance of the CreateHdfsStorageOptions model - createHdfsStorageOptionsModel := new(watsonxdatav2.CreateHdfsStorageOptions) - createHdfsStorageOptionsModel.BucketDisplayName = core.StringPtr("testString") - createHdfsStorageOptionsModel.BucketType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HmsThriftURI = core.StringPtr("testString") - createHdfsStorageOptionsModel.HmsThriftPort = core.Int64Ptr(int64(1)) - createHdfsStorageOptionsModel.CoreSite = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsSite = core.StringPtr("testString") - createHdfsStorageOptionsModel.Kerberos = core.StringPtr("testString") - createHdfsStorageOptionsModel.CatalogName = core.StringPtr("testString") - createHdfsStorageOptionsModel.CatalogType = core.StringPtr("testString") - createHdfsStorageOptionsModel.Krb5Config = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveKeytab = CreateMockReader("This is a mock file.") - createHdfsStorageOptionsModel.HiveKeytabContentType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsKeytab = CreateMockReader("This is a mock file.") - createHdfsStorageOptionsModel.HdfsKeytabContentType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveServerPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveClientPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.Description = core.StringPtr("testString") - createHdfsStorageOptionsModel.CreatedOn = core.StringPtr("testString") - createHdfsStorageOptionsModel.AuthInstanceID = core.StringPtr("testString") - createHdfsStorageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DatabaseRegistrationPrototypeDatabasePropertiesItems model + databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems) + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Key = core.StringPtr("abc") + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") + + // Construct an instance of the CreateDatabaseRegistrationOptions model + createDatabaseRegistrationOptionsModel := new(watsonxdatav3.CreateDatabaseRegistrationOptions) + createDatabaseRegistrationOptionsModel.DisplayName = core.StringPtr("new_database") + createDatabaseRegistrationOptionsModel.Type = core.StringPtr("db2") + createDatabaseRegistrationOptionsModel.AssociatedCatalog = databaseCatalogPrototypeModel + createDatabaseRegistrationOptionsModel.Connection = databaseDetailsPrototypeModel + createDatabaseRegistrationOptionsModel.CreatedAt = core.StringPtr("1686792721") + createDatabaseRegistrationOptionsModel.Description = core.StringPtr("db2 extenal database description") + createDatabaseRegistrationOptionsModel.Properties = []watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel} + createDatabaseRegistrationOptionsModel.SourceAssetID = core.StringPtr("cc85d899-9ec3-496a-be36-99cabc62f123") + createDatabaseRegistrationOptionsModel.SourceCatalogID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff962f000") + createDatabaseRegistrationOptionsModel.SourceProjectID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116") + createDatabaseRegistrationOptionsModel.Tags = []string{"testdatabase", "userdatabase"} + createDatabaseRegistrationOptionsModel.TargetCatalogID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116") + createDatabaseRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDatabaseRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) + result, response, operationErr := watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) + result, response, operationErr = watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -2613,17 +3071,33 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateHdfsStorage(createHdfsStorageOptions *CreateHdfsStorageOptions)`, func() { - createHdfsStoragePath := "/storage_hdfs_registrations" + Describe(`CreateDatabaseRegistration(createDatabaseRegistrationOptions *CreateDatabaseRegistrationOptions)`, func() { + createDatabaseRegistrationPath := "/v3/database_registrations" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createHdfsStoragePath)) + Expect(req.URL.EscapedPath()).To(Equal(createDatabaseRegistrationPath)) Expect(req.Method).To(Equal("POST")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Sleep a short time to support a timeout test @@ -2632,11 +3106,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "bucket_display_name": "sample hdfs displayname", "bucket_id": "hdfs123", "bucket_type": "hdfs", "created_by": "@.com", "created_on": "1686120645", "description": "HDFS description for storage", "managed_by": "customer", "state": "active", "tags": ["Tags"]}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "connection": {"authentication_type": "LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword", "authentication_value": "LDAP", "authentication_value_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "broker_host": "samplehost", "broker_port": 4553, "certificate": "exampleCertificate", "certificate_extension": "pem", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "password_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "controller_authentication_user": "sampleuser", "coordinator_host": "samplehost", "coordinator_port": 4553, "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "domain_name": "conops-mssql.conops.local", "hostname": "http://db2@localhost:9900.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "name": "new_database", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "sasl": true, "sasl_mechanism": "plain", "schema_name": "sampleSchema", "schemas": "redis__name", "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name, redis_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true, "sslcertificate_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true, "username_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "warehouse_name": "samplewrehouse"}, "created_at": "1686792721", "created_by": "user1@ibm.com", "description": "Description of the external database", "display_name": "new_database", "id": "mysql123", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "target_catalog_id": "cc85d899-9ec3-496a-be36-99cff9000116", "source_asset_id": "cc85d899-9ec3-496a-be36-99cabc62f123", "source_catalog_id": "cc85d899-9ec3-496a-be36-99cff962f000", "source_project_id": "cc85d899-9ec3-496a-be36-99cff9000116", "tables": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "test.json", "schema_name": "customer", "table_name": "customer"}], "tags": ["Tags"], "topics": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "employee.json", "topic_name": "customer"}], "type": "netezza", "vault_enabled": true}`) })) }) - It(`Invoke CreateHdfsStorage successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateDatabaseRegistration successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -2644,40 +3118,104 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateHdfsStorageOptions model - createHdfsStorageOptionsModel := new(watsonxdatav2.CreateHdfsStorageOptions) - createHdfsStorageOptionsModel.BucketDisplayName = core.StringPtr("testString") - createHdfsStorageOptionsModel.BucketType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HmsThriftURI = core.StringPtr("testString") - createHdfsStorageOptionsModel.HmsThriftPort = core.Int64Ptr(int64(1)) - createHdfsStorageOptionsModel.CoreSite = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsSite = core.StringPtr("testString") - createHdfsStorageOptionsModel.Kerberos = core.StringPtr("testString") - createHdfsStorageOptionsModel.CatalogName = core.StringPtr("testString") - createHdfsStorageOptionsModel.CatalogType = core.StringPtr("testString") - createHdfsStorageOptionsModel.Krb5Config = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveKeytab = CreateMockReader("This is a mock file.") - createHdfsStorageOptionsModel.HiveKeytabContentType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsKeytab = CreateMockReader("This is a mock file.") - createHdfsStorageOptionsModel.HdfsKeytabContentType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveServerPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveClientPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.Description = core.StringPtr("testString") - createHdfsStorageOptionsModel.CreatedOn = core.StringPtr("testString") - createHdfsStorageOptionsModel.AuthInstanceID = core.StringPtr("testString") - createHdfsStorageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DatabaseCatalogPrototype model + databaseCatalogPrototypeModel := new(watsonxdatav3.DatabaseCatalogPrototype) + databaseCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + databaseCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + + // Construct an instance of the SecretDetails model + secretDetailsModel := new(watsonxdatav3.SecretDetails) + secretDetailsModel.Key = core.StringPtr("secret key") + secretDetailsModel.SecretName = core.StringPtr("secret name") + secretDetailsModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the DatabaseDetailsPrototype model + databaseDetailsPrototypeModel := new(watsonxdatav3.DatabaseDetailsPrototype) + databaseDetailsPrototypeModel.AuthenticationType = core.StringPtr("LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword") + databaseDetailsPrototypeModel.AuthenticationValue = core.StringPtr("LDAP") + databaseDetailsPrototypeModel.AuthenticationValueKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.BrokerHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.BrokerPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.Certificate = core.StringPtr("exampleCertificate") + databaseDetailsPrototypeModel.CertificateExtension = core.StringPtr("pem") + databaseDetailsPrototypeModel.ConnectionMethod = core.StringPtr("basic, apikey") + databaseDetailsPrototypeModel.ConnectionMode = core.StringPtr("service_name") + databaseDetailsPrototypeModel.ConnectionModeValue = core.StringPtr("orclpdb") + databaseDetailsPrototypeModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") + databaseDetailsPrototypeModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.CoordinatorHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.CoordinatorPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.CpdHostname = core.StringPtr("samplecpdhostname") + databaseDetailsPrototypeModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") + databaseDetailsPrototypeModel.DomainName = core.StringPtr("conops-mssql.conops.local") + databaseDetailsPrototypeModel.Hostname = core.StringPtr("http://db2@localhost:9900.com") + databaseDetailsPrototypeModel.HostnameInCertificate = core.StringPtr("samplehostname") + databaseDetailsPrototypeModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") + databaseDetailsPrototypeModel.InformixServer = core.StringPtr("ol_informix1410") + databaseDetailsPrototypeModel.Name = core.StringPtr("new_database") + databaseDetailsPrototypeModel.Password = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.PasswordKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Port = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.ProjectID = core.StringPtr("conops-bigquery") + databaseDetailsPrototypeModel.Sasl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SaslMechanism = core.StringPtr("plain") + databaseDetailsPrototypeModel.SchemaName = core.StringPtr("sampleSchema") + databaseDetailsPrototypeModel.Schemas = core.StringPtr("redis__name") + databaseDetailsPrototypeModel.ServiceApiKey = core.StringPtr("sampleapikey") + databaseDetailsPrototypeModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") + databaseDetailsPrototypeModel.ServicePassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ServicePort = core.Int64Ptr(int64(443)) + databaseDetailsPrototypeModel.ServiceSsl = core.BoolPtr(true) + databaseDetailsPrototypeModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") + databaseDetailsPrototypeModel.ServiceUsername = core.StringPtr("sampleusername") + databaseDetailsPrototypeModel.Ssl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SslcertificateKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Tables = core.StringPtr("kafka_table_name, redis_table_name") + databaseDetailsPrototypeModel.Username = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.UsernameKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.ValidateServerCertificate = core.BoolPtr(true) + databaseDetailsPrototypeModel.VaultEnabled = core.BoolPtr(true) + databaseDetailsPrototypeModel.VerifyHostName = core.BoolPtr(true) + databaseDetailsPrototypeModel.WarehouseName = core.StringPtr("samplewrehouse") + + // Construct an instance of the DatabaseRegistrationPrototypeDatabasePropertiesItems model + databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems) + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Key = core.StringPtr("abc") + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") + + // Construct an instance of the CreateDatabaseRegistrationOptions model + createDatabaseRegistrationOptionsModel := new(watsonxdatav3.CreateDatabaseRegistrationOptions) + createDatabaseRegistrationOptionsModel.DisplayName = core.StringPtr("new_database") + createDatabaseRegistrationOptionsModel.Type = core.StringPtr("db2") + createDatabaseRegistrationOptionsModel.AssociatedCatalog = databaseCatalogPrototypeModel + createDatabaseRegistrationOptionsModel.Connection = databaseDetailsPrototypeModel + createDatabaseRegistrationOptionsModel.CreatedAt = core.StringPtr("1686792721") + createDatabaseRegistrationOptionsModel.Description = core.StringPtr("db2 extenal database description") + createDatabaseRegistrationOptionsModel.Properties = []watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel} + createDatabaseRegistrationOptionsModel.SourceAssetID = core.StringPtr("cc85d899-9ec3-496a-be36-99cabc62f123") + createDatabaseRegistrationOptionsModel.SourceCatalogID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff962f000") + createDatabaseRegistrationOptionsModel.SourceProjectID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116") + createDatabaseRegistrationOptionsModel.Tags = []string{"testdatabase", "userdatabase"} + createDatabaseRegistrationOptionsModel.TargetCatalogID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116") + createDatabaseRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDatabaseRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateHdfsStorageWithContext(ctx, createHdfsStorageOptionsModel) + _, _, operationErr := watsonxDataService.CreateDatabaseRegistrationWithContext(ctx, createDatabaseRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) + result, response, operationErr := watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -2685,7 +3223,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateHdfsStorageWithContext(ctx, createHdfsStorageOptionsModel) + _, _, operationErr = watsonxDataService.CreateDatabaseRegistrationWithContext(ctx, createDatabaseRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -2699,19 +3237,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createHdfsStoragePath)) + Expect(req.URL.EscapedPath()).To(Equal(createDatabaseRegistrationPath)) Expect(req.Method).To(Equal("POST")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"base_path": "/abc/def", "catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "bucket_display_name": "sample hdfs displayname", "bucket_id": "hdfs123", "bucket_type": "hdfs", "created_by": "@.com", "created_on": "1686120645", "description": "HDFS description for storage", "managed_by": "customer", "state": "active", "tags": ["Tags"]}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "connection": {"authentication_type": "LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword", "authentication_value": "LDAP", "authentication_value_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "broker_host": "samplehost", "broker_port": 4553, "certificate": "exampleCertificate", "certificate_extension": "pem", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "password_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "controller_authentication_user": "sampleuser", "coordinator_host": "samplehost", "coordinator_port": 4553, "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "domain_name": "conops-mssql.conops.local", "hostname": "http://db2@localhost:9900.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "name": "new_database", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "sasl": true, "sasl_mechanism": "plain", "schema_name": "sampleSchema", "schemas": "redis__name", "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name, redis_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true, "sslcertificate_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true, "username_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "warehouse_name": "samplewrehouse"}, "created_at": "1686792721", "created_by": "user1@ibm.com", "description": "Description of the external database", "display_name": "new_database", "id": "mysql123", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "target_catalog_id": "cc85d899-9ec3-496a-be36-99cff9000116", "source_asset_id": "cc85d899-9ec3-496a-be36-99cabc62f123", "source_catalog_id": "cc85d899-9ec3-496a-be36-99cff962f000", "source_project_id": "cc85d899-9ec3-496a-be36-99cff9000116", "tables": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "test.json", "schema_name": "customer", "table_name": "customer"}], "tags": ["Tags"], "topics": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "employee.json", "topic_name": "customer"}], "type": "netezza", "vault_enabled": true}`) })) }) - It(`Invoke CreateHdfsStorage successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateDatabaseRegistration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -2719,85 +3273,213 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateHdfsStorage(nil) + result, response, operationErr := watsonxDataService.CreateDatabaseRegistration(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateHdfsStorageOptions model - createHdfsStorageOptionsModel := new(watsonxdatav2.CreateHdfsStorageOptions) - createHdfsStorageOptionsModel.BucketDisplayName = core.StringPtr("testString") - createHdfsStorageOptionsModel.BucketType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HmsThriftURI = core.StringPtr("testString") - createHdfsStorageOptionsModel.HmsThriftPort = core.Int64Ptr(int64(1)) - createHdfsStorageOptionsModel.CoreSite = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsSite = core.StringPtr("testString") - createHdfsStorageOptionsModel.Kerberos = core.StringPtr("testString") - createHdfsStorageOptionsModel.CatalogName = core.StringPtr("testString") - createHdfsStorageOptionsModel.CatalogType = core.StringPtr("testString") - createHdfsStorageOptionsModel.Krb5Config = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveKeytab = CreateMockReader("This is a mock file.") - createHdfsStorageOptionsModel.HiveKeytabContentType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsKeytab = CreateMockReader("This is a mock file.") - createHdfsStorageOptionsModel.HdfsKeytabContentType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveServerPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveClientPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.Description = core.StringPtr("testString") - createHdfsStorageOptionsModel.CreatedOn = core.StringPtr("testString") - createHdfsStorageOptionsModel.AuthInstanceID = core.StringPtr("testString") - createHdfsStorageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DatabaseCatalogPrototype model + databaseCatalogPrototypeModel := new(watsonxdatav3.DatabaseCatalogPrototype) + databaseCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + databaseCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + + // Construct an instance of the SecretDetails model + secretDetailsModel := new(watsonxdatav3.SecretDetails) + secretDetailsModel.Key = core.StringPtr("secret key") + secretDetailsModel.SecretName = core.StringPtr("secret name") + secretDetailsModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the DatabaseDetailsPrototype model + databaseDetailsPrototypeModel := new(watsonxdatav3.DatabaseDetailsPrototype) + databaseDetailsPrototypeModel.AuthenticationType = core.StringPtr("LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword") + databaseDetailsPrototypeModel.AuthenticationValue = core.StringPtr("LDAP") + databaseDetailsPrototypeModel.AuthenticationValueKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.BrokerHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.BrokerPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.Certificate = core.StringPtr("exampleCertificate") + databaseDetailsPrototypeModel.CertificateExtension = core.StringPtr("pem") + databaseDetailsPrototypeModel.ConnectionMethod = core.StringPtr("basic, apikey") + databaseDetailsPrototypeModel.ConnectionMode = core.StringPtr("service_name") + databaseDetailsPrototypeModel.ConnectionModeValue = core.StringPtr("orclpdb") + databaseDetailsPrototypeModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") + databaseDetailsPrototypeModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.CoordinatorHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.CoordinatorPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.CpdHostname = core.StringPtr("samplecpdhostname") + databaseDetailsPrototypeModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") + databaseDetailsPrototypeModel.DomainName = core.StringPtr("conops-mssql.conops.local") + databaseDetailsPrototypeModel.Hostname = core.StringPtr("http://db2@localhost:9900.com") + databaseDetailsPrototypeModel.HostnameInCertificate = core.StringPtr("samplehostname") + databaseDetailsPrototypeModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") + databaseDetailsPrototypeModel.InformixServer = core.StringPtr("ol_informix1410") + databaseDetailsPrototypeModel.Name = core.StringPtr("new_database") + databaseDetailsPrototypeModel.Password = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.PasswordKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Port = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.ProjectID = core.StringPtr("conops-bigquery") + databaseDetailsPrototypeModel.Sasl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SaslMechanism = core.StringPtr("plain") + databaseDetailsPrototypeModel.SchemaName = core.StringPtr("sampleSchema") + databaseDetailsPrototypeModel.Schemas = core.StringPtr("redis__name") + databaseDetailsPrototypeModel.ServiceApiKey = core.StringPtr("sampleapikey") + databaseDetailsPrototypeModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") + databaseDetailsPrototypeModel.ServicePassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ServicePort = core.Int64Ptr(int64(443)) + databaseDetailsPrototypeModel.ServiceSsl = core.BoolPtr(true) + databaseDetailsPrototypeModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") + databaseDetailsPrototypeModel.ServiceUsername = core.StringPtr("sampleusername") + databaseDetailsPrototypeModel.Ssl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SslcertificateKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Tables = core.StringPtr("kafka_table_name, redis_table_name") + databaseDetailsPrototypeModel.Username = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.UsernameKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.ValidateServerCertificate = core.BoolPtr(true) + databaseDetailsPrototypeModel.VaultEnabled = core.BoolPtr(true) + databaseDetailsPrototypeModel.VerifyHostName = core.BoolPtr(true) + databaseDetailsPrototypeModel.WarehouseName = core.StringPtr("samplewrehouse") + + // Construct an instance of the DatabaseRegistrationPrototypeDatabasePropertiesItems model + databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems) + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Key = core.StringPtr("abc") + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") + + // Construct an instance of the CreateDatabaseRegistrationOptions model + createDatabaseRegistrationOptionsModel := new(watsonxdatav3.CreateDatabaseRegistrationOptions) + createDatabaseRegistrationOptionsModel.DisplayName = core.StringPtr("new_database") + createDatabaseRegistrationOptionsModel.Type = core.StringPtr("db2") + createDatabaseRegistrationOptionsModel.AssociatedCatalog = databaseCatalogPrototypeModel + createDatabaseRegistrationOptionsModel.Connection = databaseDetailsPrototypeModel + createDatabaseRegistrationOptionsModel.CreatedAt = core.StringPtr("1686792721") + createDatabaseRegistrationOptionsModel.Description = core.StringPtr("db2 extenal database description") + createDatabaseRegistrationOptionsModel.Properties = []watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel} + createDatabaseRegistrationOptionsModel.SourceAssetID = core.StringPtr("cc85d899-9ec3-496a-be36-99cabc62f123") + createDatabaseRegistrationOptionsModel.SourceCatalogID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff962f000") + createDatabaseRegistrationOptionsModel.SourceProjectID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116") + createDatabaseRegistrationOptionsModel.Tags = []string{"testdatabase", "userdatabase"} + createDatabaseRegistrationOptionsModel.TargetCatalogID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116") + createDatabaseRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDatabaseRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) + result, response, operationErr = watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateHdfsStorage with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) + It(`Invoke CreateDatabaseRegistration with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DatabaseCatalogPrototype model + databaseCatalogPrototypeModel := new(watsonxdatav3.DatabaseCatalogPrototype) + databaseCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + databaseCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + + // Construct an instance of the SecretDetails model + secretDetailsModel := new(watsonxdatav3.SecretDetails) + secretDetailsModel.Key = core.StringPtr("secret key") + secretDetailsModel.SecretName = core.StringPtr("secret name") + secretDetailsModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the DatabaseDetailsPrototype model + databaseDetailsPrototypeModel := new(watsonxdatav3.DatabaseDetailsPrototype) + databaseDetailsPrototypeModel.AuthenticationType = core.StringPtr("LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword") + databaseDetailsPrototypeModel.AuthenticationValue = core.StringPtr("LDAP") + databaseDetailsPrototypeModel.AuthenticationValueKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.BrokerHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.BrokerPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.Certificate = core.StringPtr("exampleCertificate") + databaseDetailsPrototypeModel.CertificateExtension = core.StringPtr("pem") + databaseDetailsPrototypeModel.ConnectionMethod = core.StringPtr("basic, apikey") + databaseDetailsPrototypeModel.ConnectionMode = core.StringPtr("service_name") + databaseDetailsPrototypeModel.ConnectionModeValue = core.StringPtr("orclpdb") + databaseDetailsPrototypeModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") + databaseDetailsPrototypeModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.CoordinatorHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.CoordinatorPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.CpdHostname = core.StringPtr("samplecpdhostname") + databaseDetailsPrototypeModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") + databaseDetailsPrototypeModel.DomainName = core.StringPtr("conops-mssql.conops.local") + databaseDetailsPrototypeModel.Hostname = core.StringPtr("http://db2@localhost:9900.com") + databaseDetailsPrototypeModel.HostnameInCertificate = core.StringPtr("samplehostname") + databaseDetailsPrototypeModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") + databaseDetailsPrototypeModel.InformixServer = core.StringPtr("ol_informix1410") + databaseDetailsPrototypeModel.Name = core.StringPtr("new_database") + databaseDetailsPrototypeModel.Password = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.PasswordKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Port = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.ProjectID = core.StringPtr("conops-bigquery") + databaseDetailsPrototypeModel.Sasl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SaslMechanism = core.StringPtr("plain") + databaseDetailsPrototypeModel.SchemaName = core.StringPtr("sampleSchema") + databaseDetailsPrototypeModel.Schemas = core.StringPtr("redis__name") + databaseDetailsPrototypeModel.ServiceApiKey = core.StringPtr("sampleapikey") + databaseDetailsPrototypeModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") + databaseDetailsPrototypeModel.ServicePassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ServicePort = core.Int64Ptr(int64(443)) + databaseDetailsPrototypeModel.ServiceSsl = core.BoolPtr(true) + databaseDetailsPrototypeModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") + databaseDetailsPrototypeModel.ServiceUsername = core.StringPtr("sampleusername") + databaseDetailsPrototypeModel.Ssl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SslcertificateKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Tables = core.StringPtr("kafka_table_name, redis_table_name") + databaseDetailsPrototypeModel.Username = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.UsernameKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.ValidateServerCertificate = core.BoolPtr(true) + databaseDetailsPrototypeModel.VaultEnabled = core.BoolPtr(true) + databaseDetailsPrototypeModel.VerifyHostName = core.BoolPtr(true) + databaseDetailsPrototypeModel.WarehouseName = core.StringPtr("samplewrehouse") - // Construct an instance of the CreateHdfsStorageOptions model - createHdfsStorageOptionsModel := new(watsonxdatav2.CreateHdfsStorageOptions) - createHdfsStorageOptionsModel.BucketDisplayName = core.StringPtr("testString") - createHdfsStorageOptionsModel.BucketType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HmsThriftURI = core.StringPtr("testString") - createHdfsStorageOptionsModel.HmsThriftPort = core.Int64Ptr(int64(1)) - createHdfsStorageOptionsModel.CoreSite = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsSite = core.StringPtr("testString") - createHdfsStorageOptionsModel.Kerberos = core.StringPtr("testString") - createHdfsStorageOptionsModel.CatalogName = core.StringPtr("testString") - createHdfsStorageOptionsModel.CatalogType = core.StringPtr("testString") - createHdfsStorageOptionsModel.Krb5Config = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveKeytab = CreateMockReader("This is a mock file.") - createHdfsStorageOptionsModel.HiveKeytabContentType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsKeytab = CreateMockReader("This is a mock file.") - createHdfsStorageOptionsModel.HdfsKeytabContentType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveServerPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveClientPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.Description = core.StringPtr("testString") - createHdfsStorageOptionsModel.CreatedOn = core.StringPtr("testString") - createHdfsStorageOptionsModel.AuthInstanceID = core.StringPtr("testString") - createHdfsStorageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DatabaseRegistrationPrototypeDatabasePropertiesItems model + databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems) + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Key = core.StringPtr("abc") + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") + + // Construct an instance of the CreateDatabaseRegistrationOptions model + createDatabaseRegistrationOptionsModel := new(watsonxdatav3.CreateDatabaseRegistrationOptions) + createDatabaseRegistrationOptionsModel.DisplayName = core.StringPtr("new_database") + createDatabaseRegistrationOptionsModel.Type = core.StringPtr("db2") + createDatabaseRegistrationOptionsModel.AssociatedCatalog = databaseCatalogPrototypeModel + createDatabaseRegistrationOptionsModel.Connection = databaseDetailsPrototypeModel + createDatabaseRegistrationOptionsModel.CreatedAt = core.StringPtr("1686792721") + createDatabaseRegistrationOptionsModel.Description = core.StringPtr("db2 extenal database description") + createDatabaseRegistrationOptionsModel.Properties = []watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel} + createDatabaseRegistrationOptionsModel.SourceAssetID = core.StringPtr("cc85d899-9ec3-496a-be36-99cabc62f123") + createDatabaseRegistrationOptionsModel.SourceCatalogID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff962f000") + createDatabaseRegistrationOptionsModel.SourceProjectID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116") + createDatabaseRegistrationOptionsModel.Tags = []string{"testdatabase", "userdatabase"} + createDatabaseRegistrationOptionsModel.TargetCatalogID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116") + createDatabaseRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDatabaseRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) + result, response, operationErr := watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateHdfsStorageOptions model with no property values - createHdfsStorageOptionsModelNew := new(watsonxdatav2.CreateHdfsStorageOptions) + // Construct a second instance of the CreateDatabaseRegistrationOptions model with no property values + createDatabaseRegistrationOptionsModelNew := new(watsonxdatav3.CreateDatabaseRegistrationOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -2815,40 +3497,104 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateHdfsStorage successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) + It(`Invoke CreateDatabaseRegistration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DatabaseCatalogPrototype model + databaseCatalogPrototypeModel := new(watsonxdatav3.DatabaseCatalogPrototype) + databaseCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + databaseCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + + // Construct an instance of the SecretDetails model + secretDetailsModel := new(watsonxdatav3.SecretDetails) + secretDetailsModel.Key = core.StringPtr("secret key") + secretDetailsModel.SecretName = core.StringPtr("secret name") + secretDetailsModel.SecretUrn = core.StringPtr("secret urn") + + // Construct an instance of the DatabaseDetailsPrototype model + databaseDetailsPrototypeModel := new(watsonxdatav3.DatabaseDetailsPrototype) + databaseDetailsPrototypeModel.AuthenticationType = core.StringPtr("LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword") + databaseDetailsPrototypeModel.AuthenticationValue = core.StringPtr("LDAP") + databaseDetailsPrototypeModel.AuthenticationValueKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.BrokerHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.BrokerPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.Certificate = core.StringPtr("exampleCertificate") + databaseDetailsPrototypeModel.CertificateExtension = core.StringPtr("pem") + databaseDetailsPrototypeModel.ConnectionMethod = core.StringPtr("basic, apikey") + databaseDetailsPrototypeModel.ConnectionMode = core.StringPtr("service_name") + databaseDetailsPrototypeModel.ConnectionModeValue = core.StringPtr("orclpdb") + databaseDetailsPrototypeModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") + databaseDetailsPrototypeModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.CoordinatorHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.CoordinatorPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.CpdHostname = core.StringPtr("samplecpdhostname") + databaseDetailsPrototypeModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") + databaseDetailsPrototypeModel.DomainName = core.StringPtr("conops-mssql.conops.local") + databaseDetailsPrototypeModel.Hostname = core.StringPtr("http://db2@localhost:9900.com") + databaseDetailsPrototypeModel.HostnameInCertificate = core.StringPtr("samplehostname") + databaseDetailsPrototypeModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") + databaseDetailsPrototypeModel.InformixServer = core.StringPtr("ol_informix1410") + databaseDetailsPrototypeModel.Name = core.StringPtr("new_database") + databaseDetailsPrototypeModel.Password = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.PasswordKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Port = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.ProjectID = core.StringPtr("conops-bigquery") + databaseDetailsPrototypeModel.Sasl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SaslMechanism = core.StringPtr("plain") + databaseDetailsPrototypeModel.SchemaName = core.StringPtr("sampleSchema") + databaseDetailsPrototypeModel.Schemas = core.StringPtr("redis__name") + databaseDetailsPrototypeModel.ServiceApiKey = core.StringPtr("sampleapikey") + databaseDetailsPrototypeModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") + databaseDetailsPrototypeModel.ServicePassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ServicePort = core.Int64Ptr(int64(443)) + databaseDetailsPrototypeModel.ServiceSsl = core.BoolPtr(true) + databaseDetailsPrototypeModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") + databaseDetailsPrototypeModel.ServiceUsername = core.StringPtr("sampleusername") + databaseDetailsPrototypeModel.Ssl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SslcertificateKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Tables = core.StringPtr("kafka_table_name, redis_table_name") + databaseDetailsPrototypeModel.Username = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.UsernameKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.ValidateServerCertificate = core.BoolPtr(true) + databaseDetailsPrototypeModel.VaultEnabled = core.BoolPtr(true) + databaseDetailsPrototypeModel.VerifyHostName = core.BoolPtr(true) + databaseDetailsPrototypeModel.WarehouseName = core.StringPtr("samplewrehouse") - // Construct an instance of the CreateHdfsStorageOptions model - createHdfsStorageOptionsModel := new(watsonxdatav2.CreateHdfsStorageOptions) - createHdfsStorageOptionsModel.BucketDisplayName = core.StringPtr("testString") - createHdfsStorageOptionsModel.BucketType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HmsThriftURI = core.StringPtr("testString") - createHdfsStorageOptionsModel.HmsThriftPort = core.Int64Ptr(int64(1)) - createHdfsStorageOptionsModel.CoreSite = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsSite = core.StringPtr("testString") - createHdfsStorageOptionsModel.Kerberos = core.StringPtr("testString") - createHdfsStorageOptionsModel.CatalogName = core.StringPtr("testString") - createHdfsStorageOptionsModel.CatalogType = core.StringPtr("testString") - createHdfsStorageOptionsModel.Krb5Config = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveKeytab = CreateMockReader("This is a mock file.") - createHdfsStorageOptionsModel.HiveKeytabContentType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsKeytab = CreateMockReader("This is a mock file.") - createHdfsStorageOptionsModel.HdfsKeytabContentType = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveServerPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.HiveClientPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.HdfsPrincipal = core.StringPtr("testString") - createHdfsStorageOptionsModel.Description = core.StringPtr("testString") - createHdfsStorageOptionsModel.CreatedOn = core.StringPtr("testString") - createHdfsStorageOptionsModel.AuthInstanceID = core.StringPtr("testString") - createHdfsStorageOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DatabaseRegistrationPrototypeDatabasePropertiesItems model + databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems) + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Key = core.StringPtr("abc") + databaseRegistrationPrototypeDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") + + // Construct an instance of the CreateDatabaseRegistrationOptions model + createDatabaseRegistrationOptionsModel := new(watsonxdatav3.CreateDatabaseRegistrationOptions) + createDatabaseRegistrationOptionsModel.DisplayName = core.StringPtr("new_database") + createDatabaseRegistrationOptionsModel.Type = core.StringPtr("db2") + createDatabaseRegistrationOptionsModel.AssociatedCatalog = databaseCatalogPrototypeModel + createDatabaseRegistrationOptionsModel.Connection = databaseDetailsPrototypeModel + createDatabaseRegistrationOptionsModel.CreatedAt = core.StringPtr("1686792721") + createDatabaseRegistrationOptionsModel.Description = core.StringPtr("db2 extenal database description") + createDatabaseRegistrationOptionsModel.Properties = []watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel} + createDatabaseRegistrationOptionsModel.SourceAssetID = core.StringPtr("cc85d899-9ec3-496a-be36-99cabc62f123") + createDatabaseRegistrationOptionsModel.SourceCatalogID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff962f000") + createDatabaseRegistrationOptionsModel.SourceProjectID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116") + createDatabaseRegistrationOptionsModel.Tags = []string{"testdatabase", "userdatabase"} + createDatabaseRegistrationOptionsModel.TargetCatalogID = core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116") + createDatabaseRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDatabaseRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateHdfsStorage(createHdfsStorageOptionsModel) + result, response, operationErr := watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -2860,44 +3606,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListDatabaseRegistrations(listDatabaseRegistrationsOptions *ListDatabaseRegistrationsOptions) - Operation response error`, func() { - listDatabaseRegistrationsPath := "/database_registrations" + Describe(`AddDatabaseCatalog(addDatabaseCatalogOptions *AddDatabaseCatalogOptions) - Operation response error`, func() { + addDatabaseCatalogPath := "/v3/database_registrations/testString/catalogs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDatabaseRegistrationsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addDatabaseCatalogPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListDatabaseRegistrations with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke AddDatabaseCatalog with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListDatabaseRegistrationsOptions model - listDatabaseRegistrationsOptionsModel := new(watsonxdatav2.ListDatabaseRegistrationsOptions) - listDatabaseRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDatabaseRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddDatabaseCatalogOptions model + addDatabaseCatalogOptionsModel := new(watsonxdatav3.AddDatabaseCatalogOptions) + addDatabaseCatalogOptionsModel.DatabaseID = core.StringPtr("testString") + addDatabaseCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") + addDatabaseCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + addDatabaseCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) + result, response, operationErr := watsonxDataService.AddDatabaseCatalog(addDatabaseCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) + result, response, operationErr = watsonxDataService.AddDatabaseCatalog(addDatabaseCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -2907,16 +3655,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListDatabaseRegistrations(listDatabaseRegistrationsOptions *ListDatabaseRegistrationsOptions)`, func() { - listDatabaseRegistrationsPath := "/database_registrations" + Describe(`AddDatabaseCatalog(addDatabaseCatalogOptions *AddDatabaseCatalogOptions)`, func() { + addDatabaseCatalogPath := "/v3/database_registrations/testString/catalogs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDatabaseRegistrationsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addDatabaseCatalogPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -2925,12 +3689,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"database_registrations": [{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "created_by": "user1@bim.com", "created_on": "1686792721", "database_details": {"authentication_type": "LDAP", "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "certificate": "contents of a pem/crt file", "certificate_extension": "pem/crt", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "controller_authentication_user": "sampleuser", "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "database_name": "new_database", "hostname": "db2@.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "sasl": true, "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true}, "database_display_name": "new_database", "database_id": "new_database_id", "database_properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "database_type": "netezza", "description": "Description of the external database", "tags": ["Tags"], "topics": [{"created_on": "1686792721", "file_contents": "sample file content", "file_name": "sample file name", "topic_name": "customer"}]}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke ListDatabaseRegistrations successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke AddDatabaseCatalog successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -2938,21 +3702,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListDatabaseRegistrationsOptions model - listDatabaseRegistrationsOptionsModel := new(watsonxdatav2.ListDatabaseRegistrationsOptions) - listDatabaseRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDatabaseRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddDatabaseCatalogOptions model + addDatabaseCatalogOptionsModel := new(watsonxdatav3.AddDatabaseCatalogOptions) + addDatabaseCatalogOptionsModel.DatabaseID = core.StringPtr("testString") + addDatabaseCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") + addDatabaseCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + addDatabaseCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListDatabaseRegistrationsWithContext(ctx, listDatabaseRegistrationsOptionsModel) + _, _, operationErr := watsonxDataService.AddDatabaseCatalogWithContext(ctx, addDatabaseCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) + result, response, operationErr := watsonxDataService.AddDatabaseCatalog(addDatabaseCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -2960,7 +3726,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListDatabaseRegistrationsWithContext(ctx, listDatabaseRegistrationsOptionsModel) + _, _, operationErr = watsonxDataService.AddDatabaseCatalogWithContext(ctx, addDatabaseCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -2974,19 +3740,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDatabaseRegistrationsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(addDatabaseCatalogPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"database_registrations": [{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "created_by": "user1@bim.com", "created_on": "1686792721", "database_details": {"authentication_type": "LDAP", "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "certificate": "contents of a pem/crt file", "certificate_extension": "pem/crt", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "controller_authentication_user": "sampleuser", "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "database_name": "new_database", "hostname": "db2@.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "sasl": true, "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true}, "database_display_name": "new_database", "database_id": "new_database_id", "database_properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "database_type": "netezza", "description": "Description of the external database", "tags": ["Tags"], "topics": [{"created_on": "1686792721", "file_contents": "sample file content", "file_name": "sample file name", "topic_name": "customer"}]}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke ListDatabaseRegistrations successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke AddDatabaseCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -2994,43 +3776,54 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListDatabaseRegistrations(nil) + result, response, operationErr := watsonxDataService.AddDatabaseCatalog(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListDatabaseRegistrationsOptions model - listDatabaseRegistrationsOptionsModel := new(watsonxdatav2.ListDatabaseRegistrationsOptions) - listDatabaseRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDatabaseRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddDatabaseCatalogOptions model + addDatabaseCatalogOptionsModel := new(watsonxdatav3.AddDatabaseCatalogOptions) + addDatabaseCatalogOptionsModel.DatabaseID = core.StringPtr("testString") + addDatabaseCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") + addDatabaseCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + addDatabaseCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) + result, response, operationErr = watsonxDataService.AddDatabaseCatalog(addDatabaseCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListDatabaseRegistrations with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke AddDatabaseCatalog with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListDatabaseRegistrationsOptions model - listDatabaseRegistrationsOptionsModel := new(watsonxdatav2.ListDatabaseRegistrationsOptions) - listDatabaseRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDatabaseRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddDatabaseCatalogOptions model + addDatabaseCatalogOptionsModel := new(watsonxdatav3.AddDatabaseCatalogOptions) + addDatabaseCatalogOptionsModel.DatabaseID = core.StringPtr("testString") + addDatabaseCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") + addDatabaseCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + addDatabaseCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) + result, response, operationErr := watsonxDataService.AddDatabaseCatalog(addDatabaseCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the AddDatabaseCatalogOptions model with no property values + addDatabaseCatalogOptionsModelNew := new(watsonxdatav3.AddDatabaseCatalogOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.AddDatabaseCatalog(addDatabaseCatalogOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -3042,24 +3835,26 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListDatabaseRegistrations successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke AddDatabaseCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListDatabaseRegistrationsOptions model - listDatabaseRegistrationsOptionsModel := new(watsonxdatav2.ListDatabaseRegistrationsOptions) - listDatabaseRegistrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDatabaseRegistrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the AddDatabaseCatalogOptions model + addDatabaseCatalogOptionsModel := new(watsonxdatav3.AddDatabaseCatalogOptions) + addDatabaseCatalogOptionsModel.DatabaseID = core.StringPtr("testString") + addDatabaseCatalogOptionsModel.CatalogName = core.StringPtr("sampleCatalog") + addDatabaseCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + addDatabaseCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListDatabaseRegistrations(listDatabaseRegistrationsOptionsModel) + result, response, operationErr := watsonxDataService.AddDatabaseCatalog(addDatabaseCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -3071,570 +3866,25 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateDatabaseRegistration(createDatabaseRegistrationOptions *CreateDatabaseRegistrationOptions) - Operation response error`, func() { - createDatabaseRegistrationPath := "/database_registrations" + Describe(`GetDatabase(getDatabaseOptions *GetDatabaseOptions) - Operation response error`, func() { + getDatabasePath := "/v3/database_registrations/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDatabaseRegistrationPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getDatabasePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke CreateDatabaseRegistration with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DatabaseCatalog model - databaseCatalogModel := new(watsonxdatav2.DatabaseCatalog) - databaseCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - databaseCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - databaseCatalogModel.CatalogType = core.StringPtr("iceberg") - - // Construct an instance of the DatabaseDetails model - databaseDetailsModel := new(watsonxdatav2.DatabaseDetails) - databaseDetailsModel.AuthenticationType = core.StringPtr("LDAP") - databaseDetailsModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.Certificate = core.StringPtr("contents of a pem/crt file") - databaseDetailsModel.CertificateExtension = core.StringPtr("pem/crt") - databaseDetailsModel.ConnectionMethod = core.StringPtr("basic, apikey") - databaseDetailsModel.ConnectionMode = core.StringPtr("service_name") - databaseDetailsModel.ConnectionModeValue = core.StringPtr("orclpdb") - databaseDetailsModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") - databaseDetailsModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.CpdHostname = core.StringPtr("samplecpdhostname") - databaseDetailsModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") - databaseDetailsModel.DatabaseName = core.StringPtr("new_database") - databaseDetailsModel.Hostname = core.StringPtr("db2@.com") - databaseDetailsModel.HostnameInCertificate = core.StringPtr("samplehostname") - databaseDetailsModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") - databaseDetailsModel.InformixServer = core.StringPtr("ol_informix1410") - databaseDetailsModel.Password = core.StringPtr("samplepassword") - databaseDetailsModel.Port = core.Int64Ptr(int64(4553)) - databaseDetailsModel.ProjectID = core.StringPtr("conops-bigquery") - databaseDetailsModel.Sasl = core.BoolPtr(true) - databaseDetailsModel.ServiceApiKey = core.StringPtr("sampleapikey") - databaseDetailsModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") - databaseDetailsModel.ServicePassword = core.StringPtr("samplepassword") - databaseDetailsModel.ServicePort = core.Int64Ptr(int64(443)) - databaseDetailsModel.ServiceSsl = core.BoolPtr(true) - databaseDetailsModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") - databaseDetailsModel.ServiceUsername = core.StringPtr("sampleusername") - databaseDetailsModel.Ssl = core.BoolPtr(true) - databaseDetailsModel.Tables = core.StringPtr("kafka_table_name") - databaseDetailsModel.Username = core.StringPtr("sampleuser") - databaseDetailsModel.ValidateServerCertificate = core.BoolPtr(true) - databaseDetailsModel.VerifyHostName = core.BoolPtr(true) - - // Construct an instance of the DatabaseRegistrationPrototypeDatabasePropertiesItems model - databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems) - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Key = core.StringPtr("abc") - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") - - // Construct an instance of the CreateDatabaseRegistrationOptions model - createDatabaseRegistrationOptionsModel := new(watsonxdatav2.CreateDatabaseRegistrationOptions) - createDatabaseRegistrationOptionsModel.DatabaseDisplayName = core.StringPtr("new_database") - createDatabaseRegistrationOptionsModel.DatabaseType = core.StringPtr("db2") - createDatabaseRegistrationOptionsModel.AssociatedCatalog = databaseCatalogModel - createDatabaseRegistrationOptionsModel.CreatedOn = core.StringPtr("1686792721") - createDatabaseRegistrationOptionsModel.DatabaseDetails = databaseDetailsModel - createDatabaseRegistrationOptionsModel.DatabaseProperties = []watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel} - createDatabaseRegistrationOptionsModel.Description = core.StringPtr("db2 extenal database description") - createDatabaseRegistrationOptionsModel.Tags = []string{"testdatabase", "userdatabase"} - createDatabaseRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDatabaseRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateDatabaseRegistration(createDatabaseRegistrationOptions *CreateDatabaseRegistrationOptions)`, func() { - createDatabaseRegistrationPath := "/database_registrations" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDatabaseRegistrationPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "created_by": "user1@bim.com", "created_on": "1686792721", "database_details": {"authentication_type": "LDAP", "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "certificate": "contents of a pem/crt file", "certificate_extension": "pem/crt", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "controller_authentication_user": "sampleuser", "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "database_name": "new_database", "hostname": "db2@.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "sasl": true, "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true}, "database_display_name": "new_database", "database_id": "new_database_id", "database_properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "database_type": "netezza", "description": "Description of the external database", "tags": ["Tags"], "topics": [{"created_on": "1686792721", "file_contents": "sample file content", "file_name": "sample file name", "topic_name": "customer"}]}`) - })) - }) - It(`Invoke CreateDatabaseRegistration successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - watsonxDataService.EnableRetries(0, 0) - - // Construct an instance of the DatabaseCatalog model - databaseCatalogModel := new(watsonxdatav2.DatabaseCatalog) - databaseCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - databaseCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - databaseCatalogModel.CatalogType = core.StringPtr("iceberg") - - // Construct an instance of the DatabaseDetails model - databaseDetailsModel := new(watsonxdatav2.DatabaseDetails) - databaseDetailsModel.AuthenticationType = core.StringPtr("LDAP") - databaseDetailsModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.Certificate = core.StringPtr("contents of a pem/crt file") - databaseDetailsModel.CertificateExtension = core.StringPtr("pem/crt") - databaseDetailsModel.ConnectionMethod = core.StringPtr("basic, apikey") - databaseDetailsModel.ConnectionMode = core.StringPtr("service_name") - databaseDetailsModel.ConnectionModeValue = core.StringPtr("orclpdb") - databaseDetailsModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") - databaseDetailsModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.CpdHostname = core.StringPtr("samplecpdhostname") - databaseDetailsModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") - databaseDetailsModel.DatabaseName = core.StringPtr("new_database") - databaseDetailsModel.Hostname = core.StringPtr("db2@.com") - databaseDetailsModel.HostnameInCertificate = core.StringPtr("samplehostname") - databaseDetailsModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") - databaseDetailsModel.InformixServer = core.StringPtr("ol_informix1410") - databaseDetailsModel.Password = core.StringPtr("samplepassword") - databaseDetailsModel.Port = core.Int64Ptr(int64(4553)) - databaseDetailsModel.ProjectID = core.StringPtr("conops-bigquery") - databaseDetailsModel.Sasl = core.BoolPtr(true) - databaseDetailsModel.ServiceApiKey = core.StringPtr("sampleapikey") - databaseDetailsModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") - databaseDetailsModel.ServicePassword = core.StringPtr("samplepassword") - databaseDetailsModel.ServicePort = core.Int64Ptr(int64(443)) - databaseDetailsModel.ServiceSsl = core.BoolPtr(true) - databaseDetailsModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") - databaseDetailsModel.ServiceUsername = core.StringPtr("sampleusername") - databaseDetailsModel.Ssl = core.BoolPtr(true) - databaseDetailsModel.Tables = core.StringPtr("kafka_table_name") - databaseDetailsModel.Username = core.StringPtr("sampleuser") - databaseDetailsModel.ValidateServerCertificate = core.BoolPtr(true) - databaseDetailsModel.VerifyHostName = core.BoolPtr(true) - - // Construct an instance of the DatabaseRegistrationPrototypeDatabasePropertiesItems model - databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems) - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Key = core.StringPtr("abc") - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") - - // Construct an instance of the CreateDatabaseRegistrationOptions model - createDatabaseRegistrationOptionsModel := new(watsonxdatav2.CreateDatabaseRegistrationOptions) - createDatabaseRegistrationOptionsModel.DatabaseDisplayName = core.StringPtr("new_database") - createDatabaseRegistrationOptionsModel.DatabaseType = core.StringPtr("db2") - createDatabaseRegistrationOptionsModel.AssociatedCatalog = databaseCatalogModel - createDatabaseRegistrationOptionsModel.CreatedOn = core.StringPtr("1686792721") - createDatabaseRegistrationOptionsModel.DatabaseDetails = databaseDetailsModel - createDatabaseRegistrationOptionsModel.DatabaseProperties = []watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel} - createDatabaseRegistrationOptionsModel.Description = core.StringPtr("db2 extenal database description") - createDatabaseRegistrationOptionsModel.Tags = []string{"testdatabase", "userdatabase"} - createDatabaseRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDatabaseRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateDatabaseRegistrationWithContext(ctx, createDatabaseRegistrationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateDatabaseRegistrationWithContext(ctx, createDatabaseRegistrationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDatabaseRegistrationPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "created_by": "user1@bim.com", "created_on": "1686792721", "database_details": {"authentication_type": "LDAP", "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "certificate": "contents of a pem/crt file", "certificate_extension": "pem/crt", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "controller_authentication_user": "sampleuser", "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "database_name": "new_database", "hostname": "db2@.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "sasl": true, "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true}, "database_display_name": "new_database", "database_id": "new_database_id", "database_properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "database_type": "netezza", "description": "Description of the external database", "tags": ["Tags"], "topics": [{"created_on": "1686792721", "file_contents": "sample file content", "file_name": "sample file name", "topic_name": "customer"}]}`) - })) - }) - It(`Invoke CreateDatabaseRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateDatabaseRegistration(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the DatabaseCatalog model - databaseCatalogModel := new(watsonxdatav2.DatabaseCatalog) - databaseCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - databaseCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - databaseCatalogModel.CatalogType = core.StringPtr("iceberg") - - // Construct an instance of the DatabaseDetails model - databaseDetailsModel := new(watsonxdatav2.DatabaseDetails) - databaseDetailsModel.AuthenticationType = core.StringPtr("LDAP") - databaseDetailsModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.Certificate = core.StringPtr("contents of a pem/crt file") - databaseDetailsModel.CertificateExtension = core.StringPtr("pem/crt") - databaseDetailsModel.ConnectionMethod = core.StringPtr("basic, apikey") - databaseDetailsModel.ConnectionMode = core.StringPtr("service_name") - databaseDetailsModel.ConnectionModeValue = core.StringPtr("orclpdb") - databaseDetailsModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") - databaseDetailsModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.CpdHostname = core.StringPtr("samplecpdhostname") - databaseDetailsModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") - databaseDetailsModel.DatabaseName = core.StringPtr("new_database") - databaseDetailsModel.Hostname = core.StringPtr("db2@.com") - databaseDetailsModel.HostnameInCertificate = core.StringPtr("samplehostname") - databaseDetailsModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") - databaseDetailsModel.InformixServer = core.StringPtr("ol_informix1410") - databaseDetailsModel.Password = core.StringPtr("samplepassword") - databaseDetailsModel.Port = core.Int64Ptr(int64(4553)) - databaseDetailsModel.ProjectID = core.StringPtr("conops-bigquery") - databaseDetailsModel.Sasl = core.BoolPtr(true) - databaseDetailsModel.ServiceApiKey = core.StringPtr("sampleapikey") - databaseDetailsModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") - databaseDetailsModel.ServicePassword = core.StringPtr("samplepassword") - databaseDetailsModel.ServicePort = core.Int64Ptr(int64(443)) - databaseDetailsModel.ServiceSsl = core.BoolPtr(true) - databaseDetailsModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") - databaseDetailsModel.ServiceUsername = core.StringPtr("sampleusername") - databaseDetailsModel.Ssl = core.BoolPtr(true) - databaseDetailsModel.Tables = core.StringPtr("kafka_table_name") - databaseDetailsModel.Username = core.StringPtr("sampleuser") - databaseDetailsModel.ValidateServerCertificate = core.BoolPtr(true) - databaseDetailsModel.VerifyHostName = core.BoolPtr(true) - - // Construct an instance of the DatabaseRegistrationPrototypeDatabasePropertiesItems model - databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems) - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Key = core.StringPtr("abc") - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") - - // Construct an instance of the CreateDatabaseRegistrationOptions model - createDatabaseRegistrationOptionsModel := new(watsonxdatav2.CreateDatabaseRegistrationOptions) - createDatabaseRegistrationOptionsModel.DatabaseDisplayName = core.StringPtr("new_database") - createDatabaseRegistrationOptionsModel.DatabaseType = core.StringPtr("db2") - createDatabaseRegistrationOptionsModel.AssociatedCatalog = databaseCatalogModel - createDatabaseRegistrationOptionsModel.CreatedOn = core.StringPtr("1686792721") - createDatabaseRegistrationOptionsModel.DatabaseDetails = databaseDetailsModel - createDatabaseRegistrationOptionsModel.DatabaseProperties = []watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel} - createDatabaseRegistrationOptionsModel.Description = core.StringPtr("db2 extenal database description") - createDatabaseRegistrationOptionsModel.Tags = []string{"testdatabase", "userdatabase"} - createDatabaseRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDatabaseRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateDatabaseRegistration with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DatabaseCatalog model - databaseCatalogModel := new(watsonxdatav2.DatabaseCatalog) - databaseCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - databaseCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - databaseCatalogModel.CatalogType = core.StringPtr("iceberg") - - // Construct an instance of the DatabaseDetails model - databaseDetailsModel := new(watsonxdatav2.DatabaseDetails) - databaseDetailsModel.AuthenticationType = core.StringPtr("LDAP") - databaseDetailsModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.Certificate = core.StringPtr("contents of a pem/crt file") - databaseDetailsModel.CertificateExtension = core.StringPtr("pem/crt") - databaseDetailsModel.ConnectionMethod = core.StringPtr("basic, apikey") - databaseDetailsModel.ConnectionMode = core.StringPtr("service_name") - databaseDetailsModel.ConnectionModeValue = core.StringPtr("orclpdb") - databaseDetailsModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") - databaseDetailsModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.CpdHostname = core.StringPtr("samplecpdhostname") - databaseDetailsModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") - databaseDetailsModel.DatabaseName = core.StringPtr("new_database") - databaseDetailsModel.Hostname = core.StringPtr("db2@.com") - databaseDetailsModel.HostnameInCertificate = core.StringPtr("samplehostname") - databaseDetailsModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") - databaseDetailsModel.InformixServer = core.StringPtr("ol_informix1410") - databaseDetailsModel.Password = core.StringPtr("samplepassword") - databaseDetailsModel.Port = core.Int64Ptr(int64(4553)) - databaseDetailsModel.ProjectID = core.StringPtr("conops-bigquery") - databaseDetailsModel.Sasl = core.BoolPtr(true) - databaseDetailsModel.ServiceApiKey = core.StringPtr("sampleapikey") - databaseDetailsModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") - databaseDetailsModel.ServicePassword = core.StringPtr("samplepassword") - databaseDetailsModel.ServicePort = core.Int64Ptr(int64(443)) - databaseDetailsModel.ServiceSsl = core.BoolPtr(true) - databaseDetailsModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") - databaseDetailsModel.ServiceUsername = core.StringPtr("sampleusername") - databaseDetailsModel.Ssl = core.BoolPtr(true) - databaseDetailsModel.Tables = core.StringPtr("kafka_table_name") - databaseDetailsModel.Username = core.StringPtr("sampleuser") - databaseDetailsModel.ValidateServerCertificate = core.BoolPtr(true) - databaseDetailsModel.VerifyHostName = core.BoolPtr(true) - - // Construct an instance of the DatabaseRegistrationPrototypeDatabasePropertiesItems model - databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems) - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Key = core.StringPtr("abc") - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") - - // Construct an instance of the CreateDatabaseRegistrationOptions model - createDatabaseRegistrationOptionsModel := new(watsonxdatav2.CreateDatabaseRegistrationOptions) - createDatabaseRegistrationOptionsModel.DatabaseDisplayName = core.StringPtr("new_database") - createDatabaseRegistrationOptionsModel.DatabaseType = core.StringPtr("db2") - createDatabaseRegistrationOptionsModel.AssociatedCatalog = databaseCatalogModel - createDatabaseRegistrationOptionsModel.CreatedOn = core.StringPtr("1686792721") - createDatabaseRegistrationOptionsModel.DatabaseDetails = databaseDetailsModel - createDatabaseRegistrationOptionsModel.DatabaseProperties = []watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel} - createDatabaseRegistrationOptionsModel.Description = core.StringPtr("db2 extenal database description") - createDatabaseRegistrationOptionsModel.Tags = []string{"testdatabase", "userdatabase"} - createDatabaseRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDatabaseRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the CreateDatabaseRegistrationOptions model with no property values - createDatabaseRegistrationOptionsModelNew := new(watsonxdatav2.CreateDatabaseRegistrationOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(201) - })) - }) - It(`Invoke CreateDatabaseRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DatabaseCatalog model - databaseCatalogModel := new(watsonxdatav2.DatabaseCatalog) - databaseCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - databaseCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - databaseCatalogModel.CatalogType = core.StringPtr("iceberg") - - // Construct an instance of the DatabaseDetails model - databaseDetailsModel := new(watsonxdatav2.DatabaseDetails) - databaseDetailsModel.AuthenticationType = core.StringPtr("LDAP") - databaseDetailsModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.Certificate = core.StringPtr("contents of a pem/crt file") - databaseDetailsModel.CertificateExtension = core.StringPtr("pem/crt") - databaseDetailsModel.ConnectionMethod = core.StringPtr("basic, apikey") - databaseDetailsModel.ConnectionMode = core.StringPtr("service_name") - databaseDetailsModel.ConnectionModeValue = core.StringPtr("orclpdb") - databaseDetailsModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") - databaseDetailsModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.CpdHostname = core.StringPtr("samplecpdhostname") - databaseDetailsModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") - databaseDetailsModel.DatabaseName = core.StringPtr("new_database") - databaseDetailsModel.Hostname = core.StringPtr("db2@.com") - databaseDetailsModel.HostnameInCertificate = core.StringPtr("samplehostname") - databaseDetailsModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") - databaseDetailsModel.InformixServer = core.StringPtr("ol_informix1410") - databaseDetailsModel.Password = core.StringPtr("samplepassword") - databaseDetailsModel.Port = core.Int64Ptr(int64(4553)) - databaseDetailsModel.ProjectID = core.StringPtr("conops-bigquery") - databaseDetailsModel.Sasl = core.BoolPtr(true) - databaseDetailsModel.ServiceApiKey = core.StringPtr("sampleapikey") - databaseDetailsModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") - databaseDetailsModel.ServicePassword = core.StringPtr("samplepassword") - databaseDetailsModel.ServicePort = core.Int64Ptr(int64(443)) - databaseDetailsModel.ServiceSsl = core.BoolPtr(true) - databaseDetailsModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") - databaseDetailsModel.ServiceUsername = core.StringPtr("sampleusername") - databaseDetailsModel.Ssl = core.BoolPtr(true) - databaseDetailsModel.Tables = core.StringPtr("kafka_table_name") - databaseDetailsModel.Username = core.StringPtr("sampleuser") - databaseDetailsModel.ValidateServerCertificate = core.BoolPtr(true) - databaseDetailsModel.VerifyHostName = core.BoolPtr(true) - - // Construct an instance of the DatabaseRegistrationPrototypeDatabasePropertiesItems model - databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems) - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Key = core.StringPtr("abc") - databaseRegistrationPrototypeDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") - - // Construct an instance of the CreateDatabaseRegistrationOptions model - createDatabaseRegistrationOptionsModel := new(watsonxdatav2.CreateDatabaseRegistrationOptions) - createDatabaseRegistrationOptionsModel.DatabaseDisplayName = core.StringPtr("new_database") - createDatabaseRegistrationOptionsModel.DatabaseType = core.StringPtr("db2") - createDatabaseRegistrationOptionsModel.AssociatedCatalog = databaseCatalogModel - createDatabaseRegistrationOptionsModel.CreatedOn = core.StringPtr("1686792721") - createDatabaseRegistrationOptionsModel.DatabaseDetails = databaseDetailsModel - createDatabaseRegistrationOptionsModel.DatabaseProperties = []watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel} - createDatabaseRegistrationOptionsModel.Description = core.StringPtr("db2 extenal database description") - createDatabaseRegistrationOptionsModel.Tags = []string{"testdatabase", "userdatabase"} - createDatabaseRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDatabaseRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := watsonxDataService.CreateDatabaseRegistration(createDatabaseRegistrationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetDatabase(getDatabaseOptions *GetDatabaseOptions) - Operation response error`, func() { - getDatabasePath := "/database_registrations/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getDatabasePath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) It(`Invoke GetDatabase with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -3642,8 +3892,8 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Construct an instance of the GetDatabaseOptions model - getDatabaseOptionsModel := new(watsonxdatav2.GetDatabaseOptions) - getDatabaseOptionsModel.DatabaseID = core.StringPtr("testString") + getDatabaseOptionsModel := new(watsonxdatav3.GetDatabaseOptions) + getDatabaseOptionsModel.ID = core.StringPtr("testString") getDatabaseOptionsModel.AuthInstanceID = core.StringPtr("testString") getDatabaseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response @@ -3665,7 +3915,7 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) Describe(`GetDatabase(getDatabaseOptions *GetDatabaseOptions)`, func() { - getDatabasePath := "/database_registrations/testString" + getDatabasePath := "/v3/database_registrations/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { @@ -3683,11 +3933,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "created_by": "user1@bim.com", "created_on": "1686792721", "database_details": {"authentication_type": "LDAP", "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "certificate": "contents of a pem/crt file", "certificate_extension": "pem/crt", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "controller_authentication_user": "sampleuser", "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "database_name": "new_database", "hostname": "db2@.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "sasl": true, "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true}, "database_display_name": "new_database", "database_id": "new_database_id", "database_properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "database_type": "netezza", "description": "Description of the external database", "tags": ["Tags"], "topics": [{"created_on": "1686792721", "file_contents": "sample file content", "file_name": "sample file name", "topic_name": "customer"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "connection": {"authentication_type": "LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword", "authentication_value": "LDAP", "authentication_value_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "broker_host": "samplehost", "broker_port": 4553, "certificate": "exampleCertificate", "certificate_extension": "pem", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "password_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "controller_authentication_user": "sampleuser", "coordinator_host": "samplehost", "coordinator_port": 4553, "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "domain_name": "conops-mssql.conops.local", "hostname": "http://db2@localhost:9900.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "name": "new_database", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "sasl": true, "sasl_mechanism": "plain", "schema_name": "sampleSchema", "schemas": "redis__name", "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name, redis_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true, "sslcertificate_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true, "username_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "warehouse_name": "samplewrehouse"}, "created_at": "1686792721", "created_by": "user1@ibm.com", "description": "Description of the external database", "display_name": "new_database", "id": "mysql123", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "target_catalog_id": "cc85d899-9ec3-496a-be36-99cff9000116", "source_asset_id": "cc85d899-9ec3-496a-be36-99cabc62f123", "source_catalog_id": "cc85d899-9ec3-496a-be36-99cff962f000", "source_project_id": "cc85d899-9ec3-496a-be36-99cff9000116", "tables": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "test.json", "schema_name": "customer", "table_name": "customer"}], "tags": ["Tags"], "topics": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "employee.json", "topic_name": "customer"}], "type": "netezza", "vault_enabled": true}`) })) }) It(`Invoke GetDatabase successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -3696,8 +3946,8 @@ var _ = Describe(`WatsonxDataV2`, func() { watsonxDataService.EnableRetries(0, 0) // Construct an instance of the GetDatabaseOptions model - getDatabaseOptionsModel := new(watsonxdatav2.GetDatabaseOptions) - getDatabaseOptionsModel.DatabaseID = core.StringPtr("testString") + getDatabaseOptionsModel := new(watsonxdatav3.GetDatabaseOptions) + getDatabaseOptionsModel.ID = core.StringPtr("testString") getDatabaseOptionsModel.AuthInstanceID = core.StringPtr("testString") getDatabaseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -3740,11 +3990,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "created_by": "user1@bim.com", "created_on": "1686792721", "database_details": {"authentication_type": "LDAP", "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "certificate": "contents of a pem/crt file", "certificate_extension": "pem/crt", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "controller_authentication_user": "sampleuser", "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "database_name": "new_database", "hostname": "db2@.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "sasl": true, "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true}, "database_display_name": "new_database", "database_id": "new_database_id", "database_properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "database_type": "netezza", "description": "Description of the external database", "tags": ["Tags"], "topics": [{"created_on": "1686792721", "file_contents": "sample file content", "file_name": "sample file name", "topic_name": "customer"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "connection": {"authentication_type": "LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword", "authentication_value": "LDAP", "authentication_value_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "broker_host": "samplehost", "broker_port": 4553, "certificate": "exampleCertificate", "certificate_extension": "pem", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "password_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "controller_authentication_user": "sampleuser", "coordinator_host": "samplehost", "coordinator_port": 4553, "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "domain_name": "conops-mssql.conops.local", "hostname": "http://db2@localhost:9900.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "name": "new_database", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "sasl": true, "sasl_mechanism": "plain", "schema_name": "sampleSchema", "schemas": "redis__name", "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name, redis_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true, "sslcertificate_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true, "username_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "warehouse_name": "samplewrehouse"}, "created_at": "1686792721", "created_by": "user1@ibm.com", "description": "Description of the external database", "display_name": "new_database", "id": "mysql123", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "target_catalog_id": "cc85d899-9ec3-496a-be36-99cff9000116", "source_asset_id": "cc85d899-9ec3-496a-be36-99cabc62f123", "source_catalog_id": "cc85d899-9ec3-496a-be36-99cff962f000", "source_project_id": "cc85d899-9ec3-496a-be36-99cff9000116", "tables": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "test.json", "schema_name": "customer", "table_name": "customer"}], "tags": ["Tags"], "topics": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "employee.json", "topic_name": "customer"}], "type": "netezza", "vault_enabled": true}`) })) }) It(`Invoke GetDatabase successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -3758,8 +4008,8 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(result).To(BeNil()) // Construct an instance of the GetDatabaseOptions model - getDatabaseOptionsModel := new(watsonxdatav2.GetDatabaseOptions) - getDatabaseOptionsModel.DatabaseID = core.StringPtr("testString") + getDatabaseOptionsModel := new(watsonxdatav3.GetDatabaseOptions) + getDatabaseOptionsModel.ID = core.StringPtr("testString") getDatabaseOptionsModel.AuthInstanceID = core.StringPtr("testString") getDatabaseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -3771,7 +4021,7 @@ var _ = Describe(`WatsonxDataV2`, func() { }) It(`Invoke GetDatabase with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -3779,8 +4029,8 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Construct an instance of the GetDatabaseOptions model - getDatabaseOptionsModel := new(watsonxdatav2.GetDatabaseOptions) - getDatabaseOptionsModel.DatabaseID = core.StringPtr("testString") + getDatabaseOptionsModel := new(watsonxdatav3.GetDatabaseOptions) + getDatabaseOptionsModel.ID = core.StringPtr("testString") getDatabaseOptionsModel.AuthInstanceID = core.StringPtr("testString") getDatabaseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -3792,7 +4042,7 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) // Construct a second instance of the GetDatabaseOptions model with no property values - getDatabaseOptionsModelNew := new(watsonxdatav2.GetDatabaseOptions) + getDatabaseOptionsModelNew := new(watsonxdatav3.GetDatabaseOptions) // Invoke operation with invalid model (negative test) result, response, operationErr = watsonxDataService.GetDatabase(getDatabaseOptionsModelNew) Expect(operationErr).ToNot(BeNil()) @@ -3813,7 +4063,7 @@ var _ = Describe(`WatsonxDataV2`, func() { })) }) It(`Invoke GetDatabase successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -3821,8 +4071,8 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Construct an instance of the GetDatabaseOptions model - getDatabaseOptionsModel := new(watsonxdatav2.GetDatabaseOptions) - getDatabaseOptionsModel.DatabaseID = core.StringPtr("testString") + getDatabaseOptionsModel := new(watsonxdatav3.GetDatabaseOptions) + getDatabaseOptionsModel.ID = core.StringPtr("testString") getDatabaseOptionsModel.AuthInstanceID = core.StringPtr("testString") getDatabaseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -3840,7 +4090,7 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) Describe(`DeleteDatabaseCatalog(deleteDatabaseCatalogOptions *DeleteDatabaseCatalogOptions)`, func() { - deleteDatabaseCatalogPath := "/database_registrations/testString" + deleteDatabaseCatalogPath := "/v3/database_registrations/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { @@ -3856,7 +4106,7 @@ var _ = Describe(`WatsonxDataV2`, func() { })) }) It(`Invoke DeleteDatabaseCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -3869,8 +4119,8 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(response).To(BeNil()) // Construct an instance of the DeleteDatabaseCatalogOptions model - deleteDatabaseCatalogOptionsModel := new(watsonxdatav2.DeleteDatabaseCatalogOptions) - deleteDatabaseCatalogOptionsModel.DatabaseID = core.StringPtr("testString") + deleteDatabaseCatalogOptionsModel := new(watsonxdatav3.DeleteDatabaseCatalogOptions) + deleteDatabaseCatalogOptionsModel.ID = core.StringPtr("testString") deleteDatabaseCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") deleteDatabaseCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -3880,7 +4130,7 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(response).ToNot(BeNil()) }) It(`Invoke DeleteDatabaseCatalog with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -3888,8 +4138,8 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Construct an instance of the DeleteDatabaseCatalogOptions model - deleteDatabaseCatalogOptionsModel := new(watsonxdatav2.DeleteDatabaseCatalogOptions) - deleteDatabaseCatalogOptionsModel.DatabaseID = core.StringPtr("testString") + deleteDatabaseCatalogOptionsModel := new(watsonxdatav3.DeleteDatabaseCatalogOptions) + deleteDatabaseCatalogOptionsModel.ID = core.StringPtr("testString") deleteDatabaseCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") deleteDatabaseCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) @@ -3900,7 +4150,7 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) // Construct a second instance of the DeleteDatabaseCatalogOptions model with no property values - deleteDatabaseCatalogOptionsModelNew := new(watsonxdatav2.DeleteDatabaseCatalogOptions) + deleteDatabaseCatalogOptionsModelNew := new(watsonxdatav3.DeleteDatabaseCatalogOptions) // Invoke operation with invalid model (negative test) response, operationErr = watsonxDataService.DeleteDatabaseCatalog(deleteDatabaseCatalogOptionsModelNew) Expect(operationErr).ToNot(BeNil()) @@ -3912,7 +4162,7 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) Describe(`UpdateDatabase(updateDatabaseOptions *UpdateDatabaseOptions) - Operation response error`, func() { - updateDatabasePath := "/database_registrations/testString" + updateDatabasePath := "/v3/database_registrations/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { @@ -3929,38 +4179,62 @@ var _ = Describe(`WatsonxDataV2`, func() { })) }) It(`Invoke UpdateDatabase with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) + // Construct an instance of the DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems model + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems) + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Key = core.StringPtr("abc") + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") + // Construct an instance of the DatabaseRegistrationPatchDatabaseDetails model - databaseRegistrationPatchDatabaseDetailsModel := new(watsonxdatav2.DatabaseRegistrationPatchDatabaseDetails) + databaseRegistrationPatchDatabaseDetailsModel := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetails) + databaseRegistrationPatchDatabaseDetailsModel.AuthenticationValue = core.StringPtr("LDAP") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") + databaseRegistrationPatchDatabaseDetailsModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") databaseRegistrationPatchDatabaseDetailsModel.Password = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.Properties = []watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems{*databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel} databaseRegistrationPatchDatabaseDetailsModel.Username = core.StringPtr("sampleuser") + // Construct an instance of the DatabaseRegistrationPatchTablesItems model + databaseRegistrationPatchTablesItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchTablesItems) + databaseRegistrationPatchTablesItemsModel.CreatedAt = core.StringPtr("1686792721") + databaseRegistrationPatchTablesItemsModel.FileContents = core.StringPtr("sample file content") + databaseRegistrationPatchTablesItemsModel.FileName = core.StringPtr("test.json") + databaseRegistrationPatchTablesItemsModel.SchemaName = core.StringPtr("customer") + databaseRegistrationPatchTablesItemsModel.TableName = core.StringPtr("customer") + // Construct an instance of the DatabaseRegistrationPatchTopicsItems model - databaseRegistrationPatchTopicsItemsModel := new(watsonxdatav2.DatabaseRegistrationPatchTopicsItems) - databaseRegistrationPatchTopicsItemsModel.CreatedOn = core.StringPtr("1686792721") + databaseRegistrationPatchTopicsItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchTopicsItems) + databaseRegistrationPatchTopicsItemsModel.CreatedAt = core.StringPtr("1686792721") databaseRegistrationPatchTopicsItemsModel.FileContents = core.StringPtr("sample file contents") - databaseRegistrationPatchTopicsItemsModel.FileName = core.StringPtr("sample file name") + databaseRegistrationPatchTopicsItemsModel.FileName = core.StringPtr("test.json") databaseRegistrationPatchTopicsItemsModel.TopicName = core.StringPtr("customer") // Construct an instance of the DatabaseRegistrationPatch model - databaseRegistrationPatchModel := new(watsonxdatav2.DatabaseRegistrationPatch) - databaseRegistrationPatchModel.DatabaseDetails = databaseRegistrationPatchDatabaseDetailsModel - databaseRegistrationPatchModel.DatabaseDisplayName = core.StringPtr("new_database") + databaseRegistrationPatchModel := new(watsonxdatav3.DatabaseRegistrationPatch) + databaseRegistrationPatchModel.Connection = databaseRegistrationPatchDatabaseDetailsModel databaseRegistrationPatchModel.Description = core.StringPtr("External database description") + databaseRegistrationPatchModel.DisplayName = core.StringPtr("new_database") + databaseRegistrationPatchModel.Tables = []watsonxdatav3.DatabaseRegistrationPatchTablesItems{*databaseRegistrationPatchTablesItemsModel} databaseRegistrationPatchModel.Tags = []string{"testdatabase", "userdatabase"} - databaseRegistrationPatchModel.Topics = []watsonxdatav2.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel} + databaseRegistrationPatchModel.Topics = []watsonxdatav3.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel} databaseRegistrationPatchModelAsPatch, asPatchErr := databaseRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) // Construct an instance of the UpdateDatabaseOptions model - updateDatabaseOptionsModel := new(watsonxdatav2.UpdateDatabaseOptions) - updateDatabaseOptionsModel.DatabaseID = core.StringPtr("testString") + updateDatabaseOptionsModel := new(watsonxdatav3.UpdateDatabaseOptions) + updateDatabaseOptionsModel.ID = core.StringPtr("testString") updateDatabaseOptionsModel.Body = databaseRegistrationPatchModelAsPatch updateDatabaseOptionsModel.AuthInstanceID = core.StringPtr("testString") updateDatabaseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -3983,7 +4257,7 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) Describe(`UpdateDatabase(updateDatabaseOptions *UpdateDatabaseOptions)`, func() { - updateDatabasePath := "/database_registrations/testString" + updateDatabasePath := "/v3/database_registrations/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { @@ -4017,11 +4291,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "created_by": "user1@bim.com", "created_on": "1686792721", "database_details": {"authentication_type": "LDAP", "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "certificate": "contents of a pem/crt file", "certificate_extension": "pem/crt", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "controller_authentication_user": "sampleuser", "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "database_name": "new_database", "hostname": "db2@.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "sasl": true, "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true}, "database_display_name": "new_database", "database_id": "new_database_id", "database_properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "database_type": "netezza", "description": "Description of the external database", "tags": ["Tags"], "topics": [{"created_on": "1686792721", "file_contents": "sample file content", "file_name": "sample file name", "topic_name": "customer"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "connection": {"authentication_type": "LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword", "authentication_value": "LDAP", "authentication_value_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "broker_host": "samplehost", "broker_port": 4553, "certificate": "exampleCertificate", "certificate_extension": "pem", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "password_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "controller_authentication_user": "sampleuser", "coordinator_host": "samplehost", "coordinator_port": 4553, "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "domain_name": "conops-mssql.conops.local", "hostname": "http://db2@localhost:9900.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "name": "new_database", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "sasl": true, "sasl_mechanism": "plain", "schema_name": "sampleSchema", "schemas": "redis__name", "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name, redis_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true, "sslcertificate_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true, "username_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "warehouse_name": "samplewrehouse"}, "created_at": "1686792721", "created_by": "user1@ibm.com", "description": "Description of the external database", "display_name": "new_database", "id": "mysql123", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "target_catalog_id": "cc85d899-9ec3-496a-be36-99cff9000116", "source_asset_id": "cc85d899-9ec3-496a-be36-99cabc62f123", "source_catalog_id": "cc85d899-9ec3-496a-be36-99cff962f000", "source_project_id": "cc85d899-9ec3-496a-be36-99cff9000116", "tables": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "test.json", "schema_name": "customer", "table_name": "customer"}], "tags": ["Tags"], "topics": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "employee.json", "topic_name": "customer"}], "type": "netezza", "vault_enabled": true}`) })) }) It(`Invoke UpdateDatabase successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -4029,31 +4303,55 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) + // Construct an instance of the DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems model + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems) + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Key = core.StringPtr("abc") + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") + // Construct an instance of the DatabaseRegistrationPatchDatabaseDetails model - databaseRegistrationPatchDatabaseDetailsModel := new(watsonxdatav2.DatabaseRegistrationPatchDatabaseDetails) + databaseRegistrationPatchDatabaseDetailsModel := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetails) + databaseRegistrationPatchDatabaseDetailsModel.AuthenticationValue = core.StringPtr("LDAP") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") + databaseRegistrationPatchDatabaseDetailsModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") databaseRegistrationPatchDatabaseDetailsModel.Password = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.Properties = []watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems{*databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel} databaseRegistrationPatchDatabaseDetailsModel.Username = core.StringPtr("sampleuser") + // Construct an instance of the DatabaseRegistrationPatchTablesItems model + databaseRegistrationPatchTablesItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchTablesItems) + databaseRegistrationPatchTablesItemsModel.CreatedAt = core.StringPtr("1686792721") + databaseRegistrationPatchTablesItemsModel.FileContents = core.StringPtr("sample file content") + databaseRegistrationPatchTablesItemsModel.FileName = core.StringPtr("test.json") + databaseRegistrationPatchTablesItemsModel.SchemaName = core.StringPtr("customer") + databaseRegistrationPatchTablesItemsModel.TableName = core.StringPtr("customer") + // Construct an instance of the DatabaseRegistrationPatchTopicsItems model - databaseRegistrationPatchTopicsItemsModel := new(watsonxdatav2.DatabaseRegistrationPatchTopicsItems) - databaseRegistrationPatchTopicsItemsModel.CreatedOn = core.StringPtr("1686792721") + databaseRegistrationPatchTopicsItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchTopicsItems) + databaseRegistrationPatchTopicsItemsModel.CreatedAt = core.StringPtr("1686792721") databaseRegistrationPatchTopicsItemsModel.FileContents = core.StringPtr("sample file contents") - databaseRegistrationPatchTopicsItemsModel.FileName = core.StringPtr("sample file name") + databaseRegistrationPatchTopicsItemsModel.FileName = core.StringPtr("test.json") databaseRegistrationPatchTopicsItemsModel.TopicName = core.StringPtr("customer") // Construct an instance of the DatabaseRegistrationPatch model - databaseRegistrationPatchModel := new(watsonxdatav2.DatabaseRegistrationPatch) - databaseRegistrationPatchModel.DatabaseDetails = databaseRegistrationPatchDatabaseDetailsModel - databaseRegistrationPatchModel.DatabaseDisplayName = core.StringPtr("new_database") + databaseRegistrationPatchModel := new(watsonxdatav3.DatabaseRegistrationPatch) + databaseRegistrationPatchModel.Connection = databaseRegistrationPatchDatabaseDetailsModel databaseRegistrationPatchModel.Description = core.StringPtr("External database description") + databaseRegistrationPatchModel.DisplayName = core.StringPtr("new_database") + databaseRegistrationPatchModel.Tables = []watsonxdatav3.DatabaseRegistrationPatchTablesItems{*databaseRegistrationPatchTablesItemsModel} databaseRegistrationPatchModel.Tags = []string{"testdatabase", "userdatabase"} - databaseRegistrationPatchModel.Topics = []watsonxdatav2.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel} + databaseRegistrationPatchModel.Topics = []watsonxdatav3.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel} databaseRegistrationPatchModelAsPatch, asPatchErr := databaseRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) // Construct an instance of the UpdateDatabaseOptions model - updateDatabaseOptionsModel := new(watsonxdatav2.UpdateDatabaseOptions) - updateDatabaseOptionsModel.DatabaseID = core.StringPtr("testString") + updateDatabaseOptionsModel := new(watsonxdatav3.UpdateDatabaseOptions) + updateDatabaseOptionsModel.ID = core.StringPtr("testString") updateDatabaseOptionsModel.Body = databaseRegistrationPatchModelAsPatch updateDatabaseOptionsModel.AuthInstanceID = core.StringPtr("testString") updateDatabaseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -4113,11 +4411,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "created_by": "user1@bim.com", "created_on": "1686792721", "database_details": {"authentication_type": "LDAP", "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "certificate": "contents of a pem/crt file", "certificate_extension": "pem/crt", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "controller_authentication_user": "sampleuser", "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "database_name": "new_database", "hostname": "db2@.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "sasl": true, "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true}, "database_display_name": "new_database", "database_id": "new_database_id", "database_properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "database_type": "netezza", "description": "Description of the external database", "tags": ["Tags"], "topics": [{"created_on": "1686792721", "file_contents": "sample file content", "file_name": "sample file name", "topic_name": "customer"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalog": {"catalog_name": "sampleCatalog", "catalog_tags": ["CatalogTags"], "catalog_type": "iceberg"}, "catalog_name": "sampleCatalog", "connection": {"authentication_type": "LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword", "authentication_value": "LDAP", "authentication_value_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "broker_authentication_password": "samplepassword", "broker_authentication_type": "PASSWORD", "broker_authentication_user": "sampleuser", "broker_host": "samplehost", "broker_port": 4553, "certificate": "exampleCertificate", "certificate_extension": "pem", "connection_method": "basic, apikey", "connection_mode": "service_name", "connection_mode_value": "orclpdb", "connection_type": "JDBC, Arrow flight", "controller_authentication_password": "samplepassword", "controller_authentication_type": "PASSWORD", "password_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "controller_authentication_user": "sampleuser", "coordinator_host": "samplehost", "coordinator_port": 4553, "cpd_hostname": "samplecpdhostname", "credentials_key": "eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......", "domain_name": "conops-mssql.conops.local", "hostname": "http://db2@localhost:9900.com", "hostname_in_certificate": "samplehostname", "hosts": "abc.com:1234,xyz.com:4321", "informix_server": "ol_informix1410", "name": "new_database", "password": "samplepassword", "port": 4553, "project_id": "conops-bigquery", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "sasl": true, "sasl_mechanism": "plain", "schema_name": "sampleSchema", "schemas": "redis__name", "service_api_key": "sampleapikey", "service_hostname": "api.dataplatform.dev.cloud.ibm.com", "service_password": "samplepassword", "service_port": 443, "service_ssl": true, "service_token_url": "sampletoakenurl", "service_username": "sampleusername", "ssl": true, "tables": "kafka_table_name, redis_table_name", "username": "sampleuser", "validate_server_certificate": true, "verify_host_name": true, "sslcertificate_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "vault_enabled": true, "username_key_vault": {"key": "secret key", "secret_name": "secret name", "secret_urn": "secret urn"}, "warehouse_name": "samplewrehouse"}, "created_at": "1686792721", "created_by": "user1@ibm.com", "description": "Description of the external database", "display_name": "new_database", "id": "mysql123", "properties": [{"encrypt": true, "key": "hive.metastore", "value": "glue"}], "target_catalog_id": "cc85d899-9ec3-496a-be36-99cff9000116", "source_asset_id": "cc85d899-9ec3-496a-be36-99cabc62f123", "source_catalog_id": "cc85d899-9ec3-496a-be36-99cff962f000", "source_project_id": "cc85d899-9ec3-496a-be36-99cff9000116", "tables": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "test.json", "schema_name": "customer", "table_name": "customer"}], "tags": ["Tags"], "topics": [{"created_at": "1686792721", "file_contents": "sample file content", "file_name": "employee.json", "topic_name": "customer"}], "type": "netezza", "vault_enabled": true}`) })) }) It(`Invoke UpdateDatabase successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -4130,31 +4428,55 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct an instance of the DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems model + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems) + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Key = core.StringPtr("abc") + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") + // Construct an instance of the DatabaseRegistrationPatchDatabaseDetails model - databaseRegistrationPatchDatabaseDetailsModel := new(watsonxdatav2.DatabaseRegistrationPatchDatabaseDetails) + databaseRegistrationPatchDatabaseDetailsModel := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetails) + databaseRegistrationPatchDatabaseDetailsModel.AuthenticationValue = core.StringPtr("LDAP") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") + databaseRegistrationPatchDatabaseDetailsModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") databaseRegistrationPatchDatabaseDetailsModel.Password = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.Properties = []watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems{*databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel} databaseRegistrationPatchDatabaseDetailsModel.Username = core.StringPtr("sampleuser") + // Construct an instance of the DatabaseRegistrationPatchTablesItems model + databaseRegistrationPatchTablesItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchTablesItems) + databaseRegistrationPatchTablesItemsModel.CreatedAt = core.StringPtr("1686792721") + databaseRegistrationPatchTablesItemsModel.FileContents = core.StringPtr("sample file content") + databaseRegistrationPatchTablesItemsModel.FileName = core.StringPtr("test.json") + databaseRegistrationPatchTablesItemsModel.SchemaName = core.StringPtr("customer") + databaseRegistrationPatchTablesItemsModel.TableName = core.StringPtr("customer") + // Construct an instance of the DatabaseRegistrationPatchTopicsItems model - databaseRegistrationPatchTopicsItemsModel := new(watsonxdatav2.DatabaseRegistrationPatchTopicsItems) - databaseRegistrationPatchTopicsItemsModel.CreatedOn = core.StringPtr("1686792721") + databaseRegistrationPatchTopicsItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchTopicsItems) + databaseRegistrationPatchTopicsItemsModel.CreatedAt = core.StringPtr("1686792721") databaseRegistrationPatchTopicsItemsModel.FileContents = core.StringPtr("sample file contents") - databaseRegistrationPatchTopicsItemsModel.FileName = core.StringPtr("sample file name") + databaseRegistrationPatchTopicsItemsModel.FileName = core.StringPtr("test.json") databaseRegistrationPatchTopicsItemsModel.TopicName = core.StringPtr("customer") // Construct an instance of the DatabaseRegistrationPatch model - databaseRegistrationPatchModel := new(watsonxdatav2.DatabaseRegistrationPatch) - databaseRegistrationPatchModel.DatabaseDetails = databaseRegistrationPatchDatabaseDetailsModel - databaseRegistrationPatchModel.DatabaseDisplayName = core.StringPtr("new_database") + databaseRegistrationPatchModel := new(watsonxdatav3.DatabaseRegistrationPatch) + databaseRegistrationPatchModel.Connection = databaseRegistrationPatchDatabaseDetailsModel databaseRegistrationPatchModel.Description = core.StringPtr("External database description") + databaseRegistrationPatchModel.DisplayName = core.StringPtr("new_database") + databaseRegistrationPatchModel.Tables = []watsonxdatav3.DatabaseRegistrationPatchTablesItems{*databaseRegistrationPatchTablesItemsModel} databaseRegistrationPatchModel.Tags = []string{"testdatabase", "userdatabase"} - databaseRegistrationPatchModel.Topics = []watsonxdatav2.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel} + databaseRegistrationPatchModel.Topics = []watsonxdatav3.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel} databaseRegistrationPatchModelAsPatch, asPatchErr := databaseRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) // Construct an instance of the UpdateDatabaseOptions model - updateDatabaseOptionsModel := new(watsonxdatav2.UpdateDatabaseOptions) - updateDatabaseOptionsModel.DatabaseID = core.StringPtr("testString") + updateDatabaseOptionsModel := new(watsonxdatav3.UpdateDatabaseOptions) + updateDatabaseOptionsModel.ID = core.StringPtr("testString") updateDatabaseOptionsModel.Body = databaseRegistrationPatchModelAsPatch updateDatabaseOptionsModel.AuthInstanceID = core.StringPtr("testString") updateDatabaseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -4167,38 +4489,62 @@ var _ = Describe(`WatsonxDataV2`, func() { }) It(`Invoke UpdateDatabase with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) + // Construct an instance of the DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems model + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems) + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Key = core.StringPtr("abc") + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") + // Construct an instance of the DatabaseRegistrationPatchDatabaseDetails model - databaseRegistrationPatchDatabaseDetailsModel := new(watsonxdatav2.DatabaseRegistrationPatchDatabaseDetails) + databaseRegistrationPatchDatabaseDetailsModel := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetails) + databaseRegistrationPatchDatabaseDetailsModel.AuthenticationValue = core.StringPtr("LDAP") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") + databaseRegistrationPatchDatabaseDetailsModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") databaseRegistrationPatchDatabaseDetailsModel.Password = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.Properties = []watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems{*databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel} databaseRegistrationPatchDatabaseDetailsModel.Username = core.StringPtr("sampleuser") + // Construct an instance of the DatabaseRegistrationPatchTablesItems model + databaseRegistrationPatchTablesItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchTablesItems) + databaseRegistrationPatchTablesItemsModel.CreatedAt = core.StringPtr("1686792721") + databaseRegistrationPatchTablesItemsModel.FileContents = core.StringPtr("sample file content") + databaseRegistrationPatchTablesItemsModel.FileName = core.StringPtr("test.json") + databaseRegistrationPatchTablesItemsModel.SchemaName = core.StringPtr("customer") + databaseRegistrationPatchTablesItemsModel.TableName = core.StringPtr("customer") + // Construct an instance of the DatabaseRegistrationPatchTopicsItems model - databaseRegistrationPatchTopicsItemsModel := new(watsonxdatav2.DatabaseRegistrationPatchTopicsItems) - databaseRegistrationPatchTopicsItemsModel.CreatedOn = core.StringPtr("1686792721") + databaseRegistrationPatchTopicsItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchTopicsItems) + databaseRegistrationPatchTopicsItemsModel.CreatedAt = core.StringPtr("1686792721") databaseRegistrationPatchTopicsItemsModel.FileContents = core.StringPtr("sample file contents") - databaseRegistrationPatchTopicsItemsModel.FileName = core.StringPtr("sample file name") + databaseRegistrationPatchTopicsItemsModel.FileName = core.StringPtr("test.json") databaseRegistrationPatchTopicsItemsModel.TopicName = core.StringPtr("customer") // Construct an instance of the DatabaseRegistrationPatch model - databaseRegistrationPatchModel := new(watsonxdatav2.DatabaseRegistrationPatch) - databaseRegistrationPatchModel.DatabaseDetails = databaseRegistrationPatchDatabaseDetailsModel - databaseRegistrationPatchModel.DatabaseDisplayName = core.StringPtr("new_database") + databaseRegistrationPatchModel := new(watsonxdatav3.DatabaseRegistrationPatch) + databaseRegistrationPatchModel.Connection = databaseRegistrationPatchDatabaseDetailsModel databaseRegistrationPatchModel.Description = core.StringPtr("External database description") + databaseRegistrationPatchModel.DisplayName = core.StringPtr("new_database") + databaseRegistrationPatchModel.Tables = []watsonxdatav3.DatabaseRegistrationPatchTablesItems{*databaseRegistrationPatchTablesItemsModel} databaseRegistrationPatchModel.Tags = []string{"testdatabase", "userdatabase"} - databaseRegistrationPatchModel.Topics = []watsonxdatav2.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel} + databaseRegistrationPatchModel.Topics = []watsonxdatav3.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel} databaseRegistrationPatchModelAsPatch, asPatchErr := databaseRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) // Construct an instance of the UpdateDatabaseOptions model - updateDatabaseOptionsModel := new(watsonxdatav2.UpdateDatabaseOptions) - updateDatabaseOptionsModel.DatabaseID = core.StringPtr("testString") + updateDatabaseOptionsModel := new(watsonxdatav3.UpdateDatabaseOptions) + updateDatabaseOptionsModel.ID = core.StringPtr("testString") updateDatabaseOptionsModel.Body = databaseRegistrationPatchModelAsPatch updateDatabaseOptionsModel.AuthInstanceID = core.StringPtr("testString") updateDatabaseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -4211,7 +4557,7 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(response).To(BeNil()) Expect(result).To(BeNil()) // Construct a second instance of the UpdateDatabaseOptions model with no property values - updateDatabaseOptionsModelNew := new(watsonxdatav2.UpdateDatabaseOptions) + updateDatabaseOptionsModelNew := new(watsonxdatav3.UpdateDatabaseOptions) // Invoke operation with invalid model (negative test) result, response, operationErr = watsonxDataService.UpdateDatabase(updateDatabaseOptionsModelNew) Expect(operationErr).ToNot(BeNil()) @@ -4232,38 +4578,62 @@ var _ = Describe(`WatsonxDataV2`, func() { })) }) It(`Invoke UpdateDatabase successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) + // Construct an instance of the DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems model + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems) + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Key = core.StringPtr("abc") + databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel.Value = core.StringPtr("xyz") + // Construct an instance of the DatabaseRegistrationPatchDatabaseDetails model - databaseRegistrationPatchDatabaseDetailsModel := new(watsonxdatav2.DatabaseRegistrationPatchDatabaseDetails) + databaseRegistrationPatchDatabaseDetailsModel := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetails) + databaseRegistrationPatchDatabaseDetailsModel.AuthenticationValue = core.StringPtr("LDAP") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") + databaseRegistrationPatchDatabaseDetailsModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") + databaseRegistrationPatchDatabaseDetailsModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") + databaseRegistrationPatchDatabaseDetailsModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") databaseRegistrationPatchDatabaseDetailsModel.Password = core.StringPtr("samplepassword") + databaseRegistrationPatchDatabaseDetailsModel.Properties = []watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems{*databaseRegistrationPatchDatabaseDetailsDatabasePropertiesItemsModel} databaseRegistrationPatchDatabaseDetailsModel.Username = core.StringPtr("sampleuser") + // Construct an instance of the DatabaseRegistrationPatchTablesItems model + databaseRegistrationPatchTablesItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchTablesItems) + databaseRegistrationPatchTablesItemsModel.CreatedAt = core.StringPtr("1686792721") + databaseRegistrationPatchTablesItemsModel.FileContents = core.StringPtr("sample file content") + databaseRegistrationPatchTablesItemsModel.FileName = core.StringPtr("test.json") + databaseRegistrationPatchTablesItemsModel.SchemaName = core.StringPtr("customer") + databaseRegistrationPatchTablesItemsModel.TableName = core.StringPtr("customer") + // Construct an instance of the DatabaseRegistrationPatchTopicsItems model - databaseRegistrationPatchTopicsItemsModel := new(watsonxdatav2.DatabaseRegistrationPatchTopicsItems) - databaseRegistrationPatchTopicsItemsModel.CreatedOn = core.StringPtr("1686792721") + databaseRegistrationPatchTopicsItemsModel := new(watsonxdatav3.DatabaseRegistrationPatchTopicsItems) + databaseRegistrationPatchTopicsItemsModel.CreatedAt = core.StringPtr("1686792721") databaseRegistrationPatchTopicsItemsModel.FileContents = core.StringPtr("sample file contents") - databaseRegistrationPatchTopicsItemsModel.FileName = core.StringPtr("sample file name") + databaseRegistrationPatchTopicsItemsModel.FileName = core.StringPtr("test.json") databaseRegistrationPatchTopicsItemsModel.TopicName = core.StringPtr("customer") // Construct an instance of the DatabaseRegistrationPatch model - databaseRegistrationPatchModel := new(watsonxdatav2.DatabaseRegistrationPatch) - databaseRegistrationPatchModel.DatabaseDetails = databaseRegistrationPatchDatabaseDetailsModel - databaseRegistrationPatchModel.DatabaseDisplayName = core.StringPtr("new_database") + databaseRegistrationPatchModel := new(watsonxdatav3.DatabaseRegistrationPatch) + databaseRegistrationPatchModel.Connection = databaseRegistrationPatchDatabaseDetailsModel databaseRegistrationPatchModel.Description = core.StringPtr("External database description") + databaseRegistrationPatchModel.DisplayName = core.StringPtr("new_database") + databaseRegistrationPatchModel.Tables = []watsonxdatav3.DatabaseRegistrationPatchTablesItems{*databaseRegistrationPatchTablesItemsModel} databaseRegistrationPatchModel.Tags = []string{"testdatabase", "userdatabase"} - databaseRegistrationPatchModel.Topics = []watsonxdatav2.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel} + databaseRegistrationPatchModel.Topics = []watsonxdatav3.DatabaseRegistrationPatchTopicsItems{*databaseRegistrationPatchTopicsItemsModel} databaseRegistrationPatchModelAsPatch, asPatchErr := databaseRegistrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) // Construct an instance of the UpdateDatabaseOptions model - updateDatabaseOptionsModel := new(watsonxdatav2.UpdateDatabaseOptions) - updateDatabaseOptionsModel.DatabaseID = core.StringPtr("testString") + updateDatabaseOptionsModel := new(watsonxdatav3.UpdateDatabaseOptions) + updateDatabaseOptionsModel.ID = core.StringPtr("testString") updateDatabaseOptionsModel.Body = databaseRegistrationPatchModelAsPatch updateDatabaseOptionsModel.AuthInstanceID = core.StringPtr("testString") updateDatabaseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} @@ -4281,15 +4651,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListDriverRegistration(listDriverRegistrationOptions *ListDriverRegistrationOptions) - Operation response error`, func() { - listDriverRegistrationPath := "/driver_registrations" + Describe(`ListPrestoEngines(listPrestoEnginesOptions *ListPrestoEnginesOptions) - Operation response error`, func() { + listPrestoEnginesPath := "/v3/presto_engines" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDriverRegistrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPrestoEnginesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -4298,27 +4668,27 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListDriverRegistration with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestoEngines with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListDriverRegistrationOptions model - listDriverRegistrationOptionsModel := new(watsonxdatav2.ListDriverRegistrationOptions) - listDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestoEnginesOptions model + listPrestoEnginesOptionsModel := new(watsonxdatav3.ListPrestoEnginesOptions) + listPrestoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListDriverRegistration(listDriverRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListDriverRegistration(listDriverRegistrationOptionsModel) + result, response, operationErr = watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -4328,15 +4698,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListDriverRegistration(listDriverRegistrationOptions *ListDriverRegistrationOptions)`, func() { - listDriverRegistrationPath := "/driver_registrations" + Describe(`ListPrestoEngines(listPrestoEnginesOptions *ListPrestoEnginesOptions)`, func() { + listPrestoEnginesPath := "/v3/presto_engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDriverRegistrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPrestoEnginesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -4347,11 +4717,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"driver_registrations": [{"associated_engines": ["AssociatedEngines"], "connection_type": "connection-type", "driver_id": "sample-driver-123", "driver_name": "sample-driver-name", "modified_at": "1686792721", "modified_by": "user1@bim.com", "status": "validating", "version": "123-dev"}]}`) + fmt.Fprintf(res, "%s", `{"presto_engines": [{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "starter", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "starter", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 1, "created_by": "username@domain.com", "description": "presto engine for running sql queries", "display_name": "sampleEngine", "drivers": [{"connection_type": "hana", "driver_id": "hanadriver123", "driver_name": "hanadriver-1.2.3", "driver_version": "1.2.3"}], "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "configuration_property_value"}, "worker": {"mapKey": "configuration_property_value"}}, "event_listener": {"mapKey": "event_listener_property_value"}, "global": {"mapKey": "global_property_value"}, "jmx_exporter_config": {"mapKey": "jmx_exporter_config_property_value"}, "jvm": {"coordinator": {"mapKey": "JVM_property_value"}, "worker": {"mapKey": "JVM_property_value"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "log_config_property_value"}}}, "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "configuration": {"coordinator": ["property_name"], "worker": ["property_name"]}, "event_listener": ["property_name"], "global": ["property_name"], "jmx_exporter_config": ["JmxExporterConfig"], "jvm": {"coordinator": ["property_name"], "worker": ["property_name"]}, "log_config": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "restart_type": "force", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "id": "presto123", "is_qhmm_engine": true, "origin": "native", "port": 1, "query_status": "completed", "resource_groups": [{"resource_group_file_name": "resource_group.json", "resource_group_id": "resourceGroup689"}], "size_config": "starter", "status": "running", "status_code": 1, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}]}`) })) }) - It(`Invoke ListDriverRegistration successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestoEngines successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -4359,21 +4729,21 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListDriverRegistrationOptions model - listDriverRegistrationOptionsModel := new(watsonxdatav2.ListDriverRegistrationOptions) - listDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestoEnginesOptions model + listPrestoEnginesOptionsModel := new(watsonxdatav3.ListPrestoEnginesOptions) + listPrestoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListDriverRegistrationWithContext(ctx, listDriverRegistrationOptionsModel) + _, _, operationErr := watsonxDataService.ListPrestoEnginesWithContext(ctx, listPrestoEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListDriverRegistration(listDriverRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -4381,7 +4751,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListDriverRegistrationWithContext(ctx, listDriverRegistrationOptionsModel) + _, _, operationErr = watsonxDataService.ListPrestoEnginesWithContext(ctx, listPrestoEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -4395,7 +4765,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDriverRegistrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPrestoEnginesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -4403,11 +4773,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"driver_registrations": [{"associated_engines": ["AssociatedEngines"], "connection_type": "connection-type", "driver_id": "sample-driver-123", "driver_name": "sample-driver-name", "modified_at": "1686792721", "modified_by": "user1@bim.com", "status": "validating", "version": "123-dev"}]}`) + fmt.Fprintf(res, "%s", `{"presto_engines": [{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "starter", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "starter", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 1, "created_by": "username@domain.com", "description": "presto engine for running sql queries", "display_name": "sampleEngine", "drivers": [{"connection_type": "hana", "driver_id": "hanadriver123", "driver_name": "hanadriver-1.2.3", "driver_version": "1.2.3"}], "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "configuration_property_value"}, "worker": {"mapKey": "configuration_property_value"}}, "event_listener": {"mapKey": "event_listener_property_value"}, "global": {"mapKey": "global_property_value"}, "jmx_exporter_config": {"mapKey": "jmx_exporter_config_property_value"}, "jvm": {"coordinator": {"mapKey": "JVM_property_value"}, "worker": {"mapKey": "JVM_property_value"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "log_config_property_value"}}}, "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "configuration": {"coordinator": ["property_name"], "worker": ["property_name"]}, "event_listener": ["property_name"], "global": ["property_name"], "jmx_exporter_config": ["JmxExporterConfig"], "jvm": {"coordinator": ["property_name"], "worker": ["property_name"]}, "log_config": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "restart_type": "force", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "id": "presto123", "is_qhmm_engine": true, "origin": "native", "port": 1, "query_status": "completed", "resource_groups": [{"resource_group_file_name": "resource_group.json", "resource_group_id": "resourceGroup689"}], "size_config": "starter", "status": "running", "status_code": 1, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}]}`) })) }) - It(`Invoke ListDriverRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestoEngines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -4415,39 +4785,39 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListDriverRegistration(nil) + result, response, operationErr := watsonxDataService.ListPrestoEngines(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListDriverRegistrationOptions model - listDriverRegistrationOptionsModel := new(watsonxdatav2.ListDriverRegistrationOptions) - listDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestoEnginesOptions model + listPrestoEnginesOptionsModel := new(watsonxdatav3.ListPrestoEnginesOptions) + listPrestoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListDriverRegistration(listDriverRegistrationOptionsModel) + result, response, operationErr = watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListDriverRegistration with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestoEngines with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListDriverRegistrationOptions model - listDriverRegistrationOptionsModel := new(watsonxdatav2.ListDriverRegistrationOptions) - listDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestoEnginesOptions model + listPrestoEnginesOptionsModel := new(watsonxdatav3.ListPrestoEnginesOptions) + listPrestoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListDriverRegistration(listDriverRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -4466,21 +4836,21 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListDriverRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestoEngines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListDriverRegistrationOptions model - listDriverRegistrationOptionsModel := new(watsonxdatav2.ListDriverRegistrationOptions) - listDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestoEnginesOptions model + listPrestoEnginesOptionsModel := new(watsonxdatav3.ListPrestoEnginesOptions) + listPrestoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListDriverRegistration(listDriverRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -4492,15 +4862,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateDriverRegistration(createDriverRegistrationOptions *CreateDriverRegistrationOptions) - Operation response error`, func() { - createDriverRegistrationPath := "/driver_registrations" + Describe(`CreatePrestoEngine(createPrestoEngineOptions *CreatePrestoEngineOptions) - Operation response error`, func() { + createPrestoEnginePath := "/v3/presto_engines" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDriverRegistrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(createPrestoEnginePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -4509,32 +4879,62 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateDriverRegistration with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateDriverRegistrationOptions model - createDriverRegistrationOptionsModel := new(watsonxdatav2.CreateDriverRegistrationOptions) - createDriverRegistrationOptionsModel.Driver = CreateMockReader("This is a mock file.") - createDriverRegistrationOptionsModel.DriverName = core.StringPtr("testString") - createDriverRegistrationOptionsModel.ConnectionType = core.StringPtr("testString") - createDriverRegistrationOptionsModel.DriverContentType = core.StringPtr("testString") - createDriverRegistrationOptionsModel.Version = core.StringPtr("testString") - createDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CoordinatorNodeDescriptionBody model + coordinatorNodeDescriptionBodyModel := new(watsonxdatav3.CoordinatorNodeDescriptionBody) + coordinatorNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + coordinatorNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the WorkerNodeDescriptionBody model + workerNodeDescriptionBodyModel := new(watsonxdatav3.WorkerNodeDescriptionBody) + workerNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + workerNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the AutoscalingConfig model + autoscalingConfigModel := new(watsonxdatav3.AutoscalingConfig) + autoscalingConfigModel.Type = core.StringPtr("cpu") + autoscalingConfigModel.Target = core.Int64Ptr(int64(40)) + autoscalingConfigModel.MinWorkerQuantity = core.Int64Ptr(int64(1)) + autoscalingConfigModel.MaxWorkerQuantity = core.Int64Ptr(int64(18)) + autoscalingConfigModel.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + autoscalingConfigModel.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + autoscalingConfigModel.ScalingStepSize = core.Int64Ptr(int64(1)) + + // Construct an instance of the EngineDetails model + engineDetailsModel := new(watsonxdatav3.EngineDetails) + engineDetailsModel.Coordinator = coordinatorNodeDescriptionBodyModel + engineDetailsModel.SizeConfig = core.StringPtr("starter") + engineDetailsModel.Worker = workerNodeDescriptionBodyModel + engineDetailsModel.AutoscalingEnabled = core.BoolPtr(true) + engineDetailsModel.AutoscalingConfig = autoscalingConfigModel + + // Construct an instance of the CreatePrestoEngineOptions model + createPrestoEngineOptionsModel := new(watsonxdatav3.CreatePrestoEngineOptions) + createPrestoEngineOptionsModel.Configuration = engineDetailsModel + createPrestoEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createPrestoEngineOptionsModel.Origin = core.StringPtr("native") + createPrestoEngineOptionsModel.AssociatedCatalogs = []string{"iceberg_data", "hive_data"} + createPrestoEngineOptionsModel.Description = core.StringPtr("presto engine for running sql queries") + createPrestoEngineOptionsModel.ID = core.StringPtr("presto123") + createPrestoEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateDriverRegistration(createDriverRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateDriverRegistration(createDriverRegistrationOptionsModel) + result, response, operationErr = watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -4544,17 +4944,33 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateDriverRegistration(createDriverRegistrationOptions *CreateDriverRegistrationOptions)`, func() { - createDriverRegistrationPath := "/driver_registrations" + Describe(`CreatePrestoEngine(createPrestoEngineOptions *CreatePrestoEngineOptions)`, func() { + createPrestoEnginePath := "/v3/presto_engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDriverRegistrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(createPrestoEnginePath)) Expect(req.Method).To(Equal("POST")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Sleep a short time to support a timeout test @@ -4563,11 +4979,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"associated_engines": ["AssociatedEngines"], "connection_type": "connection-type", "driver_id": "sample-driver-123", "driver_name": "sample-driver-name", "modified_at": "1686792721", "modified_by": "user1@bim.com", "status": "validating", "version": "123-dev"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "starter", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "starter", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 1, "created_by": "username@domain.com", "description": "presto engine for running sql queries", "display_name": "sampleEngine", "drivers": [{"connection_type": "hana", "driver_id": "hanadriver123", "driver_name": "hanadriver-1.2.3", "driver_version": "1.2.3"}], "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "configuration_property_value"}, "worker": {"mapKey": "configuration_property_value"}}, "event_listener": {"mapKey": "event_listener_property_value"}, "global": {"mapKey": "global_property_value"}, "jmx_exporter_config": {"mapKey": "jmx_exporter_config_property_value"}, "jvm": {"coordinator": {"mapKey": "JVM_property_value"}, "worker": {"mapKey": "JVM_property_value"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "log_config_property_value"}}}, "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "configuration": {"coordinator": ["property_name"], "worker": ["property_name"]}, "event_listener": ["property_name"], "global": ["property_name"], "jmx_exporter_config": ["JmxExporterConfig"], "jvm": {"coordinator": ["property_name"], "worker": ["property_name"]}, "log_config": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "restart_type": "force", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "id": "presto123", "is_qhmm_engine": true, "origin": "native", "port": 1, "query_status": "completed", "resource_groups": [{"resource_group_file_name": "resource_group.json", "resource_group_id": "resourceGroup689"}], "size_config": "starter", "status": "running", "status_code": 1, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}`) })) }) - It(`Invoke CreateDriverRegistration successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -4575,26 +4991,56 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateDriverRegistrationOptions model - createDriverRegistrationOptionsModel := new(watsonxdatav2.CreateDriverRegistrationOptions) - createDriverRegistrationOptionsModel.Driver = CreateMockReader("This is a mock file.") - createDriverRegistrationOptionsModel.DriverName = core.StringPtr("testString") - createDriverRegistrationOptionsModel.ConnectionType = core.StringPtr("testString") - createDriverRegistrationOptionsModel.DriverContentType = core.StringPtr("testString") - createDriverRegistrationOptionsModel.Version = core.StringPtr("testString") - createDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CoordinatorNodeDescriptionBody model + coordinatorNodeDescriptionBodyModel := new(watsonxdatav3.CoordinatorNodeDescriptionBody) + coordinatorNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + coordinatorNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the WorkerNodeDescriptionBody model + workerNodeDescriptionBodyModel := new(watsonxdatav3.WorkerNodeDescriptionBody) + workerNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + workerNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the AutoscalingConfig model + autoscalingConfigModel := new(watsonxdatav3.AutoscalingConfig) + autoscalingConfigModel.Type = core.StringPtr("cpu") + autoscalingConfigModel.Target = core.Int64Ptr(int64(40)) + autoscalingConfigModel.MinWorkerQuantity = core.Int64Ptr(int64(1)) + autoscalingConfigModel.MaxWorkerQuantity = core.Int64Ptr(int64(18)) + autoscalingConfigModel.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + autoscalingConfigModel.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + autoscalingConfigModel.ScalingStepSize = core.Int64Ptr(int64(1)) + + // Construct an instance of the EngineDetails model + engineDetailsModel := new(watsonxdatav3.EngineDetails) + engineDetailsModel.Coordinator = coordinatorNodeDescriptionBodyModel + engineDetailsModel.SizeConfig = core.StringPtr("starter") + engineDetailsModel.Worker = workerNodeDescriptionBodyModel + engineDetailsModel.AutoscalingEnabled = core.BoolPtr(true) + engineDetailsModel.AutoscalingConfig = autoscalingConfigModel + + // Construct an instance of the CreatePrestoEngineOptions model + createPrestoEngineOptionsModel := new(watsonxdatav3.CreatePrestoEngineOptions) + createPrestoEngineOptionsModel.Configuration = engineDetailsModel + createPrestoEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createPrestoEngineOptionsModel.Origin = core.StringPtr("native") + createPrestoEngineOptionsModel.AssociatedCatalogs = []string{"iceberg_data", "hive_data"} + createPrestoEngineOptionsModel.Description = core.StringPtr("presto engine for running sql queries") + createPrestoEngineOptionsModel.ID = core.StringPtr("presto123") + createPrestoEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateDriverRegistrationWithContext(ctx, createDriverRegistrationOptionsModel) + _, _, operationErr := watsonxDataService.CreatePrestoEngineWithContext(ctx, createPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateDriverRegistration(createDriverRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -4602,7 +5048,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateDriverRegistrationWithContext(ctx, createDriverRegistrationOptionsModel) + _, _, operationErr = watsonxDataService.CreatePrestoEngineWithContext(ctx, createPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -4616,19 +5062,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDriverRegistrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(createPrestoEnginePath)) Expect(req.Method).To(Equal("POST")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"associated_engines": ["AssociatedEngines"], "connection_type": "connection-type", "driver_id": "sample-driver-123", "driver_name": "sample-driver-name", "modified_at": "1686792721", "modified_by": "user1@bim.com", "status": "validating", "version": "123-dev"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "starter", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "starter", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 1, "created_by": "username@domain.com", "description": "presto engine for running sql queries", "display_name": "sampleEngine", "drivers": [{"connection_type": "hana", "driver_id": "hanadriver123", "driver_name": "hanadriver-1.2.3", "driver_version": "1.2.3"}], "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "configuration_property_value"}, "worker": {"mapKey": "configuration_property_value"}}, "event_listener": {"mapKey": "event_listener_property_value"}, "global": {"mapKey": "global_property_value"}, "jmx_exporter_config": {"mapKey": "jmx_exporter_config_property_value"}, "jvm": {"coordinator": {"mapKey": "JVM_property_value"}, "worker": {"mapKey": "JVM_property_value"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "log_config_property_value"}}}, "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "configuration": {"coordinator": ["property_name"], "worker": ["property_name"]}, "event_listener": ["property_name"], "global": ["property_name"], "jmx_exporter_config": ["JmxExporterConfig"], "jvm": {"coordinator": ["property_name"], "worker": ["property_name"]}, "log_config": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "restart_type": "force", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "id": "presto123", "is_qhmm_engine": true, "origin": "native", "port": 1, "query_status": "completed", "resource_groups": [{"resource_group_file_name": "resource_group.json", "resource_group_id": "resourceGroup689"}], "size_config": "starter", "status": "running", "status_code": 1, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}`) })) }) - It(`Invoke CreateDriverRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -4636,57 +5098,117 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateDriverRegistration(nil) + result, response, operationErr := watsonxDataService.CreatePrestoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateDriverRegistrationOptions model - createDriverRegistrationOptionsModel := new(watsonxdatav2.CreateDriverRegistrationOptions) - createDriverRegistrationOptionsModel.Driver = CreateMockReader("This is a mock file.") - createDriverRegistrationOptionsModel.DriverName = core.StringPtr("testString") - createDriverRegistrationOptionsModel.ConnectionType = core.StringPtr("testString") - createDriverRegistrationOptionsModel.DriverContentType = core.StringPtr("testString") - createDriverRegistrationOptionsModel.Version = core.StringPtr("testString") - createDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CoordinatorNodeDescriptionBody model + coordinatorNodeDescriptionBodyModel := new(watsonxdatav3.CoordinatorNodeDescriptionBody) + coordinatorNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + coordinatorNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the WorkerNodeDescriptionBody model + workerNodeDescriptionBodyModel := new(watsonxdatav3.WorkerNodeDescriptionBody) + workerNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + workerNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the AutoscalingConfig model + autoscalingConfigModel := new(watsonxdatav3.AutoscalingConfig) + autoscalingConfigModel.Type = core.StringPtr("cpu") + autoscalingConfigModel.Target = core.Int64Ptr(int64(40)) + autoscalingConfigModel.MinWorkerQuantity = core.Int64Ptr(int64(1)) + autoscalingConfigModel.MaxWorkerQuantity = core.Int64Ptr(int64(18)) + autoscalingConfigModel.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + autoscalingConfigModel.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + autoscalingConfigModel.ScalingStepSize = core.Int64Ptr(int64(1)) + + // Construct an instance of the EngineDetails model + engineDetailsModel := new(watsonxdatav3.EngineDetails) + engineDetailsModel.Coordinator = coordinatorNodeDescriptionBodyModel + engineDetailsModel.SizeConfig = core.StringPtr("starter") + engineDetailsModel.Worker = workerNodeDescriptionBodyModel + engineDetailsModel.AutoscalingEnabled = core.BoolPtr(true) + engineDetailsModel.AutoscalingConfig = autoscalingConfigModel + + // Construct an instance of the CreatePrestoEngineOptions model + createPrestoEngineOptionsModel := new(watsonxdatav3.CreatePrestoEngineOptions) + createPrestoEngineOptionsModel.Configuration = engineDetailsModel + createPrestoEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createPrestoEngineOptionsModel.Origin = core.StringPtr("native") + createPrestoEngineOptionsModel.AssociatedCatalogs = []string{"iceberg_data", "hive_data"} + createPrestoEngineOptionsModel.Description = core.StringPtr("presto engine for running sql queries") + createPrestoEngineOptionsModel.ID = core.StringPtr("presto123") + createPrestoEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateDriverRegistration(createDriverRegistrationOptionsModel) + result, response, operationErr = watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateDriverRegistration with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateDriverRegistrationOptions model - createDriverRegistrationOptionsModel := new(watsonxdatav2.CreateDriverRegistrationOptions) - createDriverRegistrationOptionsModel.Driver = CreateMockReader("This is a mock file.") - createDriverRegistrationOptionsModel.DriverName = core.StringPtr("testString") - createDriverRegistrationOptionsModel.ConnectionType = core.StringPtr("testString") - createDriverRegistrationOptionsModel.DriverContentType = core.StringPtr("testString") - createDriverRegistrationOptionsModel.Version = core.StringPtr("testString") - createDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CoordinatorNodeDescriptionBody model + coordinatorNodeDescriptionBodyModel := new(watsonxdatav3.CoordinatorNodeDescriptionBody) + coordinatorNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + coordinatorNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the WorkerNodeDescriptionBody model + workerNodeDescriptionBodyModel := new(watsonxdatav3.WorkerNodeDescriptionBody) + workerNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + workerNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the AutoscalingConfig model + autoscalingConfigModel := new(watsonxdatav3.AutoscalingConfig) + autoscalingConfigModel.Type = core.StringPtr("cpu") + autoscalingConfigModel.Target = core.Int64Ptr(int64(40)) + autoscalingConfigModel.MinWorkerQuantity = core.Int64Ptr(int64(1)) + autoscalingConfigModel.MaxWorkerQuantity = core.Int64Ptr(int64(18)) + autoscalingConfigModel.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + autoscalingConfigModel.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + autoscalingConfigModel.ScalingStepSize = core.Int64Ptr(int64(1)) + + // Construct an instance of the EngineDetails model + engineDetailsModel := new(watsonxdatav3.EngineDetails) + engineDetailsModel.Coordinator = coordinatorNodeDescriptionBodyModel + engineDetailsModel.SizeConfig = core.StringPtr("starter") + engineDetailsModel.Worker = workerNodeDescriptionBodyModel + engineDetailsModel.AutoscalingEnabled = core.BoolPtr(true) + engineDetailsModel.AutoscalingConfig = autoscalingConfigModel + + // Construct an instance of the CreatePrestoEngineOptions model + createPrestoEngineOptionsModel := new(watsonxdatav3.CreatePrestoEngineOptions) + createPrestoEngineOptionsModel.Configuration = engineDetailsModel + createPrestoEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createPrestoEngineOptionsModel.Origin = core.StringPtr("native") + createPrestoEngineOptionsModel.AssociatedCatalogs = []string{"iceberg_data", "hive_data"} + createPrestoEngineOptionsModel.Description = core.StringPtr("presto engine for running sql queries") + createPrestoEngineOptionsModel.ID = core.StringPtr("presto123") + createPrestoEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateDriverRegistration(createDriverRegistrationOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateDriverRegistrationOptions model with no property values - createDriverRegistrationOptionsModelNew := new(watsonxdatav2.CreateDriverRegistrationOptions) + // Construct a second instance of the CreatePrestoEngineOptions model with no property values + createPrestoEngineOptionsModelNew := new(watsonxdatav3.CreatePrestoEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateDriverRegistration(createDriverRegistrationOptionsModelNew) + result, response, operationErr = watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -4704,193 +5226,76 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateDriverRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the CreateDriverRegistrationOptions model - createDriverRegistrationOptionsModel := new(watsonxdatav2.CreateDriverRegistrationOptions) - createDriverRegistrationOptionsModel.Driver = CreateMockReader("This is a mock file.") - createDriverRegistrationOptionsModel.DriverName = core.StringPtr("testString") - createDriverRegistrationOptionsModel.ConnectionType = core.StringPtr("testString") - createDriverRegistrationOptionsModel.DriverContentType = core.StringPtr("testString") - createDriverRegistrationOptionsModel.Version = core.StringPtr("testString") - createDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := watsonxDataService.CreateDriverRegistration(createDriverRegistrationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteDriverRegistration(deleteDriverRegistrationOptions *DeleteDriverRegistrationOptions)`, func() { - deleteDriverRegistrationPath := "/driver_registrations/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteDriverRegistrationPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteDriverRegistration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteDriverRegistration(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteDriverRegistrationOptions model - deleteDriverRegistrationOptionsModel := new(watsonxdatav2.DeleteDriverRegistrationOptions) - deleteDriverRegistrationOptionsModel.DriverID = core.StringPtr("testString") - deleteDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteDriverRegistration(deleteDriverRegistrationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteDriverRegistration with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DeleteDriverRegistrationOptions model - deleteDriverRegistrationOptionsModel := new(watsonxdatav2.DeleteDriverRegistrationOptions) - deleteDriverRegistrationOptionsModel.DriverID = core.StringPtr("testString") - deleteDriverRegistrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteDriverRegistrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteDriverRegistration(deleteDriverRegistrationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteDriverRegistrationOptions model with no property values - deleteDriverRegistrationOptionsModelNew := new(watsonxdatav2.DeleteDriverRegistrationOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteDriverRegistration(deleteDriverRegistrationOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`DeleteDriverEngines(deleteDriverEnginesOptions *DeleteDriverEnginesOptions)`, func() { - deleteDriverEnginesPath := "/driver_registrations/testString/engines" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + // Construct an instance of the CoordinatorNodeDescriptionBody model + coordinatorNodeDescriptionBodyModel := new(watsonxdatav3.CoordinatorNodeDescriptionBody) + coordinatorNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + coordinatorNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteDriverEnginesPath)) - Expect(req.Method).To(Equal("DELETE")) + // Construct an instance of the WorkerNodeDescriptionBody model + workerNodeDescriptionBodyModel := new(watsonxdatav3.WorkerNodeDescriptionBody) + workerNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + workerNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_ids"]).To(Equal([]string{"testString"})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteDriverEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) + // Construct an instance of the AutoscalingConfig model + autoscalingConfigModel := new(watsonxdatav3.AutoscalingConfig) + autoscalingConfigModel.Type = core.StringPtr("cpu") + autoscalingConfigModel.Target = core.Int64Ptr(int64(40)) + autoscalingConfigModel.MinWorkerQuantity = core.Int64Ptr(int64(1)) + autoscalingConfigModel.MaxWorkerQuantity = core.Int64Ptr(int64(18)) + autoscalingConfigModel.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + autoscalingConfigModel.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + autoscalingConfigModel.ScalingStepSize = core.Int64Ptr(int64(1)) - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteDriverEngines(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + // Construct an instance of the EngineDetails model + engineDetailsModel := new(watsonxdatav3.EngineDetails) + engineDetailsModel.Coordinator = coordinatorNodeDescriptionBodyModel + engineDetailsModel.SizeConfig = core.StringPtr("starter") + engineDetailsModel.Worker = workerNodeDescriptionBodyModel + engineDetailsModel.AutoscalingEnabled = core.BoolPtr(true) + engineDetailsModel.AutoscalingConfig = autoscalingConfigModel - // Construct an instance of the DeleteDriverEnginesOptions model - deleteDriverEnginesOptionsModel := new(watsonxdatav2.DeleteDriverEnginesOptions) - deleteDriverEnginesOptionsModel.DriverID = core.StringPtr("testString") - deleteDriverEnginesOptionsModel.EngineIds = core.StringPtr("testString") - deleteDriverEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteDriverEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreatePrestoEngineOptions model + createPrestoEngineOptionsModel := new(watsonxdatav3.CreatePrestoEngineOptions) + createPrestoEngineOptionsModel.Configuration = engineDetailsModel + createPrestoEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createPrestoEngineOptionsModel.Origin = core.StringPtr("native") + createPrestoEngineOptionsModel.AssociatedCatalogs = []string{"iceberg_data", "hive_data"} + createPrestoEngineOptionsModel.Description = core.StringPtr("presto engine for running sql queries") + createPrestoEngineOptionsModel.ID = core.StringPtr("presto123") + createPrestoEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteDriverEngines(deleteDriverEnginesOptionsModel) + // Invoke operation + result, response, operationErr := watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteDriverEngines with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DeleteDriverEnginesOptions model - deleteDriverEnginesOptionsModel := new(watsonxdatav2.DeleteDriverEnginesOptions) - deleteDriverEnginesOptionsModel.DriverID = core.StringPtr("testString") - deleteDriverEnginesOptionsModel.EngineIds = core.StringPtr("testString") - deleteDriverEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteDriverEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteDriverEngines(deleteDriverEnginesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteDriverEnginesOptions model with no property values - deleteDriverEnginesOptionsModelNew := new(watsonxdatav2.DeleteDriverEnginesOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteDriverEngines(deleteDriverEnginesOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`UpdateDriverEngines(updateDriverEnginesOptions *UpdateDriverEnginesOptions) - Operation response error`, func() { - updateDriverEnginesPath := "/driver_registrations/testString/engines" + Describe(`UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptions *UpdatePrestoEngineAutoscalingOptions) - Operation response error`, func() { + updatePrestoEngineAutoscalingPath := "/v3/presto_engines/testString/autoscaling" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDriverEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(updatePrestoEngineAutoscalingPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -4899,35 +5304,44 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateDriverEngines with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestoEngineAutoscaling with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DriverRegistrationEnginePrototype model - driverRegistrationEnginePrototypeModel := new(watsonxdatav2.DriverRegistrationEnginePrototype) - driverRegistrationEnginePrototypeModel.Engines = []string{"testString"} - driverRegistrationEnginePrototypeModelAsPatch, asPatchErr := driverRegistrationEnginePrototypeModel.AsPatch() + // Construct an instance of the AutoScalingConfig model + autoScalingConfigModel := new(watsonxdatav3.AutoScalingConfig) + autoScalingConfigModel.Target = core.Int64Ptr(int64(40)) + autoScalingConfigModel.MinWorkerQuantity = core.Int64Ptr(int64(1)) + autoScalingConfigModel.MaxWorkerQuantity = core.Int64Ptr(int64(1)) + autoScalingConfigModel.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + autoScalingConfigModel.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + autoScalingConfigModel.ScalingStepSize = core.Int64Ptr(int64(1)) + + // Construct an instance of the UpdateAutoScalingRequest model + updateAutoScalingRequestModel := new(watsonxdatav3.UpdateAutoScalingRequest) + updateAutoScalingRequestModel.AutoscalingConfig = autoScalingConfigModel + updateAutoScalingRequestModelAsPatch, asPatchErr := updateAutoScalingRequestModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateDriverEnginesOptions model - updateDriverEnginesOptionsModel := new(watsonxdatav2.UpdateDriverEnginesOptions) - updateDriverEnginesOptionsModel.DriverID = core.StringPtr("testString") - updateDriverEnginesOptionsModel.Body = driverRegistrationEnginePrototypeModelAsPatch - updateDriverEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateDriverEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePrestoEngineAutoscalingOptions model + updatePrestoEngineAutoscalingOptionsModel := new(watsonxdatav3.UpdatePrestoEngineAutoscalingOptions) + updatePrestoEngineAutoscalingOptionsModel.EngineID = core.StringPtr("testString") + updatePrestoEngineAutoscalingOptionsModel.UpdateAutoScalingRequestPatch = updateAutoScalingRequestModelAsPatch + updatePrestoEngineAutoscalingOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestoEngineAutoscalingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateDriverEngines(updateDriverEnginesOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateDriverEngines(updateDriverEnginesOptionsModel) + result, response, operationErr = watsonxDataService.UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -4937,15 +5351,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateDriverEngines(updateDriverEnginesOptions *UpdateDriverEnginesOptions)`, func() { - updateDriverEnginesPath := "/driver_registrations/testString/engines" + Describe(`UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptions *UpdatePrestoEngineAutoscalingOptions)`, func() { + updatePrestoEngineAutoscalingPath := "/v3/presto_engines/testString/autoscaling" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDriverEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(updatePrestoEngineAutoscalingPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -4972,11 +5386,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"engines": ["Engines"]}`) + fmt.Fprintf(res, "%s", `{"autoscaling_enabled": true, "autoscaling_config": {"target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}`) })) }) - It(`Invoke UpdateDriverEngines successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestoEngineAutoscaling successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -4984,29 +5398,38 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the DriverRegistrationEnginePrototype model - driverRegistrationEnginePrototypeModel := new(watsonxdatav2.DriverRegistrationEnginePrototype) - driverRegistrationEnginePrototypeModel.Engines = []string{"testString"} - driverRegistrationEnginePrototypeModelAsPatch, asPatchErr := driverRegistrationEnginePrototypeModel.AsPatch() + // Construct an instance of the AutoScalingConfig model + autoScalingConfigModel := new(watsonxdatav3.AutoScalingConfig) + autoScalingConfigModel.Target = core.Int64Ptr(int64(40)) + autoScalingConfigModel.MinWorkerQuantity = core.Int64Ptr(int64(1)) + autoScalingConfigModel.MaxWorkerQuantity = core.Int64Ptr(int64(1)) + autoScalingConfigModel.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + autoScalingConfigModel.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + autoScalingConfigModel.ScalingStepSize = core.Int64Ptr(int64(1)) + + // Construct an instance of the UpdateAutoScalingRequest model + updateAutoScalingRequestModel := new(watsonxdatav3.UpdateAutoScalingRequest) + updateAutoScalingRequestModel.AutoscalingConfig = autoScalingConfigModel + updateAutoScalingRequestModelAsPatch, asPatchErr := updateAutoScalingRequestModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateDriverEnginesOptions model - updateDriverEnginesOptionsModel := new(watsonxdatav2.UpdateDriverEnginesOptions) - updateDriverEnginesOptionsModel.DriverID = core.StringPtr("testString") - updateDriverEnginesOptionsModel.Body = driverRegistrationEnginePrototypeModelAsPatch - updateDriverEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateDriverEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePrestoEngineAutoscalingOptions model + updatePrestoEngineAutoscalingOptionsModel := new(watsonxdatav3.UpdatePrestoEngineAutoscalingOptions) + updatePrestoEngineAutoscalingOptionsModel.EngineID = core.StringPtr("testString") + updatePrestoEngineAutoscalingOptionsModel.UpdateAutoScalingRequestPatch = updateAutoScalingRequestModelAsPatch + updatePrestoEngineAutoscalingOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestoEngineAutoscalingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateDriverEnginesWithContext(ctx, updateDriverEnginesOptionsModel) + _, _, operationErr := watsonxDataService.UpdatePrestoEngineAutoscalingWithContext(ctx, updatePrestoEngineAutoscalingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateDriverEngines(updateDriverEnginesOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -5014,7 +5437,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateDriverEnginesWithContext(ctx, updateDriverEnginesOptionsModel) + _, _, operationErr = watsonxDataService.UpdatePrestoEngineAutoscalingWithContext(ctx, updatePrestoEngineAutoscalingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -5028,7 +5451,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDriverEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(updatePrestoEngineAutoscalingPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -5052,11 +5475,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"engines": ["Engines"]}`) + fmt.Fprintf(res, "%s", `{"autoscaling_enabled": true, "autoscaling_config": {"target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}`) })) }) - It(`Invoke UpdateDriverEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestoEngineAutoscaling successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -5064,63 +5487,81 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateDriverEngines(nil) + result, response, operationErr := watsonxDataService.UpdatePrestoEngineAutoscaling(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the DriverRegistrationEnginePrototype model - driverRegistrationEnginePrototypeModel := new(watsonxdatav2.DriverRegistrationEnginePrototype) - driverRegistrationEnginePrototypeModel.Engines = []string{"testString"} - driverRegistrationEnginePrototypeModelAsPatch, asPatchErr := driverRegistrationEnginePrototypeModel.AsPatch() + // Construct an instance of the AutoScalingConfig model + autoScalingConfigModel := new(watsonxdatav3.AutoScalingConfig) + autoScalingConfigModel.Target = core.Int64Ptr(int64(40)) + autoScalingConfigModel.MinWorkerQuantity = core.Int64Ptr(int64(1)) + autoScalingConfigModel.MaxWorkerQuantity = core.Int64Ptr(int64(1)) + autoScalingConfigModel.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + autoScalingConfigModel.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + autoScalingConfigModel.ScalingStepSize = core.Int64Ptr(int64(1)) + + // Construct an instance of the UpdateAutoScalingRequest model + updateAutoScalingRequestModel := new(watsonxdatav3.UpdateAutoScalingRequest) + updateAutoScalingRequestModel.AutoscalingConfig = autoScalingConfigModel + updateAutoScalingRequestModelAsPatch, asPatchErr := updateAutoScalingRequestModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateDriverEnginesOptions model - updateDriverEnginesOptionsModel := new(watsonxdatav2.UpdateDriverEnginesOptions) - updateDriverEnginesOptionsModel.DriverID = core.StringPtr("testString") - updateDriverEnginesOptionsModel.Body = driverRegistrationEnginePrototypeModelAsPatch - updateDriverEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateDriverEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePrestoEngineAutoscalingOptions model + updatePrestoEngineAutoscalingOptionsModel := new(watsonxdatav3.UpdatePrestoEngineAutoscalingOptions) + updatePrestoEngineAutoscalingOptionsModel.EngineID = core.StringPtr("testString") + updatePrestoEngineAutoscalingOptionsModel.UpdateAutoScalingRequestPatch = updateAutoScalingRequestModelAsPatch + updatePrestoEngineAutoscalingOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestoEngineAutoscalingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateDriverEngines(updateDriverEnginesOptionsModel) + result, response, operationErr = watsonxDataService.UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateDriverEngines with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestoEngineAutoscaling with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DriverRegistrationEnginePrototype model - driverRegistrationEnginePrototypeModel := new(watsonxdatav2.DriverRegistrationEnginePrototype) - driverRegistrationEnginePrototypeModel.Engines = []string{"testString"} - driverRegistrationEnginePrototypeModelAsPatch, asPatchErr := driverRegistrationEnginePrototypeModel.AsPatch() + // Construct an instance of the AutoScalingConfig model + autoScalingConfigModel := new(watsonxdatav3.AutoScalingConfig) + autoScalingConfigModel.Target = core.Int64Ptr(int64(40)) + autoScalingConfigModel.MinWorkerQuantity = core.Int64Ptr(int64(1)) + autoScalingConfigModel.MaxWorkerQuantity = core.Int64Ptr(int64(1)) + autoScalingConfigModel.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + autoScalingConfigModel.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + autoScalingConfigModel.ScalingStepSize = core.Int64Ptr(int64(1)) + + // Construct an instance of the UpdateAutoScalingRequest model + updateAutoScalingRequestModel := new(watsonxdatav3.UpdateAutoScalingRequest) + updateAutoScalingRequestModel.AutoscalingConfig = autoScalingConfigModel + updateAutoScalingRequestModelAsPatch, asPatchErr := updateAutoScalingRequestModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateDriverEnginesOptions model - updateDriverEnginesOptionsModel := new(watsonxdatav2.UpdateDriverEnginesOptions) - updateDriverEnginesOptionsModel.DriverID = core.StringPtr("testString") - updateDriverEnginesOptionsModel.Body = driverRegistrationEnginePrototypeModelAsPatch - updateDriverEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateDriverEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePrestoEngineAutoscalingOptions model + updatePrestoEngineAutoscalingOptionsModel := new(watsonxdatav3.UpdatePrestoEngineAutoscalingOptions) + updatePrestoEngineAutoscalingOptionsModel.EngineID = core.StringPtr("testString") + updatePrestoEngineAutoscalingOptionsModel.UpdateAutoScalingRequestPatch = updateAutoScalingRequestModelAsPatch + updatePrestoEngineAutoscalingOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestoEngineAutoscalingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateDriverEngines(updateDriverEnginesOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateDriverEnginesOptions model with no property values - updateDriverEnginesOptionsModelNew := new(watsonxdatav2.UpdateDriverEnginesOptions) + // Construct a second instance of the UpdatePrestoEngineAutoscalingOptions model with no property values + updatePrestoEngineAutoscalingOptionsModelNew := new(watsonxdatav3.UpdatePrestoEngineAutoscalingOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateDriverEngines(updateDriverEnginesOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -5138,29 +5579,38 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateDriverEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestoEngineAutoscaling successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DriverRegistrationEnginePrototype model - driverRegistrationEnginePrototypeModel := new(watsonxdatav2.DriverRegistrationEnginePrototype) - driverRegistrationEnginePrototypeModel.Engines = []string{"testString"} - driverRegistrationEnginePrototypeModelAsPatch, asPatchErr := driverRegistrationEnginePrototypeModel.AsPatch() + // Construct an instance of the AutoScalingConfig model + autoScalingConfigModel := new(watsonxdatav3.AutoScalingConfig) + autoScalingConfigModel.Target = core.Int64Ptr(int64(40)) + autoScalingConfigModel.MinWorkerQuantity = core.Int64Ptr(int64(1)) + autoScalingConfigModel.MaxWorkerQuantity = core.Int64Ptr(int64(1)) + autoScalingConfigModel.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + autoScalingConfigModel.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + autoScalingConfigModel.ScalingStepSize = core.Int64Ptr(int64(1)) + + // Construct an instance of the UpdateAutoScalingRequest model + updateAutoScalingRequestModel := new(watsonxdatav3.UpdateAutoScalingRequest) + updateAutoScalingRequestModel.AutoscalingConfig = autoScalingConfigModel + updateAutoScalingRequestModelAsPatch, asPatchErr := updateAutoScalingRequestModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateDriverEnginesOptions model - updateDriverEnginesOptionsModel := new(watsonxdatav2.UpdateDriverEnginesOptions) - updateDriverEnginesOptionsModel.DriverID = core.StringPtr("testString") - updateDriverEnginesOptionsModel.Body = driverRegistrationEnginePrototypeModelAsPatch - updateDriverEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateDriverEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePrestoEngineAutoscalingOptions model + updatePrestoEngineAutoscalingOptionsModel := new(watsonxdatav3.UpdatePrestoEngineAutoscalingOptions) + updatePrestoEngineAutoscalingOptionsModel.EngineID = core.StringPtr("testString") + updatePrestoEngineAutoscalingOptionsModel.UpdateAutoScalingRequestPatch = updateAutoScalingRequestModelAsPatch + updatePrestoEngineAutoscalingOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestoEngineAutoscalingOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdateDriverEngines(updateDriverEnginesOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestoEngineAutoscaling(updatePrestoEngineAutoscalingOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -5172,15 +5622,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListOtherEngines(listOtherEnginesOptions *ListOtherEnginesOptions) - Operation response error`, func() { - listOtherEnginesPath := "/other_engines" + Describe(`ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptions *ListPrestoEngineCatalogsOptions) - Operation response error`, func() { + listPrestoEngineCatalogsPath := "/v3/presto_engines/testString/catalogs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listOtherEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPrestoEngineCatalogsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -5189,27 +5639,28 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListOtherEngines with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestoEngineCatalogs with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListOtherEnginesOptions model - listOtherEnginesOptionsModel := new(watsonxdatav2.ListOtherEnginesOptions) - listOtherEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listOtherEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestoEngineCatalogsOptions model + listPrestoEngineCatalogsOptionsModel := new(watsonxdatav3.ListPrestoEngineCatalogsOptions) + listPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + listPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) + result, response, operationErr = watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -5219,15 +5670,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListOtherEngines(listOtherEnginesOptions *ListOtherEnginesOptions)`, func() { - listOtherEnginesPath := "/other_engines" + Describe(`ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptions *ListPrestoEngineCatalogsOptions)`, func() { + listPrestoEngineCatalogsPath := "/v3/presto_engines/testString/catalogs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listOtherEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPrestoEngineCatalogsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -5238,11 +5689,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"other_engines": [{"actions": ["Actions"], "created_by": "@.com", "created_on": 9, "description": "engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "engine_type": "netezza", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-netezza-01-netezza-svc", "origin": "ibm", "port": 4, "status": "registered", "tags": ["Tags"], "type": "external"}]}`) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke ListOtherEngines successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestoEngineCatalogs successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -5250,21 +5701,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListOtherEnginesOptions model - listOtherEnginesOptionsModel := new(watsonxdatav2.ListOtherEnginesOptions) - listOtherEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listOtherEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestoEngineCatalogsOptions model + listPrestoEngineCatalogsOptionsModel := new(watsonxdatav3.ListPrestoEngineCatalogsOptions) + listPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + listPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListOtherEnginesWithContext(ctx, listOtherEnginesOptionsModel) + _, _, operationErr := watsonxDataService.ListPrestoEngineCatalogsWithContext(ctx, listPrestoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -5272,7 +5724,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListOtherEnginesWithContext(ctx, listOtherEnginesOptionsModel) + _, _, operationErr = watsonxDataService.ListPrestoEngineCatalogsWithContext(ctx, listPrestoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -5286,7 +5738,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listOtherEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPrestoEngineCatalogsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -5294,11 +5746,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"other_engines": [{"actions": ["Actions"], "created_by": "@.com", "created_on": 9, "description": "engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "engine_type": "netezza", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-netezza-01-netezza-svc", "origin": "ibm", "port": 4, "status": "registered", "tags": ["Tags"], "type": "external"}]}`) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke ListOtherEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestoEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -5306,43 +5758,52 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListOtherEngines(nil) + result, response, operationErr := watsonxDataService.ListPrestoEngineCatalogs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListOtherEnginesOptions model - listOtherEnginesOptionsModel := new(watsonxdatav2.ListOtherEnginesOptions) - listOtherEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listOtherEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestoEngineCatalogsOptions model + listPrestoEngineCatalogsOptionsModel := new(watsonxdatav3.ListPrestoEngineCatalogsOptions) + listPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + listPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) + result, response, operationErr = watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListOtherEngines with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestoEngineCatalogs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListOtherEnginesOptions model - listOtherEnginesOptionsModel := new(watsonxdatav2.ListOtherEnginesOptions) - listOtherEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listOtherEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestoEngineCatalogsOptions model + listPrestoEngineCatalogsOptionsModel := new(watsonxdatav3.ListPrestoEngineCatalogsOptions) + listPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + listPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the ListPrestoEngineCatalogsOptions model with no property values + listPrestoEngineCatalogsOptionsModelNew := new(watsonxdatav3.ListPrestoEngineCatalogsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -5357,21 +5818,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListOtherEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestoEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListOtherEnginesOptions model - listOtherEnginesOptionsModel := new(watsonxdatav2.ListOtherEnginesOptions) - listOtherEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listOtherEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestoEngineCatalogsOptions model + listPrestoEngineCatalogsOptionsModel := new(watsonxdatav3.ListPrestoEngineCatalogsOptions) + listPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + listPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -5383,15 +5845,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateOtherEngine(createOtherEngineOptions *CreateOtherEngineOptions) - Operation response error`, func() { - createOtherEnginePath := "/other_engines" + Describe(`CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptions *CreatePrestoEngineCatalogsOptions) - Operation response error`, func() { + createPrestoEngineCatalogsPath := "/v3/presto_engines/testString/catalogs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createOtherEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createPrestoEngineCatalogsPath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -5400,37 +5862,29 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateOtherEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestoEngineCatalogs with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the OtherEngineDetailsBody model - otherEngineDetailsBodyModel := new(watsonxdatav2.OtherEngineDetailsBody) - otherEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - otherEngineDetailsBodyModel.EngineType = core.StringPtr("netezza") - - // Construct an instance of the CreateOtherEngineOptions model - createOtherEngineOptionsModel := new(watsonxdatav2.CreateOtherEngineOptions) - createOtherEngineOptionsModel.EngineDetails = otherEngineDetailsBodyModel - createOtherEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine01") - createOtherEngineOptionsModel.Description = core.StringPtr("external engine description") - createOtherEngineOptionsModel.Origin = core.StringPtr("external") - createOtherEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreatePrestoEngineCatalogsOptions model + createPrestoEngineCatalogsOptionsModel := new(watsonxdatav3.CreatePrestoEngineCatalogsOptions) + createPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + createPrestoEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -5440,15 +5894,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateOtherEngine(createOtherEngineOptions *CreateOtherEngineOptions)`, func() { - createOtherEnginePath := "/other_engines" + Describe(`CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptions *CreatePrestoEngineCatalogsOptions)`, func() { + createPrestoEngineCatalogsPath := "/v3/presto_engines/testString/catalogs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createOtherEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createPrestoEngineCatalogsPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -5475,11 +5929,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "created_by": "@.com", "created_on": 9, "description": "engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "engine_type": "netezza", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-netezza-01-netezza-svc", "origin": "ibm", "port": 4, "status": "registered", "tags": ["Tags"], "type": "external"}`) + fmt.Fprintf(res, "%s", `{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}`) })) }) - It(`Invoke CreateOtherEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestoEngineCatalogs successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -5487,31 +5941,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the OtherEngineDetailsBody model - otherEngineDetailsBodyModel := new(watsonxdatav2.OtherEngineDetailsBody) - otherEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - otherEngineDetailsBodyModel.EngineType = core.StringPtr("netezza") - - // Construct an instance of the CreateOtherEngineOptions model - createOtherEngineOptionsModel := new(watsonxdatav2.CreateOtherEngineOptions) - createOtherEngineOptionsModel.EngineDetails = otherEngineDetailsBodyModel - createOtherEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine01") - createOtherEngineOptionsModel.Description = core.StringPtr("external engine description") - createOtherEngineOptionsModel.Origin = core.StringPtr("external") - createOtherEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreatePrestoEngineCatalogsOptions model + createPrestoEngineCatalogsOptionsModel := new(watsonxdatav3.CreatePrestoEngineCatalogsOptions) + createPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + createPrestoEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateOtherEngineWithContext(ctx, createOtherEngineOptionsModel) + _, _, operationErr := watsonxDataService.CreatePrestoEngineCatalogsWithContext(ctx, createPrestoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -5519,7 +5965,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateOtherEngineWithContext(ctx, createOtherEngineOptionsModel) + _, _, operationErr = watsonxDataService.CreatePrestoEngineCatalogsWithContext(ctx, createPrestoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -5533,7 +5979,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createOtherEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createPrestoEngineCatalogsPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -5557,11 +6003,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "created_by": "@.com", "created_on": 9, "description": "engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "engine_type": "netezza", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-netezza-01-netezza-svc", "origin": "ibm", "port": 4, "status": "registered", "tags": ["Tags"], "type": "external"}`) + fmt.Fprintf(res, "%s", `{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}`) })) }) - It(`Invoke CreateOtherEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestoEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -5569,67 +6015,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateOtherEngine(nil) + result, response, operationErr := watsonxDataService.CreatePrestoEngineCatalogs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the OtherEngineDetailsBody model - otherEngineDetailsBodyModel := new(watsonxdatav2.OtherEngineDetailsBody) - otherEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - otherEngineDetailsBodyModel.EngineType = core.StringPtr("netezza") - - // Construct an instance of the CreateOtherEngineOptions model - createOtherEngineOptionsModel := new(watsonxdatav2.CreateOtherEngineOptions) - createOtherEngineOptionsModel.EngineDetails = otherEngineDetailsBodyModel - createOtherEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine01") - createOtherEngineOptionsModel.Description = core.StringPtr("external engine description") - createOtherEngineOptionsModel.Origin = core.StringPtr("external") - createOtherEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreatePrestoEngineCatalogsOptions model + createPrestoEngineCatalogsOptionsModel := new(watsonxdatav3.CreatePrestoEngineCatalogsOptions) + createPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + createPrestoEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateOtherEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestoEngineCatalogs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the OtherEngineDetailsBody model - otherEngineDetailsBodyModel := new(watsonxdatav2.OtherEngineDetailsBody) - otherEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - otherEngineDetailsBodyModel.EngineType = core.StringPtr("netezza") - - // Construct an instance of the CreateOtherEngineOptions model - createOtherEngineOptionsModel := new(watsonxdatav2.CreateOtherEngineOptions) - createOtherEngineOptionsModel.EngineDetails = otherEngineDetailsBodyModel - createOtherEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine01") - createOtherEngineOptionsModel.Description = core.StringPtr("external engine description") - createOtherEngineOptionsModel.Origin = core.StringPtr("external") - createOtherEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreatePrestoEngineCatalogsOptions model + createPrestoEngineCatalogsOptionsModel := new(watsonxdatav3.CreatePrestoEngineCatalogsOptions) + createPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + createPrestoEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateOtherEngineOptions model with no property values - createOtherEngineOptionsModelNew := new(watsonxdatav2.CreateOtherEngineOptions) + // Construct a second instance of the CreatePrestoEngineCatalogsOptions model with no property values + createPrestoEngineCatalogsOptionsModelNew := new(watsonxdatav3.CreatePrestoEngineCatalogsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -5647,31 +6077,23 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateOtherEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestoEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the OtherEngineDetailsBody model - otherEngineDetailsBodyModel := new(watsonxdatav2.OtherEngineDetailsBody) - otherEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - otherEngineDetailsBodyModel.EngineType = core.StringPtr("netezza") - - // Construct an instance of the CreateOtherEngineOptions model - createOtherEngineOptionsModel := new(watsonxdatav2.CreateOtherEngineOptions) - createOtherEngineOptionsModel.EngineDetails = otherEngineDetailsBodyModel - createOtherEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine01") - createOtherEngineOptionsModel.Description = core.StringPtr("external engine description") - createOtherEngineOptionsModel.Origin = core.StringPtr("external") - createOtherEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreatePrestoEngineCatalogsOptions model + createPrestoEngineCatalogsOptionsModel := new(watsonxdatav3.CreatePrestoEngineCatalogsOptions) + createPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + createPrestoEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -5683,24 +6105,25 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteOtherEngine(deleteOtherEngineOptions *DeleteOtherEngineOptions)`, func() { - deleteOtherEnginePath := "/other_engines/testString" + Describe(`DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptions *DeletePrestoEngineCatalogsOptions)`, func() { + deletePrestoEngineCatalogsPath := "/v3/presto_engines/testString/catalogs" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteOtherEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(deletePrestoEngineCatalogsPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["catalog_names"]).To(Equal([]string{"testString"})) res.WriteHeader(204) })) }) - It(`Invoke DeleteOtherEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeletePrestoEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -5708,45 +6131,47 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteOtherEngine(nil) + response, operationErr := watsonxDataService.DeletePrestoEngineCatalogs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteOtherEngineOptions model - deleteOtherEngineOptionsModel := new(watsonxdatav2.DeleteOtherEngineOptions) - deleteOtherEngineOptionsModel.EngineID = core.StringPtr("testString") - deleteOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeletePrestoEngineCatalogsOptions model + deletePrestoEngineCatalogsOptionsModel := new(watsonxdatav3.DeletePrestoEngineCatalogsOptions) + deletePrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + deletePrestoEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") + deletePrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + deletePrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteOtherEngine(deleteOtherEngineOptionsModel) + response, operationErr = watsonxDataService.DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteOtherEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeletePrestoEngineCatalogs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DeleteOtherEngineOptions model - deleteOtherEngineOptionsModel := new(watsonxdatav2.DeleteOtherEngineOptions) - deleteOtherEngineOptionsModel.EngineID = core.StringPtr("testString") - deleteOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeletePrestoEngineCatalogsOptions model + deletePrestoEngineCatalogsOptionsModel := new(watsonxdatav3.DeletePrestoEngineCatalogsOptions) + deletePrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") + deletePrestoEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") + deletePrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + deletePrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteOtherEngine(deleteOtherEngineOptionsModel) + response, operationErr := watsonxDataService.DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteOtherEngineOptions model with no property values - deleteOtherEngineOptionsModelNew := new(watsonxdatav2.DeleteOtherEngineOptions) + // Construct a second instance of the DeletePrestoEngineCatalogsOptions model with no property values + deletePrestoEngineCatalogsOptionsModelNew := new(watsonxdatav3.DeletePrestoEngineCatalogsOptions) // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteOtherEngine(deleteOtherEngineOptionsModelNew) + response, operationErr = watsonxDataService.DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -5755,50 +6180,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListAllIntegrations(listAllIntegrationsOptions *ListAllIntegrationsOptions) - Operation response error`, func() { - listAllIntegrationsPath := "/integrations" + Describe(`GetPrestoEngineCatalog(getPrestoEngineCatalogOptions *GetPrestoEngineCatalogOptions) - Operation response error`, func() { + getPrestoEngineCatalogPath := "/v3/presto_engines/testString/catalogs/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listAllIntegrationsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestoEngineCatalogPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.Header["Secret"]).ToNot(BeNil()) - Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["service_type"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListAllIntegrations with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngineCatalog with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListAllIntegrationsOptions model - listAllIntegrationsOptionsModel := new(watsonxdatav2.ListAllIntegrationsOptions) - listAllIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllIntegrationsOptionsModel.Secret = core.StringPtr("testString") - listAllIntegrationsOptionsModel.ServiceType = core.StringPtr("testString") - listAllIntegrationsOptionsModel.State = []string{"testString"} - listAllIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineCatalogOptions model + getPrestoEngineCatalogOptionsModel := new(watsonxdatav3.GetPrestoEngineCatalogOptions) + getPrestoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) + result, response, operationErr = watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -5808,33 +6229,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListAllIntegrations(listAllIntegrationsOptions *ListAllIntegrationsOptions)`, func() { - listAllIntegrationsPath := "/integrations" + Describe(`GetPrestoEngineCatalog(getPrestoEngineCatalogOptions *GetPrestoEngineCatalogOptions)`, func() { + getPrestoEngineCatalogPath := "/v3/presto_engines/testString/catalogs/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listAllIntegrationsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestoEngineCatalogPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.Header["Secret"]).ToNot(BeNil()) - Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["service_type"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"integrations": [{"apikey": "apikey", "access_token": "uiOO90kklop", "config_properties": "ikc-env.password=ibmlhenc__0001__uMkFATDDZNnxJ7z6BA/QqA==\nikc-env.url=ikc\nikc-enabled-catalogs=\nikc-username=\nlh-unique-identifier=1711796957622126\nlh-crn=1711796957622126", "auth_url": "https://iam.abc.com", "integration_id": "presto01", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "ikc_user_account_id": "abcdefghijklmnopqrstuvwxyz", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 10, "modified_by": "@.com", "password": "password", "resource": "presto01", "service_type": "ikc", "state": "active", "storage_catalogs": ["StorageCatalogs"], "url": "ikc.url", "zen_apikey": "zen_apikey", "username": "username@email.com"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}`) })) }) - It(`Invoke ListAllIntegrations successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngineCatalog successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -5842,24 +6260,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListAllIntegrationsOptions model - listAllIntegrationsOptionsModel := new(watsonxdatav2.ListAllIntegrationsOptions) - listAllIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllIntegrationsOptionsModel.Secret = core.StringPtr("testString") - listAllIntegrationsOptionsModel.ServiceType = core.StringPtr("testString") - listAllIntegrationsOptionsModel.State = []string{"testString"} - listAllIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineCatalogOptions model + getPrestoEngineCatalogOptionsModel := new(watsonxdatav3.GetPrestoEngineCatalogOptions) + getPrestoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListAllIntegrationsWithContext(ctx, listAllIntegrationsOptionsModel) + _, _, operationErr := watsonxDataService.GetPrestoEngineCatalogWithContext(ctx, getPrestoEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -5867,7 +6284,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListAllIntegrationsWithContext(ctx, listAllIntegrationsOptionsModel) + _, _, operationErr = watsonxDataService.GetPrestoEngineCatalogWithContext(ctx, getPrestoEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -5881,22 +6298,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listAllIntegrationsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestoEngineCatalogPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.Header["Secret"]).ToNot(BeNil()) - Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["service_type"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"integrations": [{"apikey": "apikey", "access_token": "uiOO90kklop", "config_properties": "ikc-env.password=ibmlhenc__0001__uMkFATDDZNnxJ7z6BA/QqA==\nikc-env.url=ikc\nikc-enabled-catalogs=\nikc-username=\nlh-unique-identifier=1711796957622126\nlh-crn=1711796957622126", "auth_url": "https://iam.abc.com", "integration_id": "presto01", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "ikc_user_account_id": "abcdefghijklmnopqrstuvwxyz", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 10, "modified_by": "@.com", "password": "password", "resource": "presto01", "service_type": "ikc", "state": "active", "storage_catalogs": ["StorageCatalogs"], "url": "ikc.url", "zen_apikey": "zen_apikey", "username": "username@email.com"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}`) })) }) - It(`Invoke ListAllIntegrations successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngineCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -5904,49 +6318,54 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListAllIntegrations(nil) + result, response, operationErr := watsonxDataService.GetPrestoEngineCatalog(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListAllIntegrationsOptions model - listAllIntegrationsOptionsModel := new(watsonxdatav2.ListAllIntegrationsOptions) - listAllIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllIntegrationsOptionsModel.Secret = core.StringPtr("testString") - listAllIntegrationsOptionsModel.ServiceType = core.StringPtr("testString") - listAllIntegrationsOptionsModel.State = []string{"testString"} - listAllIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineCatalogOptions model + getPrestoEngineCatalogOptionsModel := new(watsonxdatav3.GetPrestoEngineCatalogOptions) + getPrestoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) + result, response, operationErr = watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListAllIntegrations with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngineCatalog with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListAllIntegrationsOptions model - listAllIntegrationsOptionsModel := new(watsonxdatav2.ListAllIntegrationsOptions) - listAllIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllIntegrationsOptionsModel.Secret = core.StringPtr("testString") - listAllIntegrationsOptionsModel.ServiceType = core.StringPtr("testString") - listAllIntegrationsOptionsModel.State = []string{"testString"} - listAllIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineCatalogOptions model + getPrestoEngineCatalogOptionsModel := new(watsonxdatav3.GetPrestoEngineCatalogOptions) + getPrestoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the GetPrestoEngineCatalogOptions model with no property values + getPrestoEngineCatalogOptionsModelNew := new(watsonxdatav3.GetPrestoEngineCatalogOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -5961,24 +6380,23 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListAllIntegrations successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngineCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListAllIntegrationsOptions model - listAllIntegrationsOptionsModel := new(watsonxdatav2.ListAllIntegrationsOptions) - listAllIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllIntegrationsOptionsModel.Secret = core.StringPtr("testString") - listAllIntegrationsOptionsModel.ServiceType = core.StringPtr("testString") - listAllIntegrationsOptionsModel.State = []string{"testString"} - listAllIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineCatalogOptions model + getPrestoEngineCatalogOptionsModel := new(watsonxdatav3.GetPrestoEngineCatalogOptions) + getPrestoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -5990,55 +6408,47 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateIntegration(createIntegrationOptions *CreateIntegrationOptions) - Operation response error`, func() { - createIntegrationPath := "/integrations" + Describe(`GetPrestoEngineConfig(getPrestoEngineConfigOptions *GetPrestoEngineConfigOptions) - Operation response error`, func() { + getPrestoEngineConfigPath := "/v3/presto_engines/presto860/config" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createIntegrationPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getPrestoEngineConfigPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::"))) + Expect(req.URL.Query()["sections"]).To(Equal([]string{"catalog,configuration,jvm"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateIntegration with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngineConfig with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateIntegrationOptions model - createIntegrationOptionsModel := new(watsonxdatav2.CreateIntegrationOptions) - createIntegrationOptionsModel.AccessToken = core.StringPtr("testString") - createIntegrationOptionsModel.Apikey = core.StringPtr("testString") - createIntegrationOptionsModel.CrossAccountIntegration = core.BoolPtr(true) - createIntegrationOptionsModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) - createIntegrationOptionsModel.IkcUserAccountID = core.StringPtr("testString") - createIntegrationOptionsModel.Password = core.StringPtr("password") - createIntegrationOptionsModel.Resource = core.StringPtr("resource_name") - createIntegrationOptionsModel.ServiceType = core.StringPtr("ranger") - createIntegrationOptionsModel.StorageCatalogs = []string{"testString"} - createIntegrationOptionsModel.URL = core.StringPtr("http://abcd.efgh.com:9876/") - createIntegrationOptionsModel.Username = core.StringPtr("username") - createIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineConfigOptions model + getPrestoEngineConfigOptionsModel := new(watsonxdatav3.GetPrestoEngineConfigOptions) + getPrestoEngineConfigOptionsModel.EngineID = core.StringPtr("presto860") + getPrestoEngineConfigOptionsModel.AuthInstanceID = core.StringPtr("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::") + getPrestoEngineConfigOptionsModel.Sections = core.StringPtr("catalog,configuration,jvm") + getPrestoEngineConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateIntegration(createIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngineConfig(getPrestoEngineConfigOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateIntegration(createIntegrationOptionsModel) + result, response, operationErr = watsonxDataService.GetPrestoEngineConfig(getPrestoEngineConfigOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -6048,46 +6458,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateIntegration(createIntegrationOptions *CreateIntegrationOptions)`, func() { - createIntegrationPath := "/integrations" + Describe(`GetPrestoEngineConfig(getPrestoEngineConfigOptions *GetPrestoEngineConfigOptions)`, func() { + getPrestoEngineConfigPath := "/v3/presto_engines/presto860/config" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createIntegrationPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getPrestoEngineConfigPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::"))) + Expect(req.URL.Query()["sections"]).To(Equal([]string{"catalog,configuration,jvm"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"apikey": "apikey", "access_token": "uiOO90kklop", "config_properties": "ikc-env.password=ibmlhenc__0001__uMkFATDDZNnxJ7z6BA/QqA==\nikc-env.url=ikc\nikc-enabled-catalogs=\nikc-username=\nlh-unique-identifier=1711796957622126\nlh-crn=1711796957622126", "auth_url": "https://iam.abc.com", "integration_id": "presto01", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "ikc_user_account_id": "abcdefghijklmnopqrstuvwxyz", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 10, "modified_by": "@.com", "password": "password", "resource": "presto01", "service_type": "ikc", "state": "active", "storage_catalogs": ["StorageCatalogs"], "url": "ikc.url", "zen_apikey": "zen_apikey", "username": "username@email.com"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"engine_properties": {"catalog": {"mapKey": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"mapKey": "configuration_property_value"}, "worker": {"mapKey": "configuration_property_value"}}, "event_listener": {"mapKey": "event_listener_property_value"}, "global": {"mapKey": "global_property_value"}, "jmx_exporter_config": {"mapKey": "jmx_exporter_config_property_value"}, "jvm": {"coordinator": {"mapKey": "JVM_property_value"}, "worker": {"mapKey": "JVM_property_value"}}, "log_config": {"coordinator": {"mapKey": "log_config_property_value"}, "worker": {"mapKey": "log_config_property_value"}}}}`) })) }) - It(`Invoke CreateIntegration successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngineConfig successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -6095,32 +6490,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateIntegrationOptions model - createIntegrationOptionsModel := new(watsonxdatav2.CreateIntegrationOptions) - createIntegrationOptionsModel.AccessToken = core.StringPtr("testString") - createIntegrationOptionsModel.Apikey = core.StringPtr("testString") - createIntegrationOptionsModel.CrossAccountIntegration = core.BoolPtr(true) - createIntegrationOptionsModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) - createIntegrationOptionsModel.IkcUserAccountID = core.StringPtr("testString") - createIntegrationOptionsModel.Password = core.StringPtr("password") - createIntegrationOptionsModel.Resource = core.StringPtr("resource_name") - createIntegrationOptionsModel.ServiceType = core.StringPtr("ranger") - createIntegrationOptionsModel.StorageCatalogs = []string{"testString"} - createIntegrationOptionsModel.URL = core.StringPtr("http://abcd.efgh.com:9876/") - createIntegrationOptionsModel.Username = core.StringPtr("username") - createIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineConfigOptions model + getPrestoEngineConfigOptionsModel := new(watsonxdatav3.GetPrestoEngineConfigOptions) + getPrestoEngineConfigOptionsModel.EngineID = core.StringPtr("presto860") + getPrestoEngineConfigOptionsModel.AuthInstanceID = core.StringPtr("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::") + getPrestoEngineConfigOptionsModel.Sections = core.StringPtr("catalog,configuration,jvm") + getPrestoEngineConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateIntegrationWithContext(ctx, createIntegrationOptionsModel) + _, _, operationErr := watsonxDataService.GetPrestoEngineConfigWithContext(ctx, getPrestoEngineConfigOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateIntegration(createIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngineConfig(getPrestoEngineConfigOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -6128,7 +6514,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateIntegrationWithContext(ctx, createIntegrationOptionsModel) + _, _, operationErr = watsonxDataService.GetPrestoEngineConfigWithContext(ctx, getPrestoEngineConfigOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -6142,35 +6528,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createIntegrationPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getPrestoEngineConfigPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::"))) + Expect(req.URL.Query()["sections"]).To(Equal([]string{"catalog,configuration,jvm"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"apikey": "apikey", "access_token": "uiOO90kklop", "config_properties": "ikc-env.password=ibmlhenc__0001__uMkFATDDZNnxJ7z6BA/QqA==\nikc-env.url=ikc\nikc-enabled-catalogs=\nikc-username=\nlh-unique-identifier=1711796957622126\nlh-crn=1711796957622126", "auth_url": "https://iam.abc.com", "integration_id": "presto01", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "ikc_user_account_id": "abcdefghijklmnopqrstuvwxyz", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 10, "modified_by": "@.com", "password": "password", "resource": "presto01", "service_type": "ikc", "state": "active", "storage_catalogs": ["StorageCatalogs"], "url": "ikc.url", "zen_apikey": "zen_apikey", "username": "username@email.com"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"engine_properties": {"catalog": {"mapKey": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"mapKey": "configuration_property_value"}, "worker": {"mapKey": "configuration_property_value"}}, "event_listener": {"mapKey": "event_listener_property_value"}, "global": {"mapKey": "global_property_value"}, "jmx_exporter_config": {"mapKey": "jmx_exporter_config_property_value"}, "jvm": {"coordinator": {"mapKey": "JVM_property_value"}, "worker": {"mapKey": "JVM_property_value"}}, "log_config": {"coordinator": {"mapKey": "log_config_property_value"}, "worker": {"mapKey": "log_config_property_value"}}}}`) })) }) - It(`Invoke CreateIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngineConfig successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -6178,65 +6549,54 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateIntegration(nil) + result, response, operationErr := watsonxDataService.GetPrestoEngineConfig(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateIntegrationOptions model - createIntegrationOptionsModel := new(watsonxdatav2.CreateIntegrationOptions) - createIntegrationOptionsModel.AccessToken = core.StringPtr("testString") - createIntegrationOptionsModel.Apikey = core.StringPtr("testString") - createIntegrationOptionsModel.CrossAccountIntegration = core.BoolPtr(true) - createIntegrationOptionsModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) - createIntegrationOptionsModel.IkcUserAccountID = core.StringPtr("testString") - createIntegrationOptionsModel.Password = core.StringPtr("password") - createIntegrationOptionsModel.Resource = core.StringPtr("resource_name") - createIntegrationOptionsModel.ServiceType = core.StringPtr("ranger") - createIntegrationOptionsModel.StorageCatalogs = []string{"testString"} - createIntegrationOptionsModel.URL = core.StringPtr("http://abcd.efgh.com:9876/") - createIntegrationOptionsModel.Username = core.StringPtr("username") - createIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineConfigOptions model + getPrestoEngineConfigOptionsModel := new(watsonxdatav3.GetPrestoEngineConfigOptions) + getPrestoEngineConfigOptionsModel.EngineID = core.StringPtr("presto860") + getPrestoEngineConfigOptionsModel.AuthInstanceID = core.StringPtr("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::") + getPrestoEngineConfigOptionsModel.Sections = core.StringPtr("catalog,configuration,jvm") + getPrestoEngineConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateIntegration(createIntegrationOptionsModel) + result, response, operationErr = watsonxDataService.GetPrestoEngineConfig(getPrestoEngineConfigOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateIntegration with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngineConfig with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateIntegrationOptions model - createIntegrationOptionsModel := new(watsonxdatav2.CreateIntegrationOptions) - createIntegrationOptionsModel.AccessToken = core.StringPtr("testString") - createIntegrationOptionsModel.Apikey = core.StringPtr("testString") - createIntegrationOptionsModel.CrossAccountIntegration = core.BoolPtr(true) - createIntegrationOptionsModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) - createIntegrationOptionsModel.IkcUserAccountID = core.StringPtr("testString") - createIntegrationOptionsModel.Password = core.StringPtr("password") - createIntegrationOptionsModel.Resource = core.StringPtr("resource_name") - createIntegrationOptionsModel.ServiceType = core.StringPtr("ranger") - createIntegrationOptionsModel.StorageCatalogs = []string{"testString"} - createIntegrationOptionsModel.URL = core.StringPtr("http://abcd.efgh.com:9876/") - createIntegrationOptionsModel.Username = core.StringPtr("username") - createIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineConfigOptions model + getPrestoEngineConfigOptionsModel := new(watsonxdatav3.GetPrestoEngineConfigOptions) + getPrestoEngineConfigOptionsModel.EngineID = core.StringPtr("presto860") + getPrestoEngineConfigOptionsModel.AuthInstanceID = core.StringPtr("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::") + getPrestoEngineConfigOptionsModel.Sections = core.StringPtr("catalog,configuration,jvm") + getPrestoEngineConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateIntegration(createIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngineConfig(getPrestoEngineConfigOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the GetPrestoEngineConfigOptions model with no property values + getPrestoEngineConfigOptionsModelNew := new(watsonxdatav3.GetPrestoEngineConfigOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.GetPrestoEngineConfig(getPrestoEngineConfigOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -6248,35 +6608,26 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngineConfig successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateIntegrationOptions model - createIntegrationOptionsModel := new(watsonxdatav2.CreateIntegrationOptions) - createIntegrationOptionsModel.AccessToken = core.StringPtr("testString") - createIntegrationOptionsModel.Apikey = core.StringPtr("testString") - createIntegrationOptionsModel.CrossAccountIntegration = core.BoolPtr(true) - createIntegrationOptionsModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) - createIntegrationOptionsModel.IkcUserAccountID = core.StringPtr("testString") - createIntegrationOptionsModel.Password = core.StringPtr("password") - createIntegrationOptionsModel.Resource = core.StringPtr("resource_name") - createIntegrationOptionsModel.ServiceType = core.StringPtr("ranger") - createIntegrationOptionsModel.StorageCatalogs = []string{"testString"} - createIntegrationOptionsModel.URL = core.StringPtr("http://abcd.efgh.com:9876/") - createIntegrationOptionsModel.Username = core.StringPtr("username") - createIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineConfigOptions model + getPrestoEngineConfigOptionsModel := new(watsonxdatav3.GetPrestoEngineConfigOptions) + getPrestoEngineConfigOptionsModel.EngineID = core.StringPtr("presto860") + getPrestoEngineConfigOptionsModel.AuthInstanceID = core.StringPtr("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::") + getPrestoEngineConfigOptionsModel.Sections = core.StringPtr("catalog,configuration,jvm") + getPrestoEngineConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateIntegration(createIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngineConfig(getPrestoEngineConfigOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -6288,48 +6639,209 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetIntegrations(getIntegrationsOptions *GetIntegrationsOptions) - Operation response error`, func() { - getIntegrationsPath := "/integrations/testString" + Describe(`UpdatePrestoEngineConfig(updatePrestoEngineConfigOptions *UpdatePrestoEngineConfigOptions)`, func() { + updatePrestoEngineConfigPath := "/v3/presto_engines/presto93/config" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updatePrestoEngineConfigPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::"))) + res.WriteHeader(200) + })) + }) + It(`Invoke UpdatePrestoEngineConfig successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.UpdatePrestoEngineConfig(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the CatalogProperties model + catalogPropertiesModel := new(watsonxdatav3.CatalogProperties) + catalogPropertiesModel.Coordinator = map[string]string{"key1": "testString"} + catalogPropertiesModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the ConfigurationProperties model + configurationPropertiesModel := new(watsonxdatav3.ConfigurationProperties) + configurationPropertiesModel.Coordinator = map[string]string{"key1": "configuration_property_value"} + configurationPropertiesModel.Worker = map[string]string{"key1": "configuration_property_value"} + + // Construct an instance of the JvmProperties model + jvmPropertiesModel := new(watsonxdatav3.JvmProperties) + jvmPropertiesModel.Coordinator = map[string]string{"key1": "JVM_property_value"} + jvmPropertiesModel.Worker = map[string]string{"key1": "JVM_property_value"} + + // Construct an instance of the LogConfigProperties model + logConfigPropertiesModel := new(watsonxdatav3.LogConfigProperties) + logConfigPropertiesModel.Coordinator = map[string]string{"key1": "log_config_property_value"} + logConfigPropertiesModel.Worker = map[string]string{"key1": "log_config_property_value"} + + // Construct an instance of the PrestoEngineProperties model + prestoEnginePropertiesModel := new(watsonxdatav3.PrestoEngineProperties) + prestoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.CatalogProperties{"key1": *catalogPropertiesModel} + prestoEnginePropertiesModel.Configuration = configurationPropertiesModel + prestoEnginePropertiesModel.EventListener = map[string]string{"key1": "event_listener_property_value"} + prestoEnginePropertiesModel.Global = map[string]string{"key1": "global_property_value"} + prestoEnginePropertiesModel.JmxExporterConfig = map[string]string{"key1": "jmx_exporter_config_property_value"} + prestoEnginePropertiesModel.Jvm = jvmPropertiesModel + prestoEnginePropertiesModel.LogConfig = logConfigPropertiesModel + prestoEnginePropertiesModel.Catalog["foo"] = *catalogPropertiesModel + + // Construct an instance of the PrestoEnginePropertiesDetails model + prestoEnginePropertiesDetailsModel := new(watsonxdatav3.PrestoEnginePropertiesDetails) + prestoEnginePropertiesDetailsModel.EngineProperties = prestoEnginePropertiesModel + prestoEnginePropertiesDetailsModelAsPatch, asPatchErr := prestoEnginePropertiesDetailsModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePrestoEngineConfigOptions model + updatePrestoEngineConfigOptionsModel := new(watsonxdatav3.UpdatePrestoEngineConfigOptions) + updatePrestoEngineConfigOptionsModel.EngineID = core.StringPtr("presto93") + updatePrestoEngineConfigOptionsModel.AuthInstanceID = core.StringPtr("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::") + updatePrestoEngineConfigOptionsModel.PrestoEnginePropertiesDetailsPatch = prestoEnginePropertiesDetailsModelAsPatch + updatePrestoEngineConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.UpdatePrestoEngineConfig(updatePrestoEngineConfigOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke UpdatePrestoEngineConfig with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the CatalogProperties model + catalogPropertiesModel := new(watsonxdatav3.CatalogProperties) + catalogPropertiesModel.Coordinator = map[string]string{"key1": "testString"} + catalogPropertiesModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the ConfigurationProperties model + configurationPropertiesModel := new(watsonxdatav3.ConfigurationProperties) + configurationPropertiesModel.Coordinator = map[string]string{"key1": "configuration_property_value"} + configurationPropertiesModel.Worker = map[string]string{"key1": "configuration_property_value"} + + // Construct an instance of the JvmProperties model + jvmPropertiesModel := new(watsonxdatav3.JvmProperties) + jvmPropertiesModel.Coordinator = map[string]string{"key1": "JVM_property_value"} + jvmPropertiesModel.Worker = map[string]string{"key1": "JVM_property_value"} + + // Construct an instance of the LogConfigProperties model + logConfigPropertiesModel := new(watsonxdatav3.LogConfigProperties) + logConfigPropertiesModel.Coordinator = map[string]string{"key1": "log_config_property_value"} + logConfigPropertiesModel.Worker = map[string]string{"key1": "log_config_property_value"} + + // Construct an instance of the PrestoEngineProperties model + prestoEnginePropertiesModel := new(watsonxdatav3.PrestoEngineProperties) + prestoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.CatalogProperties{"key1": *catalogPropertiesModel} + prestoEnginePropertiesModel.Configuration = configurationPropertiesModel + prestoEnginePropertiesModel.EventListener = map[string]string{"key1": "event_listener_property_value"} + prestoEnginePropertiesModel.Global = map[string]string{"key1": "global_property_value"} + prestoEnginePropertiesModel.JmxExporterConfig = map[string]string{"key1": "jmx_exporter_config_property_value"} + prestoEnginePropertiesModel.Jvm = jvmPropertiesModel + prestoEnginePropertiesModel.LogConfig = logConfigPropertiesModel + prestoEnginePropertiesModel.Catalog["foo"] = *catalogPropertiesModel + + // Construct an instance of the PrestoEnginePropertiesDetails model + prestoEnginePropertiesDetailsModel := new(watsonxdatav3.PrestoEnginePropertiesDetails) + prestoEnginePropertiesDetailsModel.EngineProperties = prestoEnginePropertiesModel + prestoEnginePropertiesDetailsModelAsPatch, asPatchErr := prestoEnginePropertiesDetailsModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePrestoEngineConfigOptions model + updatePrestoEngineConfigOptionsModel := new(watsonxdatav3.UpdatePrestoEngineConfigOptions) + updatePrestoEngineConfigOptionsModel.EngineID = core.StringPtr("presto93") + updatePrestoEngineConfigOptionsModel.AuthInstanceID = core.StringPtr("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::") + updatePrestoEngineConfigOptionsModel.PrestoEnginePropertiesDetailsPatch = prestoEnginePropertiesDetailsModelAsPatch + updatePrestoEngineConfigOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.UpdatePrestoEngineConfig(updatePrestoEngineConfigOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the UpdatePrestoEngineConfigOptions model with no property values + updatePrestoEngineConfigOptionsModelNew := new(watsonxdatav3.UpdatePrestoEngineConfigOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.UpdatePrestoEngineConfig(updatePrestoEngineConfigOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetPrestoEngine(getPrestoEngineOptions *GetPrestoEngineOptions) - Operation response error`, func() { + getPrestoEnginePath := "/v3/presto_engines/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getIntegrationsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestoEnginePath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.Header["Secret"]).ToNot(BeNil()) - Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetIntegrations with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetIntegrationsOptions model - getIntegrationsOptionsModel := new(watsonxdatav2.GetIntegrationsOptions) - getIntegrationsOptionsModel.IntegrationID = core.StringPtr("testString") - getIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getIntegrationsOptionsModel.Secret = core.StringPtr("testString") - getIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineOptions model + getPrestoEngineOptionsModel := new(watsonxdatav3.GetPrestoEngineOptions) + getPrestoEngineOptionsModel.ID = core.StringPtr("testString") + getPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) + result, response, operationErr = watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -6339,32 +6851,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetIntegrations(getIntegrationsOptions *GetIntegrationsOptions)`, func() { - getIntegrationsPath := "/integrations/testString" + Describe(`GetPrestoEngine(getPrestoEngineOptions *GetPrestoEngineOptions)`, func() { + getPrestoEnginePath := "/v3/presto_engines/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getIntegrationsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestoEnginePath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.Header["Secret"]).ToNot(BeNil()) - Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"apikey": "apikey", "access_token": "uiOO90kklop", "config_properties": "ikc-env.password=ibmlhenc__0001__uMkFATDDZNnxJ7z6BA/QqA==\nikc-env.url=ikc\nikc-enabled-catalogs=\nikc-username=\nlh-unique-identifier=1711796957622126\nlh-crn=1711796957622126", "auth_url": "https://iam.abc.com", "integration_id": "presto01", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "ikc_user_account_id": "abcdefghijklmnopqrstuvwxyz", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 10, "modified_by": "@.com", "password": "password", "resource": "presto01", "service_type": "ikc", "state": "active", "storage_catalogs": ["StorageCatalogs"], "url": "ikc.url", "zen_apikey": "zen_apikey", "username": "username@email.com"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "starter", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "starter", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 1, "created_by": "username@domain.com", "description": "presto engine for running sql queries", "display_name": "sampleEngine", "drivers": [{"connection_type": "hana", "driver_id": "hanadriver123", "driver_name": "hanadriver-1.2.3", "driver_version": "1.2.3"}], "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "configuration_property_value"}, "worker": {"mapKey": "configuration_property_value"}}, "event_listener": {"mapKey": "event_listener_property_value"}, "global": {"mapKey": "global_property_value"}, "jmx_exporter_config": {"mapKey": "jmx_exporter_config_property_value"}, "jvm": {"coordinator": {"mapKey": "JVM_property_value"}, "worker": {"mapKey": "JVM_property_value"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "log_config_property_value"}}}, "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "configuration": {"coordinator": ["property_name"], "worker": ["property_name"]}, "event_listener": ["property_name"], "global": ["property_name"], "jmx_exporter_config": ["JmxExporterConfig"], "jvm": {"coordinator": ["property_name"], "worker": ["property_name"]}, "log_config": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "restart_type": "force", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "id": "presto123", "is_qhmm_engine": true, "origin": "native", "port": 1, "query_status": "completed", "resource_groups": [{"resource_group_file_name": "resource_group.json", "resource_group_id": "resourceGroup689"}], "size_config": "starter", "status": "running", "status_code": 1, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}`) })) }) - It(`Invoke GetIntegrations successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -6372,23 +6882,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetIntegrationsOptions model - getIntegrationsOptionsModel := new(watsonxdatav2.GetIntegrationsOptions) - getIntegrationsOptionsModel.IntegrationID = core.StringPtr("testString") - getIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getIntegrationsOptionsModel.Secret = core.StringPtr("testString") - getIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineOptions model + getPrestoEngineOptionsModel := new(watsonxdatav3.GetPrestoEngineOptions) + getPrestoEngineOptionsModel.ID = core.StringPtr("testString") + getPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetIntegrationsWithContext(ctx, getIntegrationsOptionsModel) + _, _, operationErr := watsonxDataService.GetPrestoEngineWithContext(ctx, getPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -6396,7 +6905,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetIntegrationsWithContext(ctx, getIntegrationsOptionsModel) + _, _, operationErr = watsonxDataService.GetPrestoEngineWithContext(ctx, getPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -6410,21 +6919,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getIntegrationsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestoEnginePath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.Header["Secret"]).ToNot(BeNil()) - Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"apikey": "apikey", "access_token": "uiOO90kklop", "config_properties": "ikc-env.password=ibmlhenc__0001__uMkFATDDZNnxJ7z6BA/QqA==\nikc-env.url=ikc\nikc-enabled-catalogs=\nikc-username=\nlh-unique-identifier=1711796957622126\nlh-crn=1711796957622126", "auth_url": "https://iam.abc.com", "integration_id": "presto01", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "ikc_user_account_id": "abcdefghijklmnopqrstuvwxyz", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 10, "modified_by": "@.com", "password": "password", "resource": "presto01", "service_type": "ikc", "state": "active", "storage_catalogs": ["StorageCatalogs"], "url": "ikc.url", "zen_apikey": "zen_apikey", "username": "username@email.com"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "starter", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "starter", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 1, "created_by": "username@domain.com", "description": "presto engine for running sql queries", "display_name": "sampleEngine", "drivers": [{"connection_type": "hana", "driver_id": "hanadriver123", "driver_name": "hanadriver-1.2.3", "driver_version": "1.2.3"}], "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "configuration_property_value"}, "worker": {"mapKey": "configuration_property_value"}}, "event_listener": {"mapKey": "event_listener_property_value"}, "global": {"mapKey": "global_property_value"}, "jmx_exporter_config": {"mapKey": "jmx_exporter_config_property_value"}, "jvm": {"coordinator": {"mapKey": "JVM_property_value"}, "worker": {"mapKey": "JVM_property_value"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "log_config_property_value"}}}, "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "configuration": {"coordinator": ["property_name"], "worker": ["property_name"]}, "event_listener": ["property_name"], "global": ["property_name"], "jmx_exporter_config": ["JmxExporterConfig"], "jvm": {"coordinator": ["property_name"], "worker": ["property_name"]}, "log_config": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "restart_type": "force", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "id": "presto123", "is_qhmm_engine": true, "origin": "native", "port": 1, "query_status": "completed", "resource_groups": [{"resource_group_file_name": "resource_group.json", "resource_group_id": "resourceGroup689"}], "size_config": "starter", "status": "running", "status_code": 1, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}`) })) }) - It(`Invoke GetIntegrations successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -6432,51 +6939,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetIntegrations(nil) + result, response, operationErr := watsonxDataService.GetPrestoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetIntegrationsOptions model - getIntegrationsOptionsModel := new(watsonxdatav2.GetIntegrationsOptions) - getIntegrationsOptionsModel.IntegrationID = core.StringPtr("testString") - getIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getIntegrationsOptionsModel.Secret = core.StringPtr("testString") - getIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineOptions model + getPrestoEngineOptionsModel := new(watsonxdatav3.GetPrestoEngineOptions) + getPrestoEngineOptionsModel.ID = core.StringPtr("testString") + getPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) + result, response, operationErr = watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetIntegrations with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetIntegrationsOptions model - getIntegrationsOptionsModel := new(watsonxdatav2.GetIntegrationsOptions) - getIntegrationsOptionsModel.IntegrationID = core.StringPtr("testString") - getIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getIntegrationsOptionsModel.Secret = core.StringPtr("testString") - getIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineOptions model + getPrestoEngineOptionsModel := new(watsonxdatav3.GetPrestoEngineOptions) + getPrestoEngineOptionsModel.ID = core.StringPtr("testString") + getPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetIntegrationsOptions model with no property values - getIntegrationsOptionsModelNew := new(watsonxdatav2.GetIntegrationsOptions) + // Construct a second instance of the GetPrestoEngineOptions model with no property values + getPrestoEngineOptionsModelNew := new(watsonxdatav3.GetPrestoEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetIntegrations(getIntegrationsOptionsModelNew) + result, response, operationErr = watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -6494,23 +6999,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetIntegrations successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetIntegrationsOptions model - getIntegrationsOptionsModel := new(watsonxdatav2.GetIntegrationsOptions) - getIntegrationsOptionsModel.IntegrationID = core.StringPtr("testString") - getIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getIntegrationsOptionsModel.Secret = core.StringPtr("testString") - getIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestoEngineOptions model + getPrestoEngineOptionsModel := new(watsonxdatav3.GetPrestoEngineOptions) + getPrestoEngineOptionsModel.ID = core.StringPtr("testString") + getPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -6522,15 +7026,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteIntegration(deleteIntegrationOptions *DeleteIntegrationOptions)`, func() { - deleteIntegrationPath := "/integrations/testString" + Describe(`DeleteEngine(deleteEngineOptions *DeleteEngineOptions)`, func() { + deleteEnginePath := "/v3/presto_engines/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteIntegrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteEnginePath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -6538,8 +7042,8 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(204) })) }) - It(`Invoke DeleteIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -6547,45 +7051,45 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteIntegration(nil) + response, operationErr := watsonxDataService.DeleteEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteIntegrationOptions model - deleteIntegrationOptionsModel := new(watsonxdatav2.DeleteIntegrationOptions) - deleteIntegrationOptionsModel.IntegrationID = core.StringPtr("testString") - deleteIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteEngineOptions model + deleteEngineOptionsModel := new(watsonxdatav3.DeleteEngineOptions) + deleteEngineOptionsModel.ID = core.StringPtr("testString") + deleteEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteIntegration(deleteIntegrationOptionsModel) + response, operationErr = watsonxDataService.DeleteEngine(deleteEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteIntegration with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DeleteIntegrationOptions model - deleteIntegrationOptionsModel := new(watsonxdatav2.DeleteIntegrationOptions) - deleteIntegrationOptionsModel.IntegrationID = core.StringPtr("testString") - deleteIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteEngineOptions model + deleteEngineOptionsModel := new(watsonxdatav3.DeleteEngineOptions) + deleteEngineOptionsModel.ID = core.StringPtr("testString") + deleteEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteIntegration(deleteIntegrationOptionsModel) + response, operationErr := watsonxDataService.DeleteEngine(deleteEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteIntegrationOptions model with no property values - deleteIntegrationOptionsModelNew := new(watsonxdatav2.DeleteIntegrationOptions) + // Construct a second instance of the DeleteEngineOptions model with no property values + deleteEngineOptionsModelNew := new(watsonxdatav3.DeleteEngineOptions) // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteIntegration(deleteIntegrationOptionsModelNew) + response, operationErr = watsonxDataService.DeleteEngine(deleteEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -6594,15 +7098,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateIntegration(updateIntegrationOptions *UpdateIntegrationOptions) - Operation response error`, func() { - updateIntegrationPath := "/integrations/testString" + Describe(`UpdatePrestoEngine(updatePrestoEngineOptions *UpdatePrestoEngineOptions) - Operation response error`, func() { + updatePrestoEnginePath := "/v3/presto_engines/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateIntegrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(updatePrestoEnginePath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -6611,45 +7115,102 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateIntegration with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the IntegrationPatch model - integrationPatchModel := new(watsonxdatav2.IntegrationPatch) - integrationPatchModel.AccessToken = core.StringPtr("uiOO90kklop") - integrationPatchModel.Apikey = core.StringPtr("apikey") - integrationPatchModel.CrossAccountIntegration = core.BoolPtr(false) - integrationPatchModel.EnableDataPolicyWithinWxd = core.BoolPtr(true) - integrationPatchModel.IkcUserAccountID = core.StringPtr("abcdefghijklmnopqrstuvwxyz") - integrationPatchModel.Password = core.StringPtr("password") - integrationPatchModel.Resource = core.StringPtr("resource_name") - integrationPatchModel.State = core.StringPtr("active") - integrationPatchModel.StorageCatalogs = []string{"iceberg_data", "hive_data"} - integrationPatchModel.URL = core.StringPtr("http://abcd.efgh.com:9876/") - integrationPatchModel.Username = core.StringPtr("username") - integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + // Construct an instance of the EnginePropertiesCatalogAdditionalProperties model + enginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.EnginePropertiesCatalogAdditionalProperties) + enginePropertiesCatalogAdditionalPropertiesModel.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + enginePropertiesCatalogAdditionalPropertiesModel.Worker = map[string]interface{}{"anyKey": "anyValue"} + + // Construct an instance of the EnginePropertiesConfiguration model + enginePropertiesConfigurationModel := new(watsonxdatav3.EnginePropertiesConfiguration) + enginePropertiesConfigurationModel.Coordinator = map[string]string{"key1": "configuration_property_value"} + enginePropertiesConfigurationModel.Worker = map[string]string{"key1": "configuration_property_value"} + + // Construct an instance of the EnginePropertiesJvm model + enginePropertiesJvmModel := new(watsonxdatav3.EnginePropertiesJvm) + enginePropertiesJvmModel.Coordinator = map[string]string{"key1": "JVM_property_value"} + enginePropertiesJvmModel.Worker = map[string]string{"key1": "JVM_property_value"} + + // Construct an instance of the EnginePropertiesLogConfig model + enginePropertiesLogConfigModel := new(watsonxdatav3.EnginePropertiesLogConfig) + enginePropertiesLogConfigModel.Coordinator = map[string]string{"key1": "testString"} + enginePropertiesLogConfigModel.Worker = map[string]string{"key1": "log_config_property_value"} + + // Construct an instance of the EngineProperties model + enginePropertiesModel := new(watsonxdatav3.EngineProperties) + enginePropertiesModel.Catalog = map[string]watsonxdatav3.EnginePropertiesCatalogAdditionalProperties{"key1": *enginePropertiesCatalogAdditionalPropertiesModel} + enginePropertiesModel.Configuration = enginePropertiesConfigurationModel + enginePropertiesModel.EventListener = map[string]string{"key1": "event_listener_property_value"} + enginePropertiesModel.Global = map[string]string{"key1": "global_property_value"} + enginePropertiesModel.JmxExporterConfig = map[string]string{"key1": "jmx_exporter_config_property_value"} + enginePropertiesModel.Jvm = enginePropertiesJvmModel + enginePropertiesModel.LogConfig = enginePropertiesLogConfigModel + enginePropertiesModel.Catalog["foo"] = *enginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the RemoveEnginePropertiesCatalogAdditionalProperties model + removeEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties) + removeEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = []string{"property_name"} + removeEnginePropertiesCatalogAdditionalPropertiesModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesConfiguration model + removeEnginePropertiesConfigurationModel := new(watsonxdatav3.RemoveEnginePropertiesConfiguration) + removeEnginePropertiesConfigurationModel.Coordinator = []string{"property_name"} + removeEnginePropertiesConfigurationModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesJvm model + removeEnginePropertiesJvmModel := new(watsonxdatav3.RemoveEnginePropertiesJvm) + removeEnginePropertiesJvmModel.Coordinator = []string{"property_name"} + removeEnginePropertiesJvmModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesLogConfig model + removeEnginePropertiesLogConfigModel := new(watsonxdatav3.RemoveEnginePropertiesLogConfig) + removeEnginePropertiesLogConfigModel.Coordinator = []string{"property_name"} + removeEnginePropertiesLogConfigModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEngineProperties model + removeEnginePropertiesModel := new(watsonxdatav3.RemoveEngineProperties) + removeEnginePropertiesModel.Catalog = map[string]watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties{"key1": *removeEnginePropertiesCatalogAdditionalPropertiesModel} + removeEnginePropertiesModel.Configuration = removeEnginePropertiesConfigurationModel + removeEnginePropertiesModel.EventListener = []string{"property_name"} + removeEnginePropertiesModel.Global = []string{"property_name"} + removeEnginePropertiesModel.JmxExporterConfig = []string{"testString"} + removeEnginePropertiesModel.Jvm = removeEnginePropertiesJvmModel + removeEnginePropertiesModel.LogConfig = removeEnginePropertiesLogConfigModel + removeEnginePropertiesModel.Catalog["foo"] = *removeEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the PrestoEnginePatch model + prestoEnginePatchModel := new(watsonxdatav3.PrestoEnginePatch) + prestoEnginePatchModel.Description = core.StringPtr("updated description for presto engine") + prestoEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + prestoEnginePatchModel.Properties = enginePropertiesModel + prestoEnginePatchModel.RemoveEngineProperties = removeEnginePropertiesModel + prestoEnginePatchModel.RestartType = core.StringPtr("force") + prestoEnginePatchModel.Tags = []string{"tag1", "tag2"} + prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateIntegrationOptions model - updateIntegrationOptionsModel := new(watsonxdatav2.UpdateIntegrationOptions) - updateIntegrationOptionsModel.IntegrationID = core.StringPtr("testString") - updateIntegrationOptionsModel.IntegrationPatch = integrationPatchModelAsPatch - updateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePrestoEngineOptions model + updatePrestoEngineOptionsModel := new(watsonxdatav3.UpdatePrestoEngineOptions) + updatePrestoEngineOptionsModel.ID = core.StringPtr("testString") + updatePrestoEngineOptionsModel.Body = prestoEnginePatchModelAsPatch + updatePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) + result, response, operationErr = watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -6659,15 +7220,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateIntegration(updateIntegrationOptions *UpdateIntegrationOptions)`, func() { - updateIntegrationPath := "/integrations/testString" + Describe(`UpdatePrestoEngine(updatePrestoEngineOptions *UpdatePrestoEngineOptions)`, func() { + updatePrestoEnginePath := "/v3/presto_engines/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateIntegrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(updatePrestoEnginePath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -6694,11 +7255,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"apikey": "apikey", "access_token": "uiOO90kklop", "config_properties": "ikc-env.password=ibmlhenc__0001__uMkFATDDZNnxJ7z6BA/QqA==\nikc-env.url=ikc\nikc-enabled-catalogs=\nikc-username=\nlh-unique-identifier=1711796957622126\nlh-crn=1711796957622126", "auth_url": "https://iam.abc.com", "integration_id": "presto01", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "ikc_user_account_id": "abcdefghijklmnopqrstuvwxyz", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 10, "modified_by": "@.com", "password": "password", "resource": "presto01", "service_type": "ikc", "state": "active", "storage_catalogs": ["StorageCatalogs"], "url": "ikc.url", "zen_apikey": "zen_apikey", "username": "username@email.com"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "starter", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "starter", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 1, "created_by": "username@domain.com", "description": "presto engine for running sql queries", "display_name": "sampleEngine", "drivers": [{"connection_type": "hana", "driver_id": "hanadriver123", "driver_name": "hanadriver-1.2.3", "driver_version": "1.2.3"}], "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "configuration_property_value"}, "worker": {"mapKey": "configuration_property_value"}}, "event_listener": {"mapKey": "event_listener_property_value"}, "global": {"mapKey": "global_property_value"}, "jmx_exporter_config": {"mapKey": "jmx_exporter_config_property_value"}, "jvm": {"coordinator": {"mapKey": "JVM_property_value"}, "worker": {"mapKey": "JVM_property_value"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "log_config_property_value"}}}, "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "configuration": {"coordinator": ["property_name"], "worker": ["property_name"]}, "event_listener": ["property_name"], "global": ["property_name"], "jmx_exporter_config": ["JmxExporterConfig"], "jvm": {"coordinator": ["property_name"], "worker": ["property_name"]}, "log_config": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "restart_type": "force", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "id": "presto123", "is_qhmm_engine": true, "origin": "native", "port": 1, "query_status": "completed", "resource_groups": [{"resource_group_file_name": "resource_group.json", "resource_group_id": "resourceGroup689"}], "size_config": "starter", "status": "running", "status_code": 1, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}`) })) }) - It(`Invoke UpdateIntegration successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -6706,39 +7267,96 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the IntegrationPatch model - integrationPatchModel := new(watsonxdatav2.IntegrationPatch) - integrationPatchModel.AccessToken = core.StringPtr("uiOO90kklop") - integrationPatchModel.Apikey = core.StringPtr("apikey") - integrationPatchModel.CrossAccountIntegration = core.BoolPtr(false) - integrationPatchModel.EnableDataPolicyWithinWxd = core.BoolPtr(true) - integrationPatchModel.IkcUserAccountID = core.StringPtr("abcdefghijklmnopqrstuvwxyz") - integrationPatchModel.Password = core.StringPtr("password") - integrationPatchModel.Resource = core.StringPtr("resource_name") - integrationPatchModel.State = core.StringPtr("active") - integrationPatchModel.StorageCatalogs = []string{"iceberg_data", "hive_data"} - integrationPatchModel.URL = core.StringPtr("http://abcd.efgh.com:9876/") - integrationPatchModel.Username = core.StringPtr("username") - integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + // Construct an instance of the EnginePropertiesCatalogAdditionalProperties model + enginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.EnginePropertiesCatalogAdditionalProperties) + enginePropertiesCatalogAdditionalPropertiesModel.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + enginePropertiesCatalogAdditionalPropertiesModel.Worker = map[string]interface{}{"anyKey": "anyValue"} + + // Construct an instance of the EnginePropertiesConfiguration model + enginePropertiesConfigurationModel := new(watsonxdatav3.EnginePropertiesConfiguration) + enginePropertiesConfigurationModel.Coordinator = map[string]string{"key1": "configuration_property_value"} + enginePropertiesConfigurationModel.Worker = map[string]string{"key1": "configuration_property_value"} + + // Construct an instance of the EnginePropertiesJvm model + enginePropertiesJvmModel := new(watsonxdatav3.EnginePropertiesJvm) + enginePropertiesJvmModel.Coordinator = map[string]string{"key1": "JVM_property_value"} + enginePropertiesJvmModel.Worker = map[string]string{"key1": "JVM_property_value"} + + // Construct an instance of the EnginePropertiesLogConfig model + enginePropertiesLogConfigModel := new(watsonxdatav3.EnginePropertiesLogConfig) + enginePropertiesLogConfigModel.Coordinator = map[string]string{"key1": "testString"} + enginePropertiesLogConfigModel.Worker = map[string]string{"key1": "log_config_property_value"} + + // Construct an instance of the EngineProperties model + enginePropertiesModel := new(watsonxdatav3.EngineProperties) + enginePropertiesModel.Catalog = map[string]watsonxdatav3.EnginePropertiesCatalogAdditionalProperties{"key1": *enginePropertiesCatalogAdditionalPropertiesModel} + enginePropertiesModel.Configuration = enginePropertiesConfigurationModel + enginePropertiesModel.EventListener = map[string]string{"key1": "event_listener_property_value"} + enginePropertiesModel.Global = map[string]string{"key1": "global_property_value"} + enginePropertiesModel.JmxExporterConfig = map[string]string{"key1": "jmx_exporter_config_property_value"} + enginePropertiesModel.Jvm = enginePropertiesJvmModel + enginePropertiesModel.LogConfig = enginePropertiesLogConfigModel + enginePropertiesModel.Catalog["foo"] = *enginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the RemoveEnginePropertiesCatalogAdditionalProperties model + removeEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties) + removeEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = []string{"property_name"} + removeEnginePropertiesCatalogAdditionalPropertiesModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesConfiguration model + removeEnginePropertiesConfigurationModel := new(watsonxdatav3.RemoveEnginePropertiesConfiguration) + removeEnginePropertiesConfigurationModel.Coordinator = []string{"property_name"} + removeEnginePropertiesConfigurationModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesJvm model + removeEnginePropertiesJvmModel := new(watsonxdatav3.RemoveEnginePropertiesJvm) + removeEnginePropertiesJvmModel.Coordinator = []string{"property_name"} + removeEnginePropertiesJvmModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesLogConfig model + removeEnginePropertiesLogConfigModel := new(watsonxdatav3.RemoveEnginePropertiesLogConfig) + removeEnginePropertiesLogConfigModel.Coordinator = []string{"property_name"} + removeEnginePropertiesLogConfigModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEngineProperties model + removeEnginePropertiesModel := new(watsonxdatav3.RemoveEngineProperties) + removeEnginePropertiesModel.Catalog = map[string]watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties{"key1": *removeEnginePropertiesCatalogAdditionalPropertiesModel} + removeEnginePropertiesModel.Configuration = removeEnginePropertiesConfigurationModel + removeEnginePropertiesModel.EventListener = []string{"property_name"} + removeEnginePropertiesModel.Global = []string{"property_name"} + removeEnginePropertiesModel.JmxExporterConfig = []string{"testString"} + removeEnginePropertiesModel.Jvm = removeEnginePropertiesJvmModel + removeEnginePropertiesModel.LogConfig = removeEnginePropertiesLogConfigModel + removeEnginePropertiesModel.Catalog["foo"] = *removeEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the PrestoEnginePatch model + prestoEnginePatchModel := new(watsonxdatav3.PrestoEnginePatch) + prestoEnginePatchModel.Description = core.StringPtr("updated description for presto engine") + prestoEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + prestoEnginePatchModel.Properties = enginePropertiesModel + prestoEnginePatchModel.RemoveEngineProperties = removeEnginePropertiesModel + prestoEnginePatchModel.RestartType = core.StringPtr("force") + prestoEnginePatchModel.Tags = []string{"tag1", "tag2"} + prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateIntegrationOptions model - updateIntegrationOptionsModel := new(watsonxdatav2.UpdateIntegrationOptions) - updateIntegrationOptionsModel.IntegrationID = core.StringPtr("testString") - updateIntegrationOptionsModel.IntegrationPatch = integrationPatchModelAsPatch - updateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePrestoEngineOptions model + updatePrestoEngineOptionsModel := new(watsonxdatav3.UpdatePrestoEngineOptions) + updatePrestoEngineOptionsModel.ID = core.StringPtr("testString") + updatePrestoEngineOptionsModel.Body = prestoEnginePatchModelAsPatch + updatePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateIntegrationWithContext(ctx, updateIntegrationOptionsModel) + _, _, operationErr := watsonxDataService.UpdatePrestoEngineWithContext(ctx, updatePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -6746,7 +7364,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateIntegrationWithContext(ctx, updateIntegrationOptionsModel) + _, _, operationErr = watsonxDataService.UpdatePrestoEngineWithContext(ctx, updatePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -6760,7 +7378,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateIntegrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(updatePrestoEnginePath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -6784,11 +7402,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"apikey": "apikey", "access_token": "uiOO90kklop", "config_properties": "ikc-env.password=ibmlhenc__0001__uMkFATDDZNnxJ7z6BA/QqA==\nikc-env.url=ikc\nikc-enabled-catalogs=\nikc-username=\nlh-unique-identifier=1711796957622126\nlh-crn=1711796957622126", "auth_url": "https://iam.abc.com", "integration_id": "presto01", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "ikc_user_account_id": "abcdefghijklmnopqrstuvwxyz", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 10, "modified_by": "@.com", "password": "password", "resource": "presto01", "service_type": "ikc", "state": "active", "storage_catalogs": ["StorageCatalogs"], "url": "ikc.url", "zen_apikey": "zen_apikey", "username": "username@email.com"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "starter", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "starter", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 1, "created_by": "username@domain.com", "description": "presto engine for running sql queries", "display_name": "sampleEngine", "drivers": [{"connection_type": "hana", "driver_id": "hanadriver123", "driver_name": "hanadriver-1.2.3", "driver_version": "1.2.3"}], "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "configuration_property_value"}, "worker": {"mapKey": "configuration_property_value"}}, "event_listener": {"mapKey": "event_listener_property_value"}, "global": {"mapKey": "global_property_value"}, "jmx_exporter_config": {"mapKey": "jmx_exporter_config_property_value"}, "jvm": {"coordinator": {"mapKey": "JVM_property_value"}, "worker": {"mapKey": "JVM_property_value"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "log_config_property_value"}}}, "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "configuration": {"coordinator": ["property_name"], "worker": ["property_name"]}, "event_listener": ["property_name"], "global": ["property_name"], "jmx_exporter_config": ["JmxExporterConfig"], "jvm": {"coordinator": ["property_name"], "worker": ["property_name"]}, "log_config": {"coordinator": ["property_name"], "worker": ["property_name"]}}, "restart_type": "force", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "id": "presto123", "is_qhmm_engine": true, "origin": "native", "port": 1, "query_status": "completed", "resource_groups": [{"resource_group_file_name": "resource_group.json", "resource_group_id": "resourceGroup689"}], "size_config": "starter", "status": "running", "status_code": 1, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}, "autoscaling_enabled": true, "autoscaling_config": {"type": "cpu", "target": 40, "min_worker_quantity": 1, "max_worker_quantity": 18, "query_termination_grace_period_min": 1, "scale_in_stabilization_window_min": 5, "scaling_step_size": 1}}`) })) }) - It(`Invoke UpdateIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -6796,83 +7414,197 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateIntegration(nil) + result, response, operationErr := watsonxDataService.UpdatePrestoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the IntegrationPatch model - integrationPatchModel := new(watsonxdatav2.IntegrationPatch) - integrationPatchModel.AccessToken = core.StringPtr("uiOO90kklop") - integrationPatchModel.Apikey = core.StringPtr("apikey") - integrationPatchModel.CrossAccountIntegration = core.BoolPtr(false) - integrationPatchModel.EnableDataPolicyWithinWxd = core.BoolPtr(true) - integrationPatchModel.IkcUserAccountID = core.StringPtr("abcdefghijklmnopqrstuvwxyz") - integrationPatchModel.Password = core.StringPtr("password") - integrationPatchModel.Resource = core.StringPtr("resource_name") - integrationPatchModel.State = core.StringPtr("active") - integrationPatchModel.StorageCatalogs = []string{"iceberg_data", "hive_data"} - integrationPatchModel.URL = core.StringPtr("http://abcd.efgh.com:9876/") - integrationPatchModel.Username = core.StringPtr("username") - integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + // Construct an instance of the EnginePropertiesCatalogAdditionalProperties model + enginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.EnginePropertiesCatalogAdditionalProperties) + enginePropertiesCatalogAdditionalPropertiesModel.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + enginePropertiesCatalogAdditionalPropertiesModel.Worker = map[string]interface{}{"anyKey": "anyValue"} + + // Construct an instance of the EnginePropertiesConfiguration model + enginePropertiesConfigurationModel := new(watsonxdatav3.EnginePropertiesConfiguration) + enginePropertiesConfigurationModel.Coordinator = map[string]string{"key1": "configuration_property_value"} + enginePropertiesConfigurationModel.Worker = map[string]string{"key1": "configuration_property_value"} + + // Construct an instance of the EnginePropertiesJvm model + enginePropertiesJvmModel := new(watsonxdatav3.EnginePropertiesJvm) + enginePropertiesJvmModel.Coordinator = map[string]string{"key1": "JVM_property_value"} + enginePropertiesJvmModel.Worker = map[string]string{"key1": "JVM_property_value"} + + // Construct an instance of the EnginePropertiesLogConfig model + enginePropertiesLogConfigModel := new(watsonxdatav3.EnginePropertiesLogConfig) + enginePropertiesLogConfigModel.Coordinator = map[string]string{"key1": "testString"} + enginePropertiesLogConfigModel.Worker = map[string]string{"key1": "log_config_property_value"} + + // Construct an instance of the EngineProperties model + enginePropertiesModel := new(watsonxdatav3.EngineProperties) + enginePropertiesModel.Catalog = map[string]watsonxdatav3.EnginePropertiesCatalogAdditionalProperties{"key1": *enginePropertiesCatalogAdditionalPropertiesModel} + enginePropertiesModel.Configuration = enginePropertiesConfigurationModel + enginePropertiesModel.EventListener = map[string]string{"key1": "event_listener_property_value"} + enginePropertiesModel.Global = map[string]string{"key1": "global_property_value"} + enginePropertiesModel.JmxExporterConfig = map[string]string{"key1": "jmx_exporter_config_property_value"} + enginePropertiesModel.Jvm = enginePropertiesJvmModel + enginePropertiesModel.LogConfig = enginePropertiesLogConfigModel + enginePropertiesModel.Catalog["foo"] = *enginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the RemoveEnginePropertiesCatalogAdditionalProperties model + removeEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties) + removeEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = []string{"property_name"} + removeEnginePropertiesCatalogAdditionalPropertiesModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesConfiguration model + removeEnginePropertiesConfigurationModel := new(watsonxdatav3.RemoveEnginePropertiesConfiguration) + removeEnginePropertiesConfigurationModel.Coordinator = []string{"property_name"} + removeEnginePropertiesConfigurationModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesJvm model + removeEnginePropertiesJvmModel := new(watsonxdatav3.RemoveEnginePropertiesJvm) + removeEnginePropertiesJvmModel.Coordinator = []string{"property_name"} + removeEnginePropertiesJvmModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesLogConfig model + removeEnginePropertiesLogConfigModel := new(watsonxdatav3.RemoveEnginePropertiesLogConfig) + removeEnginePropertiesLogConfigModel.Coordinator = []string{"property_name"} + removeEnginePropertiesLogConfigModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEngineProperties model + removeEnginePropertiesModel := new(watsonxdatav3.RemoveEngineProperties) + removeEnginePropertiesModel.Catalog = map[string]watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties{"key1": *removeEnginePropertiesCatalogAdditionalPropertiesModel} + removeEnginePropertiesModel.Configuration = removeEnginePropertiesConfigurationModel + removeEnginePropertiesModel.EventListener = []string{"property_name"} + removeEnginePropertiesModel.Global = []string{"property_name"} + removeEnginePropertiesModel.JmxExporterConfig = []string{"testString"} + removeEnginePropertiesModel.Jvm = removeEnginePropertiesJvmModel + removeEnginePropertiesModel.LogConfig = removeEnginePropertiesLogConfigModel + removeEnginePropertiesModel.Catalog["foo"] = *removeEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the PrestoEnginePatch model + prestoEnginePatchModel := new(watsonxdatav3.PrestoEnginePatch) + prestoEnginePatchModel.Description = core.StringPtr("updated description for presto engine") + prestoEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + prestoEnginePatchModel.Properties = enginePropertiesModel + prestoEnginePatchModel.RemoveEngineProperties = removeEnginePropertiesModel + prestoEnginePatchModel.RestartType = core.StringPtr("force") + prestoEnginePatchModel.Tags = []string{"tag1", "tag2"} + prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateIntegrationOptions model - updateIntegrationOptionsModel := new(watsonxdatav2.UpdateIntegrationOptions) - updateIntegrationOptionsModel.IntegrationID = core.StringPtr("testString") - updateIntegrationOptionsModel.IntegrationPatch = integrationPatchModelAsPatch - updateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePrestoEngineOptions model + updatePrestoEngineOptionsModel := new(watsonxdatav3.UpdatePrestoEngineOptions) + updatePrestoEngineOptionsModel.ID = core.StringPtr("testString") + updatePrestoEngineOptionsModel.Body = prestoEnginePatchModelAsPatch + updatePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) + result, response, operationErr = watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateIntegration with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the IntegrationPatch model - integrationPatchModel := new(watsonxdatav2.IntegrationPatch) - integrationPatchModel.AccessToken = core.StringPtr("uiOO90kklop") - integrationPatchModel.Apikey = core.StringPtr("apikey") - integrationPatchModel.CrossAccountIntegration = core.BoolPtr(false) - integrationPatchModel.EnableDataPolicyWithinWxd = core.BoolPtr(true) - integrationPatchModel.IkcUserAccountID = core.StringPtr("abcdefghijklmnopqrstuvwxyz") - integrationPatchModel.Password = core.StringPtr("password") - integrationPatchModel.Resource = core.StringPtr("resource_name") - integrationPatchModel.State = core.StringPtr("active") - integrationPatchModel.StorageCatalogs = []string{"iceberg_data", "hive_data"} - integrationPatchModel.URL = core.StringPtr("http://abcd.efgh.com:9876/") - integrationPatchModel.Username = core.StringPtr("username") - integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + // Construct an instance of the EnginePropertiesCatalogAdditionalProperties model + enginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.EnginePropertiesCatalogAdditionalProperties) + enginePropertiesCatalogAdditionalPropertiesModel.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + enginePropertiesCatalogAdditionalPropertiesModel.Worker = map[string]interface{}{"anyKey": "anyValue"} + + // Construct an instance of the EnginePropertiesConfiguration model + enginePropertiesConfigurationModel := new(watsonxdatav3.EnginePropertiesConfiguration) + enginePropertiesConfigurationModel.Coordinator = map[string]string{"key1": "configuration_property_value"} + enginePropertiesConfigurationModel.Worker = map[string]string{"key1": "configuration_property_value"} + + // Construct an instance of the EnginePropertiesJvm model + enginePropertiesJvmModel := new(watsonxdatav3.EnginePropertiesJvm) + enginePropertiesJvmModel.Coordinator = map[string]string{"key1": "JVM_property_value"} + enginePropertiesJvmModel.Worker = map[string]string{"key1": "JVM_property_value"} + + // Construct an instance of the EnginePropertiesLogConfig model + enginePropertiesLogConfigModel := new(watsonxdatav3.EnginePropertiesLogConfig) + enginePropertiesLogConfigModel.Coordinator = map[string]string{"key1": "testString"} + enginePropertiesLogConfigModel.Worker = map[string]string{"key1": "log_config_property_value"} + + // Construct an instance of the EngineProperties model + enginePropertiesModel := new(watsonxdatav3.EngineProperties) + enginePropertiesModel.Catalog = map[string]watsonxdatav3.EnginePropertiesCatalogAdditionalProperties{"key1": *enginePropertiesCatalogAdditionalPropertiesModel} + enginePropertiesModel.Configuration = enginePropertiesConfigurationModel + enginePropertiesModel.EventListener = map[string]string{"key1": "event_listener_property_value"} + enginePropertiesModel.Global = map[string]string{"key1": "global_property_value"} + enginePropertiesModel.JmxExporterConfig = map[string]string{"key1": "jmx_exporter_config_property_value"} + enginePropertiesModel.Jvm = enginePropertiesJvmModel + enginePropertiesModel.LogConfig = enginePropertiesLogConfigModel + enginePropertiesModel.Catalog["foo"] = *enginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the RemoveEnginePropertiesCatalogAdditionalProperties model + removeEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties) + removeEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = []string{"property_name"} + removeEnginePropertiesCatalogAdditionalPropertiesModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesConfiguration model + removeEnginePropertiesConfigurationModel := new(watsonxdatav3.RemoveEnginePropertiesConfiguration) + removeEnginePropertiesConfigurationModel.Coordinator = []string{"property_name"} + removeEnginePropertiesConfigurationModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesJvm model + removeEnginePropertiesJvmModel := new(watsonxdatav3.RemoveEnginePropertiesJvm) + removeEnginePropertiesJvmModel.Coordinator = []string{"property_name"} + removeEnginePropertiesJvmModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesLogConfig model + removeEnginePropertiesLogConfigModel := new(watsonxdatav3.RemoveEnginePropertiesLogConfig) + removeEnginePropertiesLogConfigModel.Coordinator = []string{"property_name"} + removeEnginePropertiesLogConfigModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEngineProperties model + removeEnginePropertiesModel := new(watsonxdatav3.RemoveEngineProperties) + removeEnginePropertiesModel.Catalog = map[string]watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties{"key1": *removeEnginePropertiesCatalogAdditionalPropertiesModel} + removeEnginePropertiesModel.Configuration = removeEnginePropertiesConfigurationModel + removeEnginePropertiesModel.EventListener = []string{"property_name"} + removeEnginePropertiesModel.Global = []string{"property_name"} + removeEnginePropertiesModel.JmxExporterConfig = []string{"testString"} + removeEnginePropertiesModel.Jvm = removeEnginePropertiesJvmModel + removeEnginePropertiesModel.LogConfig = removeEnginePropertiesLogConfigModel + removeEnginePropertiesModel.Catalog["foo"] = *removeEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the PrestoEnginePatch model + prestoEnginePatchModel := new(watsonxdatav3.PrestoEnginePatch) + prestoEnginePatchModel.Description = core.StringPtr("updated description for presto engine") + prestoEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + prestoEnginePatchModel.Properties = enginePropertiesModel + prestoEnginePatchModel.RemoveEngineProperties = removeEnginePropertiesModel + prestoEnginePatchModel.RestartType = core.StringPtr("force") + prestoEnginePatchModel.Tags = []string{"tag1", "tag2"} + prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateIntegrationOptions model - updateIntegrationOptionsModel := new(watsonxdatav2.UpdateIntegrationOptions) - updateIntegrationOptionsModel.IntegrationID = core.StringPtr("testString") - updateIntegrationOptionsModel.IntegrationPatch = integrationPatchModelAsPatch - updateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePrestoEngineOptions model + updatePrestoEngineOptionsModel := new(watsonxdatav3.UpdatePrestoEngineOptions) + updatePrestoEngineOptionsModel.ID = core.StringPtr("testString") + updatePrestoEngineOptionsModel.Body = prestoEnginePatchModelAsPatch + updatePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateIntegrationOptions model with no property values - updateIntegrationOptionsModelNew := new(watsonxdatav2.UpdateIntegrationOptions) + // Construct a second instance of the UpdatePrestoEngineOptions model with no property values + updatePrestoEngineOptionsModelNew := new(watsonxdatav3.UpdatePrestoEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateIntegration(updateIntegrationOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -6890,39 +7622,96 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the IntegrationPatch model - integrationPatchModel := new(watsonxdatav2.IntegrationPatch) - integrationPatchModel.AccessToken = core.StringPtr("uiOO90kklop") - integrationPatchModel.Apikey = core.StringPtr("apikey") - integrationPatchModel.CrossAccountIntegration = core.BoolPtr(false) - integrationPatchModel.EnableDataPolicyWithinWxd = core.BoolPtr(true) - integrationPatchModel.IkcUserAccountID = core.StringPtr("abcdefghijklmnopqrstuvwxyz") - integrationPatchModel.Password = core.StringPtr("password") - integrationPatchModel.Resource = core.StringPtr("resource_name") - integrationPatchModel.State = core.StringPtr("active") - integrationPatchModel.StorageCatalogs = []string{"iceberg_data", "hive_data"} - integrationPatchModel.URL = core.StringPtr("http://abcd.efgh.com:9876/") - integrationPatchModel.Username = core.StringPtr("username") - integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + // Construct an instance of the EnginePropertiesCatalogAdditionalProperties model + enginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.EnginePropertiesCatalogAdditionalProperties) + enginePropertiesCatalogAdditionalPropertiesModel.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + enginePropertiesCatalogAdditionalPropertiesModel.Worker = map[string]interface{}{"anyKey": "anyValue"} + + // Construct an instance of the EnginePropertiesConfiguration model + enginePropertiesConfigurationModel := new(watsonxdatav3.EnginePropertiesConfiguration) + enginePropertiesConfigurationModel.Coordinator = map[string]string{"key1": "configuration_property_value"} + enginePropertiesConfigurationModel.Worker = map[string]string{"key1": "configuration_property_value"} + + // Construct an instance of the EnginePropertiesJvm model + enginePropertiesJvmModel := new(watsonxdatav3.EnginePropertiesJvm) + enginePropertiesJvmModel.Coordinator = map[string]string{"key1": "JVM_property_value"} + enginePropertiesJvmModel.Worker = map[string]string{"key1": "JVM_property_value"} + + // Construct an instance of the EnginePropertiesLogConfig model + enginePropertiesLogConfigModel := new(watsonxdatav3.EnginePropertiesLogConfig) + enginePropertiesLogConfigModel.Coordinator = map[string]string{"key1": "testString"} + enginePropertiesLogConfigModel.Worker = map[string]string{"key1": "log_config_property_value"} + + // Construct an instance of the EngineProperties model + enginePropertiesModel := new(watsonxdatav3.EngineProperties) + enginePropertiesModel.Catalog = map[string]watsonxdatav3.EnginePropertiesCatalogAdditionalProperties{"key1": *enginePropertiesCatalogAdditionalPropertiesModel} + enginePropertiesModel.Configuration = enginePropertiesConfigurationModel + enginePropertiesModel.EventListener = map[string]string{"key1": "event_listener_property_value"} + enginePropertiesModel.Global = map[string]string{"key1": "global_property_value"} + enginePropertiesModel.JmxExporterConfig = map[string]string{"key1": "jmx_exporter_config_property_value"} + enginePropertiesModel.Jvm = enginePropertiesJvmModel + enginePropertiesModel.LogConfig = enginePropertiesLogConfigModel + enginePropertiesModel.Catalog["foo"] = *enginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the RemoveEnginePropertiesCatalogAdditionalProperties model + removeEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties) + removeEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = []string{"property_name"} + removeEnginePropertiesCatalogAdditionalPropertiesModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesConfiguration model + removeEnginePropertiesConfigurationModel := new(watsonxdatav3.RemoveEnginePropertiesConfiguration) + removeEnginePropertiesConfigurationModel.Coordinator = []string{"property_name"} + removeEnginePropertiesConfigurationModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesJvm model + removeEnginePropertiesJvmModel := new(watsonxdatav3.RemoveEnginePropertiesJvm) + removeEnginePropertiesJvmModel.Coordinator = []string{"property_name"} + removeEnginePropertiesJvmModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEnginePropertiesLogConfig model + removeEnginePropertiesLogConfigModel := new(watsonxdatav3.RemoveEnginePropertiesLogConfig) + removeEnginePropertiesLogConfigModel.Coordinator = []string{"property_name"} + removeEnginePropertiesLogConfigModel.Worker = []string{"property_name"} + + // Construct an instance of the RemoveEngineProperties model + removeEnginePropertiesModel := new(watsonxdatav3.RemoveEngineProperties) + removeEnginePropertiesModel.Catalog = map[string]watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties{"key1": *removeEnginePropertiesCatalogAdditionalPropertiesModel} + removeEnginePropertiesModel.Configuration = removeEnginePropertiesConfigurationModel + removeEnginePropertiesModel.EventListener = []string{"property_name"} + removeEnginePropertiesModel.Global = []string{"property_name"} + removeEnginePropertiesModel.JmxExporterConfig = []string{"testString"} + removeEnginePropertiesModel.Jvm = removeEnginePropertiesJvmModel + removeEnginePropertiesModel.LogConfig = removeEnginePropertiesLogConfigModel + removeEnginePropertiesModel.Catalog["foo"] = *removeEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the PrestoEnginePatch model + prestoEnginePatchModel := new(watsonxdatav3.PrestoEnginePatch) + prestoEnginePatchModel.Description = core.StringPtr("updated description for presto engine") + prestoEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + prestoEnginePatchModel.Properties = enginePropertiesModel + prestoEnginePatchModel.RemoveEngineProperties = removeEnginePropertiesModel + prestoEnginePatchModel.RestartType = core.StringPtr("force") + prestoEnginePatchModel.Tags = []string{"tag1", "tag2"} + prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateIntegrationOptions model - updateIntegrationOptionsModel := new(watsonxdatav2.UpdateIntegrationOptions) - updateIntegrationOptionsModel.IntegrationID = core.StringPtr("testString") - updateIntegrationOptionsModel.IntegrationPatch = integrationPatchModelAsPatch - updateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdatePrestoEngineOptions model + updatePrestoEngineOptionsModel := new(watsonxdatav3.UpdatePrestoEngineOptions) + updatePrestoEngineOptionsModel.ID = core.StringPtr("testString") + updatePrestoEngineOptionsModel.Body = prestoEnginePatchModelAsPatch + updatePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -6934,16 +7723,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListDb2Engines(listDb2EnginesOptions *ListDb2EnginesOptions) - Operation response error`, func() { - listDb2EnginesPath := "/db2_engines" + Describe(`PausePrestoEngine(pausePrestoEngineOptions *PausePrestoEngineOptions) - Operation response error`, func() { + pausePrestoEnginePath := "/v3/presto_engines/testString/pause" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDb2EnginesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(pausePrestoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -6951,27 +7740,28 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListDb2Engines with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PausePrestoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListDb2EnginesOptions model - listDb2EnginesOptionsModel := new(watsonxdatav2.ListDb2EnginesOptions) - listDb2EnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDb2EnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PausePrestoEngineOptions model + pausePrestoEngineOptionsModel := new(watsonxdatav3.PausePrestoEngineOptions) + pausePrestoEngineOptionsModel.ID = core.StringPtr("testString") + pausePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pausePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) + result, response, operationErr := watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) + result, response, operationErr = watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -6981,16 +7771,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListDb2Engines(listDb2EnginesOptions *ListDb2EnginesOptions)`, func() { - listDb2EnginesPath := "/db2_engines" + Describe(`PausePrestoEngine(pausePrestoEngineOptions *PausePrestoEngineOptions)`, func() { + pausePrestoEnginePath := "/v3/presto_engines/testString/pause" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDb2EnginesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(pausePrestoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -7000,11 +7790,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"db2_engines": [{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "db2 engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-db2-01-db2-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}]}`) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke ListDb2Engines successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PausePrestoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -7012,21 +7802,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListDb2EnginesOptions model - listDb2EnginesOptionsModel := new(watsonxdatav2.ListDb2EnginesOptions) - listDb2EnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDb2EnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PausePrestoEngineOptions model + pausePrestoEngineOptionsModel := new(watsonxdatav3.PausePrestoEngineOptions) + pausePrestoEngineOptionsModel.ID = core.StringPtr("testString") + pausePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pausePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListDb2EnginesWithContext(ctx, listDb2EnginesOptionsModel) + _, _, operationErr := watsonxDataService.PausePrestoEngineWithContext(ctx, pausePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) + result, response, operationErr := watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -7034,7 +7825,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListDb2EnginesWithContext(ctx, listDb2EnginesOptionsModel) + _, _, operationErr = watsonxDataService.PausePrestoEngineWithContext(ctx, pausePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -7048,19 +7839,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listDb2EnginesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(pausePrestoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"db2_engines": [{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "db2 engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-db2-01-db2-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}]}`) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke ListDb2Engines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PausePrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -7068,43 +7859,52 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListDb2Engines(nil) + result, response, operationErr := watsonxDataService.PausePrestoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListDb2EnginesOptions model - listDb2EnginesOptionsModel := new(watsonxdatav2.ListDb2EnginesOptions) - listDb2EnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDb2EnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PausePrestoEngineOptions model + pausePrestoEngineOptionsModel := new(watsonxdatav3.PausePrestoEngineOptions) + pausePrestoEngineOptionsModel.ID = core.StringPtr("testString") + pausePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pausePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) + result, response, operationErr = watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListDb2Engines with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PausePrestoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListDb2EnginesOptions model - listDb2EnginesOptionsModel := new(watsonxdatav2.ListDb2EnginesOptions) - listDb2EnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDb2EnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PausePrestoEngineOptions model + pausePrestoEngineOptionsModel := new(watsonxdatav3.PausePrestoEngineOptions) + pausePrestoEngineOptionsModel.ID = core.StringPtr("testString") + pausePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pausePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) + result, response, operationErr := watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the PausePrestoEngineOptions model with no property values + pausePrestoEngineOptionsModelNew := new(watsonxdatav3.PausePrestoEngineOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -7119,21 +7919,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListDb2Engines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PausePrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListDb2EnginesOptions model - listDb2EnginesOptionsModel := new(watsonxdatav2.ListDb2EnginesOptions) - listDb2EnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listDb2EnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PausePrestoEngineOptions model + pausePrestoEngineOptionsModel := new(watsonxdatav3.PausePrestoEngineOptions) + pausePrestoEngineOptionsModel.ID = core.StringPtr("testString") + pausePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pausePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) + result, response, operationErr := watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -7145,53 +7946,50 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateDb2Engine(createDb2EngineOptions *CreateDb2EngineOptions) - Operation response error`, func() { - createDb2EnginePath := "/db2_engines" + Describe(`RunExplainStatement(runExplainStatementOptions *RunExplainStatementOptions) - Operation response error`, func() { + runExplainStatementPath := "/v3/presto_engines/testString/query_explain" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDb2EnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(runExplainStatementPath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateDb2Engine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunExplainStatement with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the Db2EngineDetailsBody model - db2EngineDetailsBodyModel := new(watsonxdatav2.Db2EngineDetailsBody) - db2EngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - - // Construct an instance of the CreateDb2EngineOptions model - createDb2EngineOptionsModel := new(watsonxdatav2.CreateDb2EngineOptions) - createDb2EngineOptionsModel.Origin = core.StringPtr("external") - createDb2EngineOptionsModel.Description = core.StringPtr("db2 engine description") - createDb2EngineOptionsModel.EngineDetails = db2EngineDetailsBodyModel - createDb2EngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createDb2EngineOptionsModel.Tags = []string{"tag1", "tag2"} - createDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunExplainStatementOptions model + runExplainStatementOptionsModel := new(watsonxdatav3.RunExplainStatementOptions) + runExplainStatementOptionsModel.ID = core.StringPtr("testString") + runExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runExplainStatementOptionsModel.Catalog = core.StringPtr("catalog_name") + runExplainStatementOptionsModel.Format = core.StringPtr("json") + runExplainStatementOptionsModel.Schema = core.StringPtr("schema_name") + runExplainStatementOptionsModel.Type = core.StringPtr("io") + runExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) + result, response, operationErr := watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) + result, response, operationErr = watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -7201,15 +7999,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateDb2Engine(createDb2EngineOptions *CreateDb2EngineOptions)`, func() { - createDb2EnginePath := "/db2_engines" + Describe(`RunExplainStatement(runExplainStatementOptions *RunExplainStatementOptions)`, func() { + runExplainStatementPath := "/v3/presto_engines/testString/query_explain" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDb2EnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(runExplainStatementPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -7235,12 +8033,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "db2 engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-db2-01-db2-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "result": "Result"}`) })) }) - It(`Invoke CreateDb2Engine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunExplainStatement successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -7248,30 +8046,27 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the Db2EngineDetailsBody model - db2EngineDetailsBodyModel := new(watsonxdatav2.Db2EngineDetailsBody) - db2EngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - - // Construct an instance of the CreateDb2EngineOptions model - createDb2EngineOptionsModel := new(watsonxdatav2.CreateDb2EngineOptions) - createDb2EngineOptionsModel.Origin = core.StringPtr("external") - createDb2EngineOptionsModel.Description = core.StringPtr("db2 engine description") - createDb2EngineOptionsModel.EngineDetails = db2EngineDetailsBodyModel - createDb2EngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createDb2EngineOptionsModel.Tags = []string{"tag1", "tag2"} - createDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunExplainStatementOptions model + runExplainStatementOptionsModel := new(watsonxdatav3.RunExplainStatementOptions) + runExplainStatementOptionsModel.ID = core.StringPtr("testString") + runExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runExplainStatementOptionsModel.Catalog = core.StringPtr("catalog_name") + runExplainStatementOptionsModel.Format = core.StringPtr("json") + runExplainStatementOptionsModel.Schema = core.StringPtr("schema_name") + runExplainStatementOptionsModel.Type = core.StringPtr("io") + runExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateDb2EngineWithContext(ctx, createDb2EngineOptionsModel) + _, _, operationErr := watsonxDataService.RunExplainStatementWithContext(ctx, runExplainStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) + result, response, operationErr := watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -7279,7 +8074,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateDb2EngineWithContext(ctx, createDb2EngineOptionsModel) + _, _, operationErr = watsonxDataService.RunExplainStatementWithContext(ctx, runExplainStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -7293,7 +8088,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createDb2EnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(runExplainStatementPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -7316,12 +8111,12 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "db2 engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-db2-01-db2-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "result": "Result"}`) })) }) - It(`Invoke CreateDb2Engine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunExplainStatement successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -7329,65 +8124,59 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateDb2Engine(nil) + result, response, operationErr := watsonxDataService.RunExplainStatement(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the Db2EngineDetailsBody model - db2EngineDetailsBodyModel := new(watsonxdatav2.Db2EngineDetailsBody) - db2EngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - - // Construct an instance of the CreateDb2EngineOptions model - createDb2EngineOptionsModel := new(watsonxdatav2.CreateDb2EngineOptions) - createDb2EngineOptionsModel.Origin = core.StringPtr("external") - createDb2EngineOptionsModel.Description = core.StringPtr("db2 engine description") - createDb2EngineOptionsModel.EngineDetails = db2EngineDetailsBodyModel - createDb2EngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createDb2EngineOptionsModel.Tags = []string{"tag1", "tag2"} - createDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunExplainStatementOptions model + runExplainStatementOptionsModel := new(watsonxdatav3.RunExplainStatementOptions) + runExplainStatementOptionsModel.ID = core.StringPtr("testString") + runExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runExplainStatementOptionsModel.Catalog = core.StringPtr("catalog_name") + runExplainStatementOptionsModel.Format = core.StringPtr("json") + runExplainStatementOptionsModel.Schema = core.StringPtr("schema_name") + runExplainStatementOptionsModel.Type = core.StringPtr("io") + runExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) + result, response, operationErr = watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateDb2Engine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunExplainStatement with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the Db2EngineDetailsBody model - db2EngineDetailsBodyModel := new(watsonxdatav2.Db2EngineDetailsBody) - db2EngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - - // Construct an instance of the CreateDb2EngineOptions model - createDb2EngineOptionsModel := new(watsonxdatav2.CreateDb2EngineOptions) - createDb2EngineOptionsModel.Origin = core.StringPtr("external") - createDb2EngineOptionsModel.Description = core.StringPtr("db2 engine description") - createDb2EngineOptionsModel.EngineDetails = db2EngineDetailsBodyModel - createDb2EngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createDb2EngineOptionsModel.Tags = []string{"tag1", "tag2"} - createDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunExplainStatementOptions model + runExplainStatementOptionsModel := new(watsonxdatav3.RunExplainStatementOptions) + runExplainStatementOptionsModel.ID = core.StringPtr("testString") + runExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runExplainStatementOptionsModel.Catalog = core.StringPtr("catalog_name") + runExplainStatementOptionsModel.Format = core.StringPtr("json") + runExplainStatementOptionsModel.Schema = core.StringPtr("schema_name") + runExplainStatementOptionsModel.Type = core.StringPtr("io") + runExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) + result, response, operationErr := watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateDb2EngineOptions model with no property values - createDb2EngineOptionsModelNew := new(watsonxdatav2.CreateDb2EngineOptions) + // Construct a second instance of the RunExplainStatementOptions model with no property values + runExplainStatementOptionsModelNew := new(watsonxdatav3.RunExplainStatementOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModelNew) + result, response, operationErr = watsonxDataService.RunExplainStatement(runExplainStatementOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -7402,33 +8191,30 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateDb2Engine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunExplainStatement successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the Db2EngineDetailsBody model - db2EngineDetailsBodyModel := new(watsonxdatav2.Db2EngineDetailsBody) - db2EngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - - // Construct an instance of the CreateDb2EngineOptions model - createDb2EngineOptionsModel := new(watsonxdatav2.CreateDb2EngineOptions) - createDb2EngineOptionsModel.Origin = core.StringPtr("external") - createDb2EngineOptionsModel.Description = core.StringPtr("db2 engine description") - createDb2EngineOptionsModel.EngineDetails = db2EngineDetailsBodyModel - createDb2EngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createDb2EngineOptionsModel.Tags = []string{"tag1", "tag2"} - createDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunExplainStatementOptions model + runExplainStatementOptionsModel := new(watsonxdatav3.RunExplainStatementOptions) + runExplainStatementOptionsModel.ID = core.StringPtr("testString") + runExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runExplainStatementOptionsModel.Catalog = core.StringPtr("catalog_name") + runExplainStatementOptionsModel.Format = core.StringPtr("json") + runExplainStatementOptionsModel.Schema = core.StringPtr("schema_name") + runExplainStatementOptionsModel.Type = core.StringPtr("io") + runExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) + result, response, operationErr := watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -7440,145 +8226,66 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteDb2Engine(deleteDb2EngineOptions *DeleteDb2EngineOptions)`, func() { - deleteDb2EnginePath := "/db2_engines/testString" - Context(`Using mock server endpoint`, func() { + Describe(`RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptions *RunExplainAnalyzeStatementOptions) - Operation response error`, func() { + runExplainAnalyzeStatementPath := "/v3/presto_engines/testString/query_explain_analyze" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteDb2EnginePath)) - Expect(req.Method).To(Equal("DELETE")) - + Expect(req.URL.EscapedPath()).To(Equal(runExplainAnalyzeStatementPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(204) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteDb2Engine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunExplainAnalyzeStatement with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteDb2Engine(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteDb2EngineOptions model - deleteDb2EngineOptionsModel := new(watsonxdatav2.DeleteDb2EngineOptions) - deleteDb2EngineOptionsModel.EngineID = core.StringPtr("testString") - deleteDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunExplainAnalyzeStatementOptions model + runExplainAnalyzeStatementOptionsModel := new(watsonxdatav3.RunExplainAnalyzeStatementOptions) + runExplainAnalyzeStatementOptionsModel.ID = core.StringPtr("testString") + runExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) + runExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteDb2Engine(deleteDb2EngineOptionsModel) - Expect(operationErr).To(BeNil()) + // Enable retries and test again + watsonxDataService.EnableRetries(0, 0) + result, response, operationErr = watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) + Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteDb2Engine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeleteDb2EngineOptions model - deleteDb2EngineOptionsModel := new(watsonxdatav2.DeleteDb2EngineOptions) - deleteDb2EngineOptionsModel.EngineID = core.StringPtr("testString") - deleteDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteDb2Engine(deleteDb2EngineOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteDb2EngineOptions model with no property values - deleteDb2EngineOptionsModelNew := new(watsonxdatav2.DeleteDb2EngineOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteDb2Engine(deleteDb2EngineOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateDb2Engine(updateDb2EngineOptions *UpdateDb2EngineOptions) - Operation response error`, func() { - updateDb2EnginePath := "/db2_engines/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDb2EnginePath)) - Expect(req.Method).To(Equal("PATCH")) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke UpdateDb2Engine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the Db2EnginePatch model - db2EnginePatchModel := new(watsonxdatav2.Db2EnginePatch) - db2EnginePatchModel.Description = core.StringPtr("db2 engine updated description") - db2EnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - db2EnginePatchModel.Tags = []string{"tag1", "tag2"} - db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDb2EngineOptions model - updateDb2EngineOptionsModel := new(watsonxdatav2.UpdateDb2EngineOptions) - updateDb2EngineOptionsModel.EngineID = core.StringPtr("testString") - updateDb2EngineOptionsModel.Body = db2EnginePatchModelAsPatch - updateDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`UpdateDb2Engine(updateDb2EngineOptions *UpdateDb2EngineOptions)`, func() { - updateDb2EnginePath := "/db2_engines/testString" + Describe(`RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptions *RunExplainAnalyzeStatementOptions)`, func() { + runExplainAnalyzeStatementPath := "/v3/presto_engines/testString/query_explain_analyze" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDb2EnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(runExplainAnalyzeStatementPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -7604,11 +8311,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "db2 engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-db2-01-db2-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}`) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "result": "Result"}`) })) }) - It(`Invoke UpdateDb2Engine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunExplainAnalyzeStatement successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -7616,31 +8323,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the Db2EnginePatch model - db2EnginePatchModel := new(watsonxdatav2.Db2EnginePatch) - db2EnginePatchModel.Description = core.StringPtr("db2 engine updated description") - db2EnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - db2EnginePatchModel.Tags = []string{"tag1", "tag2"} - db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDb2EngineOptions model - updateDb2EngineOptionsModel := new(watsonxdatav2.UpdateDb2EngineOptions) - updateDb2EngineOptionsModel.EngineID = core.StringPtr("testString") - updateDb2EngineOptionsModel.Body = db2EnginePatchModelAsPatch - updateDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunExplainAnalyzeStatementOptions model + runExplainAnalyzeStatementOptionsModel := new(watsonxdatav3.RunExplainAnalyzeStatementOptions) + runExplainAnalyzeStatementOptionsModel.ID = core.StringPtr("testString") + runExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) + runExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateDb2EngineWithContext(ctx, updateDb2EngineOptionsModel) + _, _, operationErr := watsonxDataService.RunExplainAnalyzeStatementWithContext(ctx, runExplainAnalyzeStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) + result, response, operationErr := watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -7648,7 +8348,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateDb2EngineWithContext(ctx, updateDb2EngineOptionsModel) + _, _, operationErr = watsonxDataService.RunExplainAnalyzeStatementWithContext(ctx, runExplainAnalyzeStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -7662,8 +8362,8 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateDb2EnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(runExplainAnalyzeStatementPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -7686,11 +8386,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "db2 engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-db2-01-db2-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}`) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "result": "Result"}`) })) }) - It(`Invoke UpdateDb2Engine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunExplainAnalyzeStatement successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -7698,67 +8398,53 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateDb2Engine(nil) + result, response, operationErr := watsonxDataService.RunExplainAnalyzeStatement(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the Db2EnginePatch model - db2EnginePatchModel := new(watsonxdatav2.Db2EnginePatch) - db2EnginePatchModel.Description = core.StringPtr("db2 engine updated description") - db2EnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - db2EnginePatchModel.Tags = []string{"tag1", "tag2"} - db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDb2EngineOptions model - updateDb2EngineOptionsModel := new(watsonxdatav2.UpdateDb2EngineOptions) - updateDb2EngineOptionsModel.EngineID = core.StringPtr("testString") - updateDb2EngineOptionsModel.Body = db2EnginePatchModelAsPatch - updateDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunExplainAnalyzeStatementOptions model + runExplainAnalyzeStatementOptionsModel := new(watsonxdatav3.RunExplainAnalyzeStatementOptions) + runExplainAnalyzeStatementOptionsModel.ID = core.StringPtr("testString") + runExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) + runExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) + result, response, operationErr = watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateDb2Engine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunExplainAnalyzeStatement with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the Db2EnginePatch model - db2EnginePatchModel := new(watsonxdatav2.Db2EnginePatch) - db2EnginePatchModel.Description = core.StringPtr("db2 engine updated description") - db2EnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - db2EnginePatchModel.Tags = []string{"tag1", "tag2"} - db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDb2EngineOptions model - updateDb2EngineOptionsModel := new(watsonxdatav2.UpdateDb2EngineOptions) - updateDb2EngineOptionsModel.EngineID = core.StringPtr("testString") - updateDb2EngineOptionsModel.Body = db2EnginePatchModelAsPatch - updateDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunExplainAnalyzeStatementOptions model + runExplainAnalyzeStatementOptionsModel := new(watsonxdatav3.RunExplainAnalyzeStatementOptions) + runExplainAnalyzeStatementOptionsModel.ID = core.StringPtr("testString") + runExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) + runExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) + result, response, operationErr := watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateDb2EngineOptions model with no property values - updateDb2EngineOptionsModelNew := new(watsonxdatav2.UpdateDb2EngineOptions) + // Construct a second instance of the RunExplainAnalyzeStatementOptions model with no property values + runExplainAnalyzeStatementOptionsModelNew := new(watsonxdatav3.RunExplainAnalyzeStatementOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModelNew) + result, response, operationErr = watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -7776,31 +8462,24 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateDb2Engine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunExplainAnalyzeStatement successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the Db2EnginePatch model - db2EnginePatchModel := new(watsonxdatav2.Db2EnginePatch) - db2EnginePatchModel.Description = core.StringPtr("db2 engine updated description") - db2EnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - db2EnginePatchModel.Tags = []string{"tag1", "tag2"} - db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateDb2EngineOptions model - updateDb2EngineOptionsModel := new(watsonxdatav2.UpdateDb2EngineOptions) - updateDb2EngineOptionsModel.EngineID = core.StringPtr("testString") - updateDb2EngineOptionsModel.Body = db2EnginePatchModelAsPatch - updateDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunExplainAnalyzeStatementOptions model + runExplainAnalyzeStatementOptionsModel := new(watsonxdatav3.RunExplainAnalyzeStatementOptions) + runExplainAnalyzeStatementOptionsModel.ID = core.StringPtr("testString") + runExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) + runExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) + result, response, operationErr := watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -7812,16 +8491,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListNetezzaEngines(listNetezzaEnginesOptions *ListNetezzaEnginesOptions) - Operation response error`, func() { - listNetezzaEnginesPath := "/netezza_engines" + Describe(`RestartPrestoEngine(restartPrestoEngineOptions *RestartPrestoEngineOptions) - Operation response error`, func() { + restartPrestoEnginePath := "/v3/presto_engines/testString/restart" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listNetezzaEnginesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(restartPrestoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -7829,27 +8508,28 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListNetezzaEngines with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RestartPrestoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListNetezzaEnginesOptions model - listNetezzaEnginesOptionsModel := new(watsonxdatav2.ListNetezzaEnginesOptions) - listNetezzaEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listNetezzaEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RestartPrestoEngineOptions model + restartPrestoEngineOptionsModel := new(watsonxdatav3.RestartPrestoEngineOptions) + restartPrestoEngineOptionsModel.ID = core.StringPtr("testString") + restartPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + restartPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) + result, response, operationErr := watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) + result, response, operationErr = watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -7859,16 +8539,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListNetezzaEngines(listNetezzaEnginesOptions *ListNetezzaEnginesOptions)`, func() { - listNetezzaEnginesPath := "/netezza_engines" + Describe(`RestartPrestoEngine(restartPrestoEngineOptions *RestartPrestoEngineOptions)`, func() { + restartPrestoEnginePath := "/v3/presto_engines/testString/restart" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listNetezzaEnginesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(restartPrestoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -7878,11 +8558,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"netezza_engines": [{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "netezza engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-netezza-01-netezza-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}]}`) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke ListNetezzaEngines successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RestartPrestoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -7890,21 +8570,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListNetezzaEnginesOptions model - listNetezzaEnginesOptionsModel := new(watsonxdatav2.ListNetezzaEnginesOptions) - listNetezzaEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listNetezzaEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RestartPrestoEngineOptions model + restartPrestoEngineOptionsModel := new(watsonxdatav3.RestartPrestoEngineOptions) + restartPrestoEngineOptionsModel.ID = core.StringPtr("testString") + restartPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + restartPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListNetezzaEnginesWithContext(ctx, listNetezzaEnginesOptionsModel) + _, _, operationErr := watsonxDataService.RestartPrestoEngineWithContext(ctx, restartPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) + result, response, operationErr := watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -7912,7 +8593,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListNetezzaEnginesWithContext(ctx, listNetezzaEnginesOptionsModel) + _, _, operationErr = watsonxDataService.RestartPrestoEngineWithContext(ctx, restartPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -7926,19 +8607,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listNetezzaEnginesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(restartPrestoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"netezza_engines": [{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "netezza engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-netezza-01-netezza-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}]}`) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke ListNetezzaEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RestartPrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -7946,43 +8627,52 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListNetezzaEngines(nil) + result, response, operationErr := watsonxDataService.RestartPrestoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListNetezzaEnginesOptions model - listNetezzaEnginesOptionsModel := new(watsonxdatav2.ListNetezzaEnginesOptions) - listNetezzaEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listNetezzaEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RestartPrestoEngineOptions model + restartPrestoEngineOptionsModel := new(watsonxdatav3.RestartPrestoEngineOptions) + restartPrestoEngineOptionsModel.ID = core.StringPtr("testString") + restartPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + restartPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) + result, response, operationErr = watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListNetezzaEngines with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RestartPrestoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListNetezzaEnginesOptions model - listNetezzaEnginesOptionsModel := new(watsonxdatav2.ListNetezzaEnginesOptions) - listNetezzaEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listNetezzaEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RestartPrestoEngineOptions model + restartPrestoEngineOptionsModel := new(watsonxdatav3.RestartPrestoEngineOptions) + restartPrestoEngineOptionsModel.ID = core.StringPtr("testString") + restartPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + restartPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) + result, response, operationErr := watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the RestartPrestoEngineOptions model with no property values + restartPrestoEngineOptionsModelNew := new(watsonxdatav3.RestartPrestoEngineOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -7997,21 +8687,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListNetezzaEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RestartPrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListNetezzaEnginesOptions model - listNetezzaEnginesOptionsModel := new(watsonxdatav2.ListNetezzaEnginesOptions) - listNetezzaEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listNetezzaEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RestartPrestoEngineOptions model + restartPrestoEngineOptionsModel := new(watsonxdatav3.RestartPrestoEngineOptions) + restartPrestoEngineOptionsModel.ID = core.StringPtr("testString") + restartPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + restartPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) + result, response, operationErr := watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -8023,53 +8714,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateNetezzaEngine(createNetezzaEngineOptions *CreateNetezzaEngineOptions) - Operation response error`, func() { - createNetezzaEnginePath := "/netezza_engines" + Describe(`ResumePrestoEngine(resumePrestoEngineOptions *ResumePrestoEngineOptions) - Operation response error`, func() { + resumePrestoEnginePath := "/v3/presto_engines/testString/resume" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createNetezzaEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(resumePrestoEnginePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateNetezzaEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumePrestoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NetezzaEngineDetailsBody model - netezzaEngineDetailsBodyModel := new(watsonxdatav2.NetezzaEngineDetailsBody) - netezzaEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - - // Construct an instance of the CreateNetezzaEngineOptions model - createNetezzaEngineOptionsModel := new(watsonxdatav2.CreateNetezzaEngineOptions) - createNetezzaEngineOptionsModel.Origin = core.StringPtr("external") - createNetezzaEngineOptionsModel.Description = core.StringPtr("netezza engine description") - createNetezzaEngineOptionsModel.EngineDetails = netezzaEngineDetailsBodyModel - createNetezzaEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createNetezzaEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumePrestoEngineOptions model + resumePrestoEngineOptionsModel := new(watsonxdatav3.ResumePrestoEngineOptions) + resumePrestoEngineOptionsModel.ID = core.StringPtr("testString") + resumePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) + result, response, operationErr := watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) + result, response, operationErr = watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -8079,33 +8762,17 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateNetezzaEngine(createNetezzaEngineOptions *CreateNetezzaEngineOptions)`, func() { - createNetezzaEnginePath := "/netezza_engines" + Describe(`ResumePrestoEngine(resumePrestoEngineOptions *ResumePrestoEngineOptions)`, func() { + resumePrestoEnginePath := "/v3/presto_engines/testString/resume" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createNetezzaEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(resumePrestoEnginePath)) Expect(req.Method).To(Equal("POST")) - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Sleep a short time to support a timeout test @@ -8113,12 +8780,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "netezza engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-netezza-01-netezza-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke CreateNetezzaEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumePrestoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -8126,30 +8793,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the NetezzaEngineDetailsBody model - netezzaEngineDetailsBodyModel := new(watsonxdatav2.NetezzaEngineDetailsBody) - netezzaEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - - // Construct an instance of the CreateNetezzaEngineOptions model - createNetezzaEngineOptionsModel := new(watsonxdatav2.CreateNetezzaEngineOptions) - createNetezzaEngineOptionsModel.Origin = core.StringPtr("external") - createNetezzaEngineOptionsModel.Description = core.StringPtr("netezza engine description") - createNetezzaEngineOptionsModel.EngineDetails = netezzaEngineDetailsBodyModel - createNetezzaEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createNetezzaEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumePrestoEngineOptions model + resumePrestoEngineOptionsModel := new(watsonxdatav3.ResumePrestoEngineOptions) + resumePrestoEngineOptionsModel.ID = core.StringPtr("testString") + resumePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateNetezzaEngineWithContext(ctx, createNetezzaEngineOptionsModel) + _, _, operationErr := watsonxDataService.ResumePrestoEngineWithContext(ctx, resumePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) + result, response, operationErr := watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -8157,7 +8816,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateNetezzaEngineWithContext(ctx, createNetezzaEngineOptionsModel) + _, _, operationErr = watsonxDataService.ResumePrestoEngineWithContext(ctx, resumePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -8171,35 +8830,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createNetezzaEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(resumePrestoEnginePath)) Expect(req.Method).To(Equal("POST")) - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "netezza engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-netezza-01-netezza-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke CreateNetezzaEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumePrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -8207,65 +8850,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateNetezzaEngine(nil) + result, response, operationErr := watsonxDataService.ResumePrestoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the NetezzaEngineDetailsBody model - netezzaEngineDetailsBodyModel := new(watsonxdatav2.NetezzaEngineDetailsBody) - netezzaEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - - // Construct an instance of the CreateNetezzaEngineOptions model - createNetezzaEngineOptionsModel := new(watsonxdatav2.CreateNetezzaEngineOptions) - createNetezzaEngineOptionsModel.Origin = core.StringPtr("external") - createNetezzaEngineOptionsModel.Description = core.StringPtr("netezza engine description") - createNetezzaEngineOptionsModel.EngineDetails = netezzaEngineDetailsBodyModel - createNetezzaEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createNetezzaEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumePrestoEngineOptions model + resumePrestoEngineOptionsModel := new(watsonxdatav3.ResumePrestoEngineOptions) + resumePrestoEngineOptionsModel.ID = core.StringPtr("testString") + resumePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) + result, response, operationErr = watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateNetezzaEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumePrestoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NetezzaEngineDetailsBody model - netezzaEngineDetailsBodyModel := new(watsonxdatav2.NetezzaEngineDetailsBody) - netezzaEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - - // Construct an instance of the CreateNetezzaEngineOptions model - createNetezzaEngineOptionsModel := new(watsonxdatav2.CreateNetezzaEngineOptions) - createNetezzaEngineOptionsModel.Origin = core.StringPtr("external") - createNetezzaEngineOptionsModel.Description = core.StringPtr("netezza engine description") - createNetezzaEngineOptionsModel.EngineDetails = netezzaEngineDetailsBodyModel - createNetezzaEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createNetezzaEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumePrestoEngineOptions model + resumePrestoEngineOptionsModel := new(watsonxdatav3.ResumePrestoEngineOptions) + resumePrestoEngineOptionsModel.ID = core.StringPtr("testString") + resumePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) + result, response, operationErr := watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateNetezzaEngineOptions model with no property values - createNetezzaEngineOptionsModelNew := new(watsonxdatav2.CreateNetezzaEngineOptions) + // Construct a second instance of the ResumePrestoEngineOptions model with no property values + resumePrestoEngineOptionsModelNew := new(watsonxdatav3.ResumePrestoEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -8280,33 +8907,25 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateNetezzaEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumePrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NetezzaEngineDetailsBody model - netezzaEngineDetailsBodyModel := new(watsonxdatav2.NetezzaEngineDetailsBody) - netezzaEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - - // Construct an instance of the CreateNetezzaEngineOptions model - createNetezzaEngineOptionsModel := new(watsonxdatav2.CreateNetezzaEngineOptions) - createNetezzaEngineOptionsModel.Origin = core.StringPtr("external") - createNetezzaEngineOptionsModel.Description = core.StringPtr("netezza engine description") - createNetezzaEngineOptionsModel.EngineDetails = netezzaEngineDetailsBodyModel - createNetezzaEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createNetezzaEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumePrestoEngineOptions model + resumePrestoEngineOptionsModel := new(watsonxdatav3.ResumePrestoEngineOptions) + resumePrestoEngineOptionsModel.ID = core.StringPtr("testString") + resumePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) + result, response, operationErr := watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -8318,126 +8937,52 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteNetezzaEngine(deleteNetezzaEngineOptions *DeleteNetezzaEngineOptions)`, func() { - deleteNetezzaEnginePath := "/netezza_engines/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteNetezzaEnginePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteNetezzaEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteNetezzaEngine(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteNetezzaEngineOptions model - deleteNetezzaEngineOptionsModel := new(watsonxdatav2.DeleteNetezzaEngineOptions) - deleteNetezzaEngineOptionsModel.EngineID = core.StringPtr("testString") - deleteNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteNetezzaEngine(deleteNetezzaEngineOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteNetezzaEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeleteNetezzaEngineOptions model - deleteNetezzaEngineOptionsModel := new(watsonxdatav2.DeleteNetezzaEngineOptions) - deleteNetezzaEngineOptionsModel.EngineID = core.StringPtr("testString") - deleteNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteNetezzaEngine(deleteNetezzaEngineOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteNetezzaEngineOptions model with no property values - deleteNetezzaEngineOptionsModelNew := new(watsonxdatav2.DeleteNetezzaEngineOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteNetezzaEngine(deleteNetezzaEngineOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateNetezzaEngine(updateNetezzaEngineOptions *UpdateNetezzaEngineOptions) - Operation response error`, func() { - updateNetezzaEnginePath := "/netezza_engines/testString" + Describe(`ScalePrestoEngine(scalePrestoEngineOptions *ScalePrestoEngineOptions) - Operation response error`, func() { + scalePrestoEnginePath := "/v3/presto_engines/testString/scale" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateNetezzaEnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(scalePrestoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateNetezzaEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScalePrestoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NetezzaEnginePatch model - netezzaEnginePatchModel := new(watsonxdatav2.NetezzaEnginePatch) - netezzaEnginePatchModel.Description = core.StringPtr("netezza engine updated description") - netezzaEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - netezzaEnginePatchModel.Tags = []string{"tag1", "tag2"} - netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) - // Construct an instance of the UpdateNetezzaEngineOptions model - updateNetezzaEngineOptionsModel := new(watsonxdatav2.UpdateNetezzaEngineOptions) - updateNetezzaEngineOptionsModel.EngineID = core.StringPtr("testString") - updateNetezzaEngineOptionsModel.Body = netezzaEnginePatchModelAsPatch - updateNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ScalePrestoEngineOptions model + scalePrestoEngineOptionsModel := new(watsonxdatav3.ScalePrestoEngineOptions) + scalePrestoEngineOptionsModel.ID = core.StringPtr("testString") + scalePrestoEngineOptionsModel.Coordinator = nodeDescriptionModel + scalePrestoEngineOptionsModel.Worker = nodeDescriptionModel + scalePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scalePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) + result, response, operationErr = watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -8447,16 +8992,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateNetezzaEngine(updateNetezzaEngineOptions *UpdateNetezzaEngineOptions)`, func() { - updateNetezzaEnginePath := "/netezza_engines/testString" + Describe(`ScalePrestoEngine(scalePrestoEngineOptions *ScalePrestoEngineOptions)`, func() { + scalePrestoEnginePath := "/v3/presto_engines/testString/scale" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateNetezzaEnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(scalePrestoEnginePath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -8481,12 +9026,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "netezza engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-netezza-01-netezza-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke UpdateNetezzaEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScalePrestoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -8494,31 +9039,29 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the NetezzaEnginePatch model - netezzaEnginePatchModel := new(watsonxdatav2.NetezzaEnginePatch) - netezzaEnginePatchModel.Description = core.StringPtr("netezza engine updated description") - netezzaEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - netezzaEnginePatchModel.Tags = []string{"tag1", "tag2"} - netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) - // Construct an instance of the UpdateNetezzaEngineOptions model - updateNetezzaEngineOptionsModel := new(watsonxdatav2.UpdateNetezzaEngineOptions) - updateNetezzaEngineOptionsModel.EngineID = core.StringPtr("testString") - updateNetezzaEngineOptionsModel.Body = netezzaEnginePatchModelAsPatch - updateNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ScalePrestoEngineOptions model + scalePrestoEngineOptionsModel := new(watsonxdatav3.ScalePrestoEngineOptions) + scalePrestoEngineOptionsModel.ID = core.StringPtr("testString") + scalePrestoEngineOptionsModel.Coordinator = nodeDescriptionModel + scalePrestoEngineOptionsModel.Worker = nodeDescriptionModel + scalePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scalePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateNetezzaEngineWithContext(ctx, updateNetezzaEngineOptionsModel) + _, _, operationErr := watsonxDataService.ScalePrestoEngineWithContext(ctx, scalePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -8526,7 +9069,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateNetezzaEngineWithContext(ctx, updateNetezzaEngineOptionsModel) + _, _, operationErr = watsonxDataService.ScalePrestoEngineWithContext(ctx, scalePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -8540,8 +9083,8 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateNetezzaEnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(scalePrestoEnginePath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -8563,12 +9106,12 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "netezza engine for running sql queries", "engine_details": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "host_name": "xyz-netezza-01-netezza-svc", "origin": "ibm", "port": 4, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke UpdateNetezzaEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScalePrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -8576,67 +9119,63 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateNetezzaEngine(nil) + result, response, operationErr := watsonxDataService.ScalePrestoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the NetezzaEnginePatch model - netezzaEnginePatchModel := new(watsonxdatav2.NetezzaEnginePatch) - netezzaEnginePatchModel.Description = core.StringPtr("netezza engine updated description") - netezzaEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - netezzaEnginePatchModel.Tags = []string{"tag1", "tag2"} - netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) - // Construct an instance of the UpdateNetezzaEngineOptions model - updateNetezzaEngineOptionsModel := new(watsonxdatav2.UpdateNetezzaEngineOptions) - updateNetezzaEngineOptionsModel.EngineID = core.StringPtr("testString") - updateNetezzaEngineOptionsModel.Body = netezzaEnginePatchModelAsPatch - updateNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ScalePrestoEngineOptions model + scalePrestoEngineOptionsModel := new(watsonxdatav3.ScalePrestoEngineOptions) + scalePrestoEngineOptionsModel.ID = core.StringPtr("testString") + scalePrestoEngineOptionsModel.Coordinator = nodeDescriptionModel + scalePrestoEngineOptionsModel.Worker = nodeDescriptionModel + scalePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scalePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) + result, response, operationErr = watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateNetezzaEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScalePrestoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NetezzaEnginePatch model - netezzaEnginePatchModel := new(watsonxdatav2.NetezzaEnginePatch) - netezzaEnginePatchModel.Description = core.StringPtr("netezza engine updated description") - netezzaEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - netezzaEnginePatchModel.Tags = []string{"tag1", "tag2"} - netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) - // Construct an instance of the UpdateNetezzaEngineOptions model - updateNetezzaEngineOptionsModel := new(watsonxdatav2.UpdateNetezzaEngineOptions) - updateNetezzaEngineOptionsModel.EngineID = core.StringPtr("testString") - updateNetezzaEngineOptionsModel.Body = netezzaEnginePatchModelAsPatch - updateNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ScalePrestoEngineOptions model + scalePrestoEngineOptionsModel := new(watsonxdatav3.ScalePrestoEngineOptions) + scalePrestoEngineOptionsModel.ID = core.StringPtr("testString") + scalePrestoEngineOptionsModel.Coordinator = nodeDescriptionModel + scalePrestoEngineOptionsModel.Worker = nodeDescriptionModel + scalePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scalePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateNetezzaEngineOptions model with no property values - updateNetezzaEngineOptionsModelNew := new(watsonxdatav2.UpdateNetezzaEngineOptions) + // Construct a second instance of the ScalePrestoEngineOptions model with no property values + scalePrestoEngineOptionsModelNew := new(watsonxdatav3.ScalePrestoEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -8651,34 +9190,32 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke UpdateNetezzaEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScalePrestoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NetezzaEnginePatch model - netezzaEnginePatchModel := new(watsonxdatav2.NetezzaEnginePatch) - netezzaEnginePatchModel.Description = core.StringPtr("netezza engine updated description") - netezzaEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - netezzaEnginePatchModel.Tags = []string{"tag1", "tag2"} - netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) - // Construct an instance of the UpdateNetezzaEngineOptions model - updateNetezzaEngineOptionsModel := new(watsonxdatav2.UpdateNetezzaEngineOptions) - updateNetezzaEngineOptionsModel.EngineID = core.StringPtr("testString") - updateNetezzaEngineOptionsModel.Body = netezzaEnginePatchModelAsPatch - updateNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ScalePrestoEngineOptions model + scalePrestoEngineOptionsModel := new(watsonxdatav3.ScalePrestoEngineOptions) + scalePrestoEngineOptionsModel.ID = core.StringPtr("testString") + scalePrestoEngineOptionsModel.Coordinator = nodeDescriptionModel + scalePrestoEngineOptionsModel.Worker = nodeDescriptionModel + scalePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scalePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -8690,48 +9227,44 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateExecuteQuery(createExecuteQueryOptions *CreateExecuteQueryOptions) - Operation response error`, func() { - createExecuteQueryPath := "/queries/execute/testString" + Describe(`ListPrestissimoEngines(listPrestissimoEnginesOptions *ListPrestissimoEnginesOptions) - Operation response error`, func() { + listPrestissimoEnginesPath := "/v3/prestissimo_engines" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createExecuteQueryPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEnginesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateExecuteQuery with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestissimoEngines with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateExecuteQueryOptions model - createExecuteQueryOptionsModel := new(watsonxdatav2.CreateExecuteQueryOptions) - createExecuteQueryOptionsModel.EngineID = core.StringPtr("testString") - createExecuteQueryOptionsModel.SqlString = core.StringPtr("select expenses from expenditure") - createExecuteQueryOptionsModel.CatalogName = core.StringPtr("sampleCatalog") - createExecuteQueryOptionsModel.SchemaName = core.StringPtr("SampleSchema1") - createExecuteQueryOptionsModel.AuthInstanceID = core.StringPtr("testString") - createExecuteQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestissimoEnginesOptions model + listPrestissimoEnginesOptionsModel := new(watsonxdatav3.ListPrestissimoEnginesOptions) + listPrestissimoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestissimoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateExecuteQuery(createExecuteQueryOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateExecuteQuery(createExecuteQueryOptionsModel) + result, response, operationErr = watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -8741,32 +9274,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateExecuteQuery(createExecuteQueryOptions *CreateExecuteQueryOptions)`, func() { - createExecuteQueryPath := "/queries/execute/testString" + Describe(`ListPrestissimoEngines(listPrestissimoEnginesOptions *ListPrestissimoEnginesOptions)`, func() { + listPrestissimoEnginesPath := "/v3/prestissimo_engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createExecuteQueryPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEnginesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -8775,12 +9292,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"response": {"result": [{"mapKey": "Inner"}]}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"prestissimo_engines": [{"actions": ["Actions"], "analyze_status": "not_started", "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "worker", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "worker", "quantity": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 0, "created_by": "@.com", "description": "prestissimo engine for running sql queries", "display_name": "sampleEngine", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "id": "prestissimo123", "is_qhmm_engine": true, "last_time_analyzed": "not_started", "optimizer_enabled": "false", "origin": "native", "port": 0, "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "global": {"mapKey": "Inner"}, "jvm": {"coordinator": {"mapKey": "Inner"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "optimizer_properties": {"mapKey": "Inner"}, "velox": {"mapKey": "Inner"}}, "query_status": "completed", "region": "us-south", "size_config": "starter", "status": "running", "status_code": 0, "tags": ["Tags"], "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "global": ["Global"], "jvm": {"coordinator": ["Coordinator"]}, "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "optimizer_properties": ["OptimizerProperties"], "velox": ["Velox"]}, "restart_type": "force", "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}}]}`) })) }) - It(`Invoke CreateExecuteQuery successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestissimoEngines successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -8788,25 +9305,21 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateExecuteQueryOptions model - createExecuteQueryOptionsModel := new(watsonxdatav2.CreateExecuteQueryOptions) - createExecuteQueryOptionsModel.EngineID = core.StringPtr("testString") - createExecuteQueryOptionsModel.SqlString = core.StringPtr("select expenses from expenditure") - createExecuteQueryOptionsModel.CatalogName = core.StringPtr("sampleCatalog") - createExecuteQueryOptionsModel.SchemaName = core.StringPtr("SampleSchema1") - createExecuteQueryOptionsModel.AuthInstanceID = core.StringPtr("testString") - createExecuteQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestissimoEnginesOptions model + listPrestissimoEnginesOptionsModel := new(watsonxdatav3.ListPrestissimoEnginesOptions) + listPrestissimoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestissimoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateExecuteQueryWithContext(ctx, createExecuteQueryOptionsModel) + _, _, operationErr := watsonxDataService.ListPrestissimoEnginesWithContext(ctx, listPrestissimoEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateExecuteQuery(createExecuteQueryOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -8814,7 +9327,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateExecuteQueryWithContext(ctx, createExecuteQueryOptionsModel) + _, _, operationErr = watsonxDataService.ListPrestissimoEnginesWithContext(ctx, listPrestissimoEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -8828,35 +9341,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createExecuteQueryPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEnginesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"response": {"result": [{"mapKey": "Inner"}]}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"prestissimo_engines": [{"actions": ["Actions"], "analyze_status": "not_started", "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "worker", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "worker", "quantity": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 0, "created_by": "@.com", "description": "prestissimo engine for running sql queries", "display_name": "sampleEngine", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "id": "prestissimo123", "is_qhmm_engine": true, "last_time_analyzed": "not_started", "optimizer_enabled": "false", "origin": "native", "port": 0, "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "global": {"mapKey": "Inner"}, "jvm": {"coordinator": {"mapKey": "Inner"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "optimizer_properties": {"mapKey": "Inner"}, "velox": {"mapKey": "Inner"}}, "query_status": "completed", "region": "us-south", "size_config": "starter", "status": "running", "status_code": 0, "tags": ["Tags"], "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "global": ["Global"], "jvm": {"coordinator": ["Coordinator"]}, "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "optimizer_properties": ["OptimizerProperties"], "velox": ["Velox"]}, "restart_type": "force", "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}}]}`) })) }) - It(`Invoke CreateExecuteQuery successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestissimoEngines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -8864,58 +9361,43 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateExecuteQuery(nil) + result, response, operationErr := watsonxDataService.ListPrestissimoEngines(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateExecuteQueryOptions model - createExecuteQueryOptionsModel := new(watsonxdatav2.CreateExecuteQueryOptions) - createExecuteQueryOptionsModel.EngineID = core.StringPtr("testString") - createExecuteQueryOptionsModel.SqlString = core.StringPtr("select expenses from expenditure") - createExecuteQueryOptionsModel.CatalogName = core.StringPtr("sampleCatalog") - createExecuteQueryOptionsModel.SchemaName = core.StringPtr("SampleSchema1") - createExecuteQueryOptionsModel.AuthInstanceID = core.StringPtr("testString") - createExecuteQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestissimoEnginesOptions model + listPrestissimoEnginesOptionsModel := new(watsonxdatav3.ListPrestissimoEnginesOptions) + listPrestissimoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestissimoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateExecuteQuery(createExecuteQueryOptionsModel) + result, response, operationErr = watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateExecuteQuery with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestissimoEngines with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateExecuteQueryOptions model - createExecuteQueryOptionsModel := new(watsonxdatav2.CreateExecuteQueryOptions) - createExecuteQueryOptionsModel.EngineID = core.StringPtr("testString") - createExecuteQueryOptionsModel.SqlString = core.StringPtr("select expenses from expenditure") - createExecuteQueryOptionsModel.CatalogName = core.StringPtr("sampleCatalog") - createExecuteQueryOptionsModel.SchemaName = core.StringPtr("SampleSchema1") - createExecuteQueryOptionsModel.AuthInstanceID = core.StringPtr("testString") - createExecuteQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestissimoEnginesOptions model + listPrestissimoEnginesOptionsModel := new(watsonxdatav3.ListPrestissimoEnginesOptions) + listPrestissimoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestissimoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateExecuteQuery(createExecuteQueryOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateExecuteQueryOptions model with no property values - createExecuteQueryOptionsModelNew := new(watsonxdatav2.CreateExecuteQueryOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateExecuteQuery(createExecuteQueryOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -8927,28 +9409,24 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateExecuteQuery successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestissimoEngines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateExecuteQueryOptions model - createExecuteQueryOptionsModel := new(watsonxdatav2.CreateExecuteQueryOptions) - createExecuteQueryOptionsModel.EngineID = core.StringPtr("testString") - createExecuteQueryOptionsModel.SqlString = core.StringPtr("select expenses from expenditure") - createExecuteQueryOptionsModel.CatalogName = core.StringPtr("sampleCatalog") - createExecuteQueryOptionsModel.SchemaName = core.StringPtr("SampleSchema1") - createExecuteQueryOptionsModel.AuthInstanceID = core.StringPtr("testString") - createExecuteQueryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestissimoEnginesOptions model + listPrestissimoEnginesOptionsModel := new(watsonxdatav3.ListPrestissimoEnginesOptions) + listPrestissimoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestissimoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateExecuteQuery(createExecuteQueryOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -8960,44 +9438,62 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListInstanceDetails(listInstanceDetailsOptions *ListInstanceDetailsOptions) - Operation response error`, func() { - listInstanceDetailsPath := "/instance_details" + Describe(`CreatePrestissimoEngine(createPrestissimoEngineOptions *CreatePrestissimoEngineOptions) - Operation response error`, func() { + createPrestissimoEnginePath := "/v3/prestissimo_engines" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceDetailsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceDetails with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestissimoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListInstanceDetailsOptions model - listInstanceDetailsOptionsModel := new(watsonxdatav2.ListInstanceDetailsOptions) - listInstanceDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listInstanceDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the PrestissimoEngineDetails model + prestissimoEngineDetailsModel := new(watsonxdatav3.PrestissimoEngineDetails) + prestissimoEngineDetailsModel.Coordinator = nodeDescriptionModel + prestissimoEngineDetailsModel.SizeConfig = core.StringPtr("starter") + prestissimoEngineDetailsModel.Worker = nodeDescriptionModel + + // Construct an instance of the CreatePrestissimoEngineOptions model + createPrestissimoEngineOptionsModel := new(watsonxdatav3.CreatePrestissimoEngineOptions) + createPrestissimoEngineOptionsModel.Configuration = prestissimoEngineDetailsModel + createPrestissimoEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createPrestissimoEngineOptionsModel.Origin = core.StringPtr("native") + createPrestissimoEngineOptionsModel.AssociatedCatalogs = []string{"hive_data"} + createPrestissimoEngineOptionsModel.Description = core.StringPtr("prestissimo engine description") + createPrestissimoEngineOptionsModel.ID = core.StringPtr("prestissimo123") + createPrestissimoEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListInstanceDetails(listInstanceDetailsOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListInstanceDetails(listInstanceDetailsOptionsModel) + result, response, operationErr = watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -9007,16 +9503,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListInstanceDetails(listInstanceDetailsOptions *ListInstanceDetailsOptions)`, func() { - listInstanceDetailsPath := "/instance_details" + Describe(`CreatePrestissimoEngine(createPrestissimoEngineOptions *CreatePrestissimoEngineOptions)`, func() { + createPrestissimoEnginePath := "/v3/prestissimo_engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceDetailsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEnginePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -9025,12 +9537,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"engines_services": [{"details": [{"ca_certificate": "sample ca certificate", "default_configs": {"mapKey": "Inner"}, "external": {"port": 4553, "hostname": "external hostname"}, "grpc_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "hostname": "sample hostname", "id": "sample ID", "instance_crn": "sample instance CRN", "instance_id": "sample instance ID", "internal": {"port": 4553, "hostname": "internal hostname"}, "jdbc_class": "com.facebook.presto.jdbc.PrestoDriver", "jdbc_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "name": "sample name", "port": 4553, "rest_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "spark_engine_endpoint": "Spark Engine endpoint", "ssl_certificate": "sample ssl certificate", "thrift_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "version": "java", "watsonx_data_application_endpoint": "sample application end point"}], "type": "presto"}], "watsonx_data_instance": {"ca_certificate": "sample ca certificate", "default_configs": {"mapKey": "Inner"}, "external": {"port": 4553, "hostname": "external hostname"}, "grpc_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "hostname": "sample hostname", "id": "sample ID", "instance_crn": "sample instance CRN", "instance_id": "sample instance ID", "internal": {"port": 4553, "hostname": "internal hostname"}, "jdbc_class": "com.facebook.presto.jdbc.PrestoDriver", "jdbc_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "name": "sample name", "port": 4553, "rest_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "spark_engine_endpoint": "Spark Engine endpoint", "ssl_certificate": "sample ssl certificate", "thrift_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "version": "java", "watsonx_data_application_endpoint": "sample application end point"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "analyze_status": "not_started", "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "worker", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "worker", "quantity": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 0, "created_by": "@.com", "description": "prestissimo engine for running sql queries", "display_name": "sampleEngine", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "id": "prestissimo123", "is_qhmm_engine": true, "last_time_analyzed": "not_started", "optimizer_enabled": "false", "origin": "native", "port": 0, "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "global": {"mapKey": "Inner"}, "jvm": {"coordinator": {"mapKey": "Inner"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "optimizer_properties": {"mapKey": "Inner"}, "velox": {"mapKey": "Inner"}}, "query_status": "completed", "region": "us-south", "size_config": "starter", "status": "running", "status_code": 0, "tags": ["Tags"], "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "global": ["Global"], "jvm": {"coordinator": ["Coordinator"]}, "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "optimizer_properties": ["OptimizerProperties"], "velox": ["Velox"]}, "restart_type": "force", "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}}`) })) }) - It(`Invoke ListInstanceDetails successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestissimoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -9038,21 +9550,39 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceDetailsOptions model - listInstanceDetailsOptionsModel := new(watsonxdatav2.ListInstanceDetailsOptions) - listInstanceDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listInstanceDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the PrestissimoEngineDetails model + prestissimoEngineDetailsModel := new(watsonxdatav3.PrestissimoEngineDetails) + prestissimoEngineDetailsModel.Coordinator = nodeDescriptionModel + prestissimoEngineDetailsModel.SizeConfig = core.StringPtr("starter") + prestissimoEngineDetailsModel.Worker = nodeDescriptionModel + + // Construct an instance of the CreatePrestissimoEngineOptions model + createPrestissimoEngineOptionsModel := new(watsonxdatav3.CreatePrestissimoEngineOptions) + createPrestissimoEngineOptionsModel.Configuration = prestissimoEngineDetailsModel + createPrestissimoEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createPrestissimoEngineOptionsModel.Origin = core.StringPtr("native") + createPrestissimoEngineOptionsModel.AssociatedCatalogs = []string{"hive_data"} + createPrestissimoEngineOptionsModel.Description = core.StringPtr("prestissimo engine description") + createPrestissimoEngineOptionsModel.ID = core.StringPtr("prestissimo123") + createPrestissimoEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListInstanceDetailsWithContext(ctx, listInstanceDetailsOptionsModel) + _, _, operationErr := watsonxDataService.CreatePrestissimoEngineWithContext(ctx, createPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListInstanceDetails(listInstanceDetailsOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -9060,7 +9590,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListInstanceDetailsWithContext(ctx, listInstanceDetailsOptionsModel) + _, _, operationErr = watsonxDataService.CreatePrestissimoEngineWithContext(ctx, createPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -9074,19 +9604,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceDetailsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEnginePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"engines_services": [{"details": [{"ca_certificate": "sample ca certificate", "default_configs": {"mapKey": "Inner"}, "external": {"port": 4553, "hostname": "external hostname"}, "grpc_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "hostname": "sample hostname", "id": "sample ID", "instance_crn": "sample instance CRN", "instance_id": "sample instance ID", "internal": {"port": 4553, "hostname": "internal hostname"}, "jdbc_class": "com.facebook.presto.jdbc.PrestoDriver", "jdbc_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "name": "sample name", "port": 4553, "rest_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "spark_engine_endpoint": "Spark Engine endpoint", "ssl_certificate": "sample ssl certificate", "thrift_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "version": "java", "watsonx_data_application_endpoint": "sample application end point"}], "type": "presto"}], "watsonx_data_instance": {"ca_certificate": "sample ca certificate", "default_configs": {"mapKey": "Inner"}, "external": {"port": 4553, "hostname": "external hostname"}, "grpc_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "hostname": "sample hostname", "id": "sample ID", "instance_crn": "sample instance CRN", "instance_id": "sample instance ID", "internal": {"port": 4553, "hostname": "internal hostname"}, "jdbc_class": "com.facebook.presto.jdbc.PrestoDriver", "jdbc_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "name": "sample name", "port": 4553, "rest_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "spark_engine_endpoint": "Spark Engine endpoint", "ssl_certificate": "sample ssl certificate", "thrift_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "version": "java", "watsonx_data_application_endpoint": "sample application end point"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "analyze_status": "not_started", "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "worker", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "worker", "quantity": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 0, "created_by": "@.com", "description": "prestissimo engine for running sql queries", "display_name": "sampleEngine", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "id": "prestissimo123", "is_qhmm_engine": true, "last_time_analyzed": "not_started", "optimizer_enabled": "false", "origin": "native", "port": 0, "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "global": {"mapKey": "Inner"}, "jvm": {"coordinator": {"mapKey": "Inner"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "optimizer_properties": {"mapKey": "Inner"}, "velox": {"mapKey": "Inner"}}, "query_status": "completed", "region": "us-south", "size_config": "starter", "status": "running", "status_code": 0, "tags": ["Tags"], "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "global": ["Global"], "jvm": {"coordinator": ["Coordinator"]}, "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "optimizer_properties": ["OptimizerProperties"], "velox": ["Velox"]}, "restart_type": "force", "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}}`) })) }) - It(`Invoke ListInstanceDetails successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -9094,43 +9640,86 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListInstanceDetails(nil) + result, response, operationErr := watsonxDataService.CreatePrestissimoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceDetailsOptions model - listInstanceDetailsOptionsModel := new(watsonxdatav2.ListInstanceDetailsOptions) - listInstanceDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listInstanceDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the PrestissimoEngineDetails model + prestissimoEngineDetailsModel := new(watsonxdatav3.PrestissimoEngineDetails) + prestissimoEngineDetailsModel.Coordinator = nodeDescriptionModel + prestissimoEngineDetailsModel.SizeConfig = core.StringPtr("starter") + prestissimoEngineDetailsModel.Worker = nodeDescriptionModel + + // Construct an instance of the CreatePrestissimoEngineOptions model + createPrestissimoEngineOptionsModel := new(watsonxdatav3.CreatePrestissimoEngineOptions) + createPrestissimoEngineOptionsModel.Configuration = prestissimoEngineDetailsModel + createPrestissimoEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createPrestissimoEngineOptionsModel.Origin = core.StringPtr("native") + createPrestissimoEngineOptionsModel.AssociatedCatalogs = []string{"hive_data"} + createPrestissimoEngineOptionsModel.Description = core.StringPtr("prestissimo engine description") + createPrestissimoEngineOptionsModel.ID = core.StringPtr("prestissimo123") + createPrestissimoEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListInstanceDetails(listInstanceDetailsOptionsModel) + result, response, operationErr = watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceDetails with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestissimoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListInstanceDetailsOptions model - listInstanceDetailsOptionsModel := new(watsonxdatav2.ListInstanceDetailsOptions) - listInstanceDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listInstanceDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the PrestissimoEngineDetails model + prestissimoEngineDetailsModel := new(watsonxdatav3.PrestissimoEngineDetails) + prestissimoEngineDetailsModel.Coordinator = nodeDescriptionModel + prestissimoEngineDetailsModel.SizeConfig = core.StringPtr("starter") + prestissimoEngineDetailsModel.Worker = nodeDescriptionModel + + // Construct an instance of the CreatePrestissimoEngineOptions model + createPrestissimoEngineOptionsModel := new(watsonxdatav3.CreatePrestissimoEngineOptions) + createPrestissimoEngineOptionsModel.Configuration = prestissimoEngineDetailsModel + createPrestissimoEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createPrestissimoEngineOptionsModel.Origin = core.StringPtr("native") + createPrestissimoEngineOptionsModel.AssociatedCatalogs = []string{"hive_data"} + createPrestissimoEngineOptionsModel.Description = core.StringPtr("prestissimo engine description") + createPrestissimoEngineOptionsModel.ID = core.StringPtr("prestissimo123") + createPrestissimoEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListInstanceDetails(listInstanceDetailsOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the CreatePrestissimoEngineOptions model with no property values + createPrestissimoEngineOptionsModelNew := new(watsonxdatav3.CreatePrestissimoEngineOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -9142,24 +9731,42 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListInstanceDetails successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListInstanceDetailsOptions model - listInstanceDetailsOptionsModel := new(watsonxdatav2.ListInstanceDetailsOptions) - listInstanceDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listInstanceDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the PrestissimoEngineDetails model + prestissimoEngineDetailsModel := new(watsonxdatav3.PrestissimoEngineDetails) + prestissimoEngineDetailsModel.Coordinator = nodeDescriptionModel + prestissimoEngineDetailsModel.SizeConfig = core.StringPtr("starter") + prestissimoEngineDetailsModel.Worker = nodeDescriptionModel + + // Construct an instance of the CreatePrestissimoEngineOptions model + createPrestissimoEngineOptionsModel := new(watsonxdatav3.CreatePrestissimoEngineOptions) + createPrestissimoEngineOptionsModel.Configuration = prestissimoEngineDetailsModel + createPrestissimoEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createPrestissimoEngineOptionsModel.Origin = core.StringPtr("native") + createPrestissimoEngineOptionsModel.AssociatedCatalogs = []string{"hive_data"} + createPrestissimoEngineOptionsModel.Description = core.StringPtr("prestissimo engine description") + createPrestissimoEngineOptionsModel.ID = core.StringPtr("prestissimo123") + createPrestissimoEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListInstanceDetails(listInstanceDetailsOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -9171,48 +9778,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListInstanceServiceDetails(listInstanceServiceDetailsOptions *ListInstanceServiceDetailsOptions) - Operation response error`, func() { - listInstanceServiceDetailsPath := "/instance_details/engines_services" + Describe(`GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptions *GetPrestissimoEngineCatalogOptions) - Operation response error`, func() { + getPrestissimoEngineCatalogPath := "/v3/prestissimo_engines/testString/catalogs/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceServiceDetailsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEngineCatalogPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - // TODO: Add check for internal_host query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListInstanceServiceDetails with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestissimoEngineCatalog with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListInstanceServiceDetailsOptions model - listInstanceServiceDetailsOptionsModel := new(watsonxdatav2.ListInstanceServiceDetailsOptions) - listInstanceServiceDetailsOptionsModel.Target = core.StringPtr("testString") - listInstanceServiceDetailsOptionsModel.InternalHost = core.BoolPtr(false) - listInstanceServiceDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listInstanceServiceDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestissimoEngineCatalogOptions model + getPrestissimoEngineCatalogOptionsModel := new(watsonxdatav3.GetPrestissimoEngineCatalogOptions) + getPrestissimoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListInstanceServiceDetails(listInstanceServiceDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListInstanceServiceDetails(listInstanceServiceDetailsOptionsModel) + result, response, operationErr = watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -9222,32 +9827,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListInstanceServiceDetails(listInstanceServiceDetailsOptions *ListInstanceServiceDetailsOptions)`, func() { - listInstanceServiceDetailsPath := "/instance_details/engines_services" + Describe(`GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptions *GetPrestissimoEngineCatalogOptions)`, func() { + getPrestissimoEngineCatalogPath := "/v3/prestissimo_engines/testString/catalogs/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceServiceDetailsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEngineCatalogPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - // TODO: Add check for internal_host query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"engines_services": [{"connection_name": "presto-01", "details": {"ca_certificate": "sample ca certificate", "default_configs": {"mapKey": "Inner"}, "external": {"port": 4553, "hostname": "external hostname"}, "grpc_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "hostname": "sample hostname", "id": "sample ID", "instance_crn": "sample instance CRN", "instance_id": "sample instance ID", "internal": {"port": 4553, "hostname": "internal hostname"}, "jdbc_class": "com.facebook.presto.jdbc.PrestoDriver", "jdbc_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "name": "sample name", "port": 4553, "rest_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "spark_engine_endpoint": "Spark Engine endpoint", "ssl_certificate": "sample ssl certificate", "thrift_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "version": "java", "watsonx_data_application_endpoint": "sample application end point"}, "properties": {"connection": [{"name": "host", "value": "sample_value"}]}, "type": "presto"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}`) })) }) - It(`Invoke ListInstanceServiceDetails successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestissimoEngineCatalog successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -9255,23 +9858,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListInstanceServiceDetailsOptions model - listInstanceServiceDetailsOptionsModel := new(watsonxdatav2.ListInstanceServiceDetailsOptions) - listInstanceServiceDetailsOptionsModel.Target = core.StringPtr("testString") - listInstanceServiceDetailsOptionsModel.InternalHost = core.BoolPtr(false) - listInstanceServiceDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listInstanceServiceDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestissimoEngineCatalogOptions model + getPrestissimoEngineCatalogOptionsModel := new(watsonxdatav3.GetPrestissimoEngineCatalogOptions) + getPrestissimoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListInstanceServiceDetailsWithContext(ctx, listInstanceServiceDetailsOptionsModel) + _, _, operationErr := watsonxDataService.GetPrestissimoEngineCatalogWithContext(ctx, getPrestissimoEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListInstanceServiceDetails(listInstanceServiceDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -9279,7 +9882,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListInstanceServiceDetailsWithContext(ctx, listInstanceServiceDetailsOptionsModel) + _, _, operationErr = watsonxDataService.GetPrestissimoEngineCatalogWithContext(ctx, getPrestissimoEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -9293,21 +9896,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listInstanceServiceDetailsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEngineCatalogPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - // TODO: Add check for internal_host query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"engines_services": [{"connection_name": "presto-01", "details": {"ca_certificate": "sample ca certificate", "default_configs": {"mapKey": "Inner"}, "external": {"port": 4553, "hostname": "external hostname"}, "grpc_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "hostname": "sample hostname", "id": "sample ID", "instance_crn": "sample instance CRN", "instance_id": "sample instance ID", "internal": {"port": 4553, "hostname": "internal hostname"}, "jdbc_class": "com.facebook.presto.jdbc.PrestoDriver", "jdbc_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "name": "sample name", "port": 4553, "rest_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "spark_engine_endpoint": "Spark Engine endpoint", "ssl_certificate": "sample ssl certificate", "thrift_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "version": "java", "watsonx_data_application_endpoint": "sample application end point"}, "properties": {"connection": [{"name": "host", "value": "sample_value"}]}, "type": "presto"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}`) })) }) - It(`Invoke ListInstanceServiceDetails successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestissimoEngineCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -9315,51 +9916,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListInstanceServiceDetails(nil) + result, response, operationErr := watsonxDataService.GetPrestissimoEngineCatalog(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListInstanceServiceDetailsOptions model - listInstanceServiceDetailsOptionsModel := new(watsonxdatav2.ListInstanceServiceDetailsOptions) - listInstanceServiceDetailsOptionsModel.Target = core.StringPtr("testString") - listInstanceServiceDetailsOptionsModel.InternalHost = core.BoolPtr(false) - listInstanceServiceDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listInstanceServiceDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestissimoEngineCatalogOptions model + getPrestissimoEngineCatalogOptionsModel := new(watsonxdatav3.GetPrestissimoEngineCatalogOptions) + getPrestissimoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListInstanceServiceDetails(listInstanceServiceDetailsOptionsModel) + result, response, operationErr = watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListInstanceServiceDetails with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestissimoEngineCatalog with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListInstanceServiceDetailsOptions model - listInstanceServiceDetailsOptionsModel := new(watsonxdatav2.ListInstanceServiceDetailsOptions) - listInstanceServiceDetailsOptionsModel.Target = core.StringPtr("testString") - listInstanceServiceDetailsOptionsModel.InternalHost = core.BoolPtr(false) - listInstanceServiceDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listInstanceServiceDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestissimoEngineCatalogOptions model + getPrestissimoEngineCatalogOptionsModel := new(watsonxdatav3.GetPrestissimoEngineCatalogOptions) + getPrestissimoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListInstanceServiceDetails(listInstanceServiceDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListInstanceServiceDetailsOptions model with no property values - listInstanceServiceDetailsOptionsModelNew := new(watsonxdatav2.ListInstanceServiceDetailsOptions) + // Construct a second instance of the GetPrestissimoEngineCatalogOptions model with no property values + getPrestissimoEngineCatalogOptionsModelNew := new(watsonxdatav3.GetPrestissimoEngineCatalogOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListInstanceServiceDetails(listInstanceServiceDetailsOptionsModelNew) + result, response, operationErr = watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -9377,23 +9978,23 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListInstanceServiceDetails successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestissimoEngineCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListInstanceServiceDetailsOptions model - listInstanceServiceDetailsOptionsModel := new(watsonxdatav2.ListInstanceServiceDetailsOptions) - listInstanceServiceDetailsOptionsModel.Target = core.StringPtr("testString") - listInstanceServiceDetailsOptionsModel.InternalHost = core.BoolPtr(false) - listInstanceServiceDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listInstanceServiceDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestissimoEngineCatalogOptions model + getPrestissimoEngineCatalogOptionsModel := new(watsonxdatav3.GetPrestissimoEngineCatalogOptions) + getPrestissimoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestissimoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListInstanceServiceDetails(listInstanceServiceDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -9405,49 +10006,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetServicesDetails(getServicesDetailsOptions *GetServicesDetailsOptions) - Operation response error`, func() { - getServicesDetailsPath := "/instance_details/engines_services/testString" + Describe(`GetPrestissimoEngine(getPrestissimoEngineOptions *GetPrestissimoEngineOptions) - Operation response error`, func() { + getPrestissimoEnginePath := "/v3/prestissimo_engines/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getServicesDetailsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEnginePath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - // TODO: Add check for internal_host query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetServicesDetails with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestissimoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetServicesDetailsOptions model - getServicesDetailsOptionsModel := new(watsonxdatav2.GetServicesDetailsOptions) - getServicesDetailsOptionsModel.Target = core.StringPtr("testString") - getServicesDetailsOptionsModel.EngineOrServiceType = core.StringPtr("testString") - getServicesDetailsOptionsModel.InternalHost = core.BoolPtr(false) - getServicesDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getServicesDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestissimoEngineOptions model + getPrestissimoEngineOptionsModel := new(watsonxdatav3.GetPrestissimoEngineOptions) + getPrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + getPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetServicesDetails(getServicesDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetServicesDetails(getServicesDetailsOptionsModel) + result, response, operationErr = watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -9457,32 +10054,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetServicesDetails(getServicesDetailsOptions *GetServicesDetailsOptions)`, func() { - getServicesDetailsPath := "/instance_details/engines_services/testString" + Describe(`GetPrestissimoEngine(getPrestissimoEngineOptions *GetPrestissimoEngineOptions)`, func() { + getPrestissimoEnginePath := "/v3/prestissimo_engines/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getServicesDetailsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEnginePath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - // TODO: Add check for internal_host query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"engines_services": [{"connection_name": "presto-01", "details": {"ca_certificate": "sample ca certificate", "default_configs": {"mapKey": "Inner"}, "external": {"port": 4553, "hostname": "external hostname"}, "grpc_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "hostname": "sample hostname", "id": "sample ID", "instance_crn": "sample instance CRN", "instance_id": "sample instance ID", "internal": {"port": 4553, "hostname": "internal hostname"}, "jdbc_class": "com.facebook.presto.jdbc.PrestoDriver", "jdbc_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "name": "sample name", "port": 4553, "rest_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "spark_engine_endpoint": "Spark Engine endpoint", "ssl_certificate": "sample ssl certificate", "thrift_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "version": "java", "watsonx_data_application_endpoint": "sample application end point"}, "properties": {"connection": [{"name": "host", "value": "sample_value"}]}, "type": "presto"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "analyze_status": "not_started", "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "worker", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "worker", "quantity": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 0, "created_by": "@.com", "description": "prestissimo engine for running sql queries", "display_name": "sampleEngine", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "id": "prestissimo123", "is_qhmm_engine": true, "last_time_analyzed": "not_started", "optimizer_enabled": "false", "origin": "native", "port": 0, "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "global": {"mapKey": "Inner"}, "jvm": {"coordinator": {"mapKey": "Inner"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "optimizer_properties": {"mapKey": "Inner"}, "velox": {"mapKey": "Inner"}}, "query_status": "completed", "region": "us-south", "size_config": "starter", "status": "running", "status_code": 0, "tags": ["Tags"], "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "global": ["Global"], "jvm": {"coordinator": ["Coordinator"]}, "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "optimizer_properties": ["OptimizerProperties"], "velox": ["Velox"]}, "restart_type": "force", "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}}`) })) }) - It(`Invoke GetServicesDetails successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestissimoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -9490,24 +10085,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetServicesDetailsOptions model - getServicesDetailsOptionsModel := new(watsonxdatav2.GetServicesDetailsOptions) - getServicesDetailsOptionsModel.Target = core.StringPtr("testString") - getServicesDetailsOptionsModel.EngineOrServiceType = core.StringPtr("testString") - getServicesDetailsOptionsModel.InternalHost = core.BoolPtr(false) - getServicesDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getServicesDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestissimoEngineOptions model + getPrestissimoEngineOptionsModel := new(watsonxdatav3.GetPrestissimoEngineOptions) + getPrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + getPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetServicesDetailsWithContext(ctx, getServicesDetailsOptionsModel) + _, _, operationErr := watsonxDataService.GetPrestissimoEngineWithContext(ctx, getPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetServicesDetails(getServicesDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -9515,7 +10108,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetServicesDetailsWithContext(ctx, getServicesDetailsOptionsModel) + _, _, operationErr = watsonxDataService.GetPrestissimoEngineWithContext(ctx, getPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -9529,21 +10122,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getServicesDetailsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEnginePath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - // TODO: Add check for internal_host query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"engines_services": [{"connection_name": "presto-01", "details": {"ca_certificate": "sample ca certificate", "default_configs": {"mapKey": "Inner"}, "external": {"port": 4553, "hostname": "external hostname"}, "grpc_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "hostname": "sample hostname", "id": "sample ID", "instance_crn": "sample instance CRN", "instance_id": "sample instance ID", "internal": {"port": 4553, "hostname": "internal hostname"}, "jdbc_class": "com.facebook.presto.jdbc.PrestoDriver", "jdbc_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "name": "sample name", "port": 4553, "rest_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "spark_engine_endpoint": "Spark Engine endpoint", "ssl_certificate": "sample ssl certificate", "thrift_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "version": "java", "watsonx_data_application_endpoint": "sample application end point"}, "properties": {"connection": [{"name": "host", "value": "sample_value"}]}, "type": "presto"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "analyze_status": "not_started", "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "worker", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "worker", "quantity": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 0, "created_by": "@.com", "description": "prestissimo engine for running sql queries", "display_name": "sampleEngine", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "id": "prestissimo123", "is_qhmm_engine": true, "last_time_analyzed": "not_started", "optimizer_enabled": "false", "origin": "native", "port": 0, "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "global": {"mapKey": "Inner"}, "jvm": {"coordinator": {"mapKey": "Inner"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "optimizer_properties": {"mapKey": "Inner"}, "velox": {"mapKey": "Inner"}}, "query_status": "completed", "region": "us-south", "size_config": "starter", "status": "running", "status_code": 0, "tags": ["Tags"], "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "global": ["Global"], "jvm": {"coordinator": ["Coordinator"]}, "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "optimizer_properties": ["OptimizerProperties"], "velox": ["Velox"]}, "restart_type": "force", "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}}`) })) }) - It(`Invoke GetServicesDetails successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -9551,53 +10142,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetServicesDetails(nil) + result, response, operationErr := watsonxDataService.GetPrestissimoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetServicesDetailsOptions model - getServicesDetailsOptionsModel := new(watsonxdatav2.GetServicesDetailsOptions) - getServicesDetailsOptionsModel.Target = core.StringPtr("testString") - getServicesDetailsOptionsModel.EngineOrServiceType = core.StringPtr("testString") - getServicesDetailsOptionsModel.InternalHost = core.BoolPtr(false) - getServicesDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getServicesDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestissimoEngineOptions model + getPrestissimoEngineOptionsModel := new(watsonxdatav3.GetPrestissimoEngineOptions) + getPrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + getPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetServicesDetails(getServicesDetailsOptionsModel) + result, response, operationErr = watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetServicesDetails with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestissimoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetServicesDetailsOptions model - getServicesDetailsOptionsModel := new(watsonxdatav2.GetServicesDetailsOptions) - getServicesDetailsOptionsModel.Target = core.StringPtr("testString") - getServicesDetailsOptionsModel.EngineOrServiceType = core.StringPtr("testString") - getServicesDetailsOptionsModel.InternalHost = core.BoolPtr(false) - getServicesDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getServicesDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestissimoEngineOptions model + getPrestissimoEngineOptionsModel := new(watsonxdatav3.GetPrestissimoEngineOptions) + getPrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + getPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetServicesDetails(getServicesDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetServicesDetailsOptions model with no property values - getServicesDetailsOptionsModelNew := new(watsonxdatav2.GetServicesDetailsOptions) + // Construct a second instance of the GetPrestissimoEngineOptions model with no property values + getPrestissimoEngineOptionsModelNew := new(watsonxdatav3.GetPrestissimoEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetServicesDetails(getServicesDetailsOptionsModelNew) + result, response, operationErr = watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -9615,24 +10202,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetServicesDetails successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetPrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetServicesDetailsOptions model - getServicesDetailsOptionsModel := new(watsonxdatav2.GetServicesDetailsOptions) - getServicesDetailsOptionsModel.Target = core.StringPtr("testString") - getServicesDetailsOptionsModel.EngineOrServiceType = core.StringPtr("testString") - getServicesDetailsOptionsModel.InternalHost = core.BoolPtr(false) - getServicesDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getServicesDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetPrestissimoEngineOptions model + getPrestissimoEngineOptionsModel := new(watsonxdatav3.GetPrestissimoEngineOptions) + getPrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + getPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetServicesDetails(getServicesDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -9644,52 +10229,189 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetServiceDetail(getServiceDetailOptions *GetServiceDetailOptions) - Operation response error`, func() { - getServiceDetailPath := "/instance_details/engines_services/testString/id/testString" + Describe(`DeletePrestissimoEngine(deletePrestissimoEngineOptions *DeletePrestissimoEngineOptions)`, func() { + deletePrestissimoEnginePath := "/v3/prestissimo_engines/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deletePrestissimoEnginePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.WriteHeader(204) + })) + }) + It(`Invoke DeletePrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeletePrestissimoEngine(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeletePrestissimoEngineOptions model + deletePrestissimoEngineOptionsModel := new(watsonxdatav3.DeletePrestissimoEngineOptions) + deletePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + deletePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deletePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeletePrestissimoEngine(deletePrestissimoEngineOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeletePrestissimoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DeletePrestissimoEngineOptions model + deletePrestissimoEngineOptionsModel := new(watsonxdatav3.DeletePrestissimoEngineOptions) + deletePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + deletePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deletePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeletePrestissimoEngine(deletePrestissimoEngineOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeletePrestissimoEngineOptions model with no property values + deletePrestissimoEngineOptionsModelNew := new(watsonxdatav3.DeletePrestissimoEngineOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeletePrestissimoEngine(deletePrestissimoEngineOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdatePrestissimoEngine(updatePrestissimoEngineOptions *UpdatePrestissimoEngineOptions) - Operation response error`, func() { + updatePrestissimoEnginePath := "/v3/prestissimo_engines/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getServiceDetailPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updatePrestissimoEnginePath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["database"]).To(Equal([]string{"testString"})) - // TODO: Add check for internal_host query parameter res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetServiceDetail with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestissimoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetServiceDetailOptions model - getServiceDetailOptionsModel := new(watsonxdatav2.GetServiceDetailOptions) - getServiceDetailOptionsModel.Target = core.StringPtr("testString") - getServiceDetailOptionsModel.EngineOrServiceType = core.StringPtr("testString") - getServiceDetailOptionsModel.ID = core.StringPtr("testString") - getServiceDetailOptionsModel.Database = core.StringPtr("testString") - getServiceDetailOptionsModel.InternalHost = core.BoolPtr(false) - getServiceDetailOptionsModel.AuthInstanceID = core.StringPtr("testString") - getServiceDetailOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PrestissimoEnginePropertiesCatalogAdditionalProperties model + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties) + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Worker = map[string]interface{}{"anyKey": "anyValue"} + + // Construct an instance of the PrestissimoEnginePropertiesConfiguration model + prestissimoEnginePropertiesConfigurationModel := new(watsonxdatav3.PrestissimoEnginePropertiesConfiguration) + prestissimoEnginePropertiesConfigurationModel.Coordinator = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesConfigurationModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEnginePropertiesJvm model + prestissimoEnginePropertiesJvmModel := new(watsonxdatav3.PrestissimoEnginePropertiesJvm) + prestissimoEnginePropertiesJvmModel.Coordinator = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEnginePropertiesLogConfig model + prestissimoEnginePropertiesLogConfigModel := new(watsonxdatav3.PrestissimoEnginePropertiesLogConfig) + prestissimoEnginePropertiesLogConfigModel.Coordinator = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesLogConfigModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEngineProperties model + prestissimoEnginePropertiesModel := new(watsonxdatav3.PrestissimoEngineProperties) + prestissimoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel} + prestissimoEnginePropertiesModel.Configuration = prestissimoEnginePropertiesConfigurationModel + prestissimoEnginePropertiesModel.Global = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Jvm = prestissimoEnginePropertiesJvmModel + prestissimoEnginePropertiesModel.LogConfig = prestissimoEnginePropertiesLogConfigModel + prestissimoEnginePropertiesModel.OptimizerProperties = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Velox = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Catalog["foo"] = *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the RemovePrestissimoEnginePropertiesCatalogAdditionalProperties model + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties) + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesConfiguration model + removePrestissimoEnginePropertiesConfigurationModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesConfiguration) + removePrestissimoEnginePropertiesConfigurationModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesConfigurationModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesJvm model + removePrestissimoEnginePropertiesJvmModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesJvm) + removePrestissimoEnginePropertiesJvmModel.Coordinator = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesLogConfig model + removePrestissimoEnginePropertiesLogConfigModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesLogConfig) + removePrestissimoEnginePropertiesLogConfigModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesLogConfigModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEngineProperties model + removePrestissimoEnginePropertiesModel := new(watsonxdatav3.RemovePrestissimoEngineProperties) + removePrestissimoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel} + removePrestissimoEnginePropertiesModel.Configuration = removePrestissimoEnginePropertiesConfigurationModel + removePrestissimoEnginePropertiesModel.Global = []string{"testString"} + removePrestissimoEnginePropertiesModel.Jvm = removePrestissimoEnginePropertiesJvmModel + removePrestissimoEnginePropertiesModel.LogConfig = removePrestissimoEnginePropertiesLogConfigModel + removePrestissimoEnginePropertiesModel.OptimizerProperties = []string{"testString"} + removePrestissimoEnginePropertiesModel.Velox = []string{"testString"} + removePrestissimoEnginePropertiesModel.Catalog["foo"] = *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the PrestissimoEnginePatch model + prestissimoEnginePatchModel := new(watsonxdatav3.PrestissimoEnginePatch) + prestissimoEnginePatchModel.Description = core.StringPtr("updated description for prestissimo engine") + prestissimoEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + prestissimoEnginePatchModel.Properties = prestissimoEnginePropertiesModel + prestissimoEnginePatchModel.RemoveEngineProperties = removePrestissimoEnginePropertiesModel + prestissimoEnginePatchModel.RestartType = core.StringPtr("force") + prestissimoEnginePatchModel.Tags = []string{"tag1", "tag2"} + prestissimoEnginePatchModelAsPatch, asPatchErr := prestissimoEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePrestissimoEngineOptions model + updatePrestissimoEngineOptionsModel := new(watsonxdatav3.UpdatePrestissimoEngineOptions) + updatePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + updatePrestissimoEngineOptionsModel.Body = prestissimoEnginePatchModelAsPatch + updatePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetServiceDetail(getServiceDetailOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetServiceDetail(getServiceDetailOptionsModel) + result, response, operationErr = watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -9699,33 +10421,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetServiceDetail(getServiceDetailOptions *GetServiceDetailOptions)`, func() { - getServiceDetailPath := "/instance_details/engines_services/testString/id/testString" + Describe(`UpdatePrestissimoEngine(updatePrestissimoEngineOptions *UpdatePrestissimoEngineOptions)`, func() { + updatePrestissimoEnginePath := "/v3/prestissimo_engines/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getServiceDetailPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updatePrestissimoEnginePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["database"]).To(Equal([]string{"testString"})) - // TODO: Add check for internal_host query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"connection_name": "presto-01", "details": {"ca_certificate": "sample ca certificate", "default_configs": {"mapKey": "Inner"}, "external": {"port": 4553, "hostname": "external hostname"}, "grpc_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "hostname": "sample hostname", "id": "sample ID", "instance_crn": "sample instance CRN", "instance_id": "sample instance ID", "internal": {"port": 4553, "hostname": "internal hostname"}, "jdbc_class": "com.facebook.presto.jdbc.PrestoDriver", "jdbc_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "name": "sample name", "port": 4553, "rest_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "spark_engine_endpoint": "Spark Engine endpoint", "ssl_certificate": "sample ssl certificate", "thrift_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "version": "java", "watsonx_data_application_endpoint": "sample application end point"}, "properties": {"connection": [{"name": "host", "value": "sample_value"}]}, "type": "presto"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "analyze_status": "not_started", "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "worker", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "worker", "quantity": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 0, "created_by": "@.com", "description": "prestissimo engine for running sql queries", "display_name": "sampleEngine", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "id": "prestissimo123", "is_qhmm_engine": true, "last_time_analyzed": "not_started", "optimizer_enabled": "false", "origin": "native", "port": 0, "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "global": {"mapKey": "Inner"}, "jvm": {"coordinator": {"mapKey": "Inner"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "optimizer_properties": {"mapKey": "Inner"}, "velox": {"mapKey": "Inner"}}, "query_status": "completed", "region": "us-south", "size_config": "starter", "status": "running", "status_code": 0, "tags": ["Tags"], "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "global": ["Global"], "jvm": {"coordinator": ["Coordinator"]}, "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "optimizer_properties": ["OptimizerProperties"], "velox": ["Velox"]}, "restart_type": "force", "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}}`) })) }) - It(`Invoke GetServiceDetail successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestissimoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -9733,26 +10468,94 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetServiceDetailOptions model - getServiceDetailOptionsModel := new(watsonxdatav2.GetServiceDetailOptions) - getServiceDetailOptionsModel.Target = core.StringPtr("testString") - getServiceDetailOptionsModel.EngineOrServiceType = core.StringPtr("testString") - getServiceDetailOptionsModel.ID = core.StringPtr("testString") - getServiceDetailOptionsModel.Database = core.StringPtr("testString") - getServiceDetailOptionsModel.InternalHost = core.BoolPtr(false) - getServiceDetailOptionsModel.AuthInstanceID = core.StringPtr("testString") - getServiceDetailOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PrestissimoEnginePropertiesCatalogAdditionalProperties model + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties) + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Worker = map[string]interface{}{"anyKey": "anyValue"} + + // Construct an instance of the PrestissimoEnginePropertiesConfiguration model + prestissimoEnginePropertiesConfigurationModel := new(watsonxdatav3.PrestissimoEnginePropertiesConfiguration) + prestissimoEnginePropertiesConfigurationModel.Coordinator = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesConfigurationModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEnginePropertiesJvm model + prestissimoEnginePropertiesJvmModel := new(watsonxdatav3.PrestissimoEnginePropertiesJvm) + prestissimoEnginePropertiesJvmModel.Coordinator = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEnginePropertiesLogConfig model + prestissimoEnginePropertiesLogConfigModel := new(watsonxdatav3.PrestissimoEnginePropertiesLogConfig) + prestissimoEnginePropertiesLogConfigModel.Coordinator = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesLogConfigModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEngineProperties model + prestissimoEnginePropertiesModel := new(watsonxdatav3.PrestissimoEngineProperties) + prestissimoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel} + prestissimoEnginePropertiesModel.Configuration = prestissimoEnginePropertiesConfigurationModel + prestissimoEnginePropertiesModel.Global = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Jvm = prestissimoEnginePropertiesJvmModel + prestissimoEnginePropertiesModel.LogConfig = prestissimoEnginePropertiesLogConfigModel + prestissimoEnginePropertiesModel.OptimizerProperties = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Velox = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Catalog["foo"] = *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the RemovePrestissimoEnginePropertiesCatalogAdditionalProperties model + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties) + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesConfiguration model + removePrestissimoEnginePropertiesConfigurationModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesConfiguration) + removePrestissimoEnginePropertiesConfigurationModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesConfigurationModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesJvm model + removePrestissimoEnginePropertiesJvmModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesJvm) + removePrestissimoEnginePropertiesJvmModel.Coordinator = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesLogConfig model + removePrestissimoEnginePropertiesLogConfigModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesLogConfig) + removePrestissimoEnginePropertiesLogConfigModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesLogConfigModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEngineProperties model + removePrestissimoEnginePropertiesModel := new(watsonxdatav3.RemovePrestissimoEngineProperties) + removePrestissimoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel} + removePrestissimoEnginePropertiesModel.Configuration = removePrestissimoEnginePropertiesConfigurationModel + removePrestissimoEnginePropertiesModel.Global = []string{"testString"} + removePrestissimoEnginePropertiesModel.Jvm = removePrestissimoEnginePropertiesJvmModel + removePrestissimoEnginePropertiesModel.LogConfig = removePrestissimoEnginePropertiesLogConfigModel + removePrestissimoEnginePropertiesModel.OptimizerProperties = []string{"testString"} + removePrestissimoEnginePropertiesModel.Velox = []string{"testString"} + removePrestissimoEnginePropertiesModel.Catalog["foo"] = *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the PrestissimoEnginePatch model + prestissimoEnginePatchModel := new(watsonxdatav3.PrestissimoEnginePatch) + prestissimoEnginePatchModel.Description = core.StringPtr("updated description for prestissimo engine") + prestissimoEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + prestissimoEnginePatchModel.Properties = prestissimoEnginePropertiesModel + prestissimoEnginePatchModel.RemoveEngineProperties = removePrestissimoEnginePropertiesModel + prestissimoEnginePatchModel.RestartType = core.StringPtr("force") + prestissimoEnginePatchModel.Tags = []string{"tag1", "tag2"} + prestissimoEnginePatchModelAsPatch, asPatchErr := prestissimoEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePrestissimoEngineOptions model + updatePrestissimoEngineOptionsModel := new(watsonxdatav3.UpdatePrestissimoEngineOptions) + updatePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + updatePrestissimoEngineOptionsModel.Body = prestissimoEnginePatchModelAsPatch + updatePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetServiceDetailWithContext(ctx, getServiceDetailOptionsModel) + _, _, operationErr := watsonxDataService.UpdatePrestissimoEngineWithContext(ctx, updatePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetServiceDetail(getServiceDetailOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -9760,7 +10563,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetServiceDetailWithContext(ctx, getServiceDetailOptionsModel) + _, _, operationErr = watsonxDataService.UpdatePrestissimoEngineWithContext(ctx, updatePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -9774,22 +10577,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getServiceDetailPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updatePrestissimoEnginePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["target"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["database"]).To(Equal([]string{"testString"})) - // TODO: Add check for internal_host query parameter // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"connection_name": "presto-01", "details": {"ca_certificate": "sample ca certificate", "default_configs": {"mapKey": "Inner"}, "external": {"port": 4553, "hostname": "external hostname"}, "grpc_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "hostname": "sample hostname", "id": "sample ID", "instance_crn": "sample instance CRN", "instance_id": "sample instance ID", "internal": {"port": 4553, "hostname": "internal hostname"}, "jdbc_class": "com.facebook.presto.jdbc.PrestoDriver", "jdbc_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "name": "sample name", "port": 4553, "rest_api_endpoint": {"port": 4553, "hostname": "internal hostname"}, "spark_engine_endpoint": "Spark Engine endpoint", "ssl_certificate": "sample ssl certificate", "thrift_urls": {"external": "thrift://username:password@metastore1-internal-hostname:9083", "internal": "thrift://username:password@metastore1-internal-hostname:9083"}, "version": "java", "watsonx_data_application_endpoint": "sample application end point"}, "properties": {"connection": [{"name": "host", "value": "sample_value"}]}, "type": "presto"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "analyze_status": "not_started", "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"coordinator": {"node_type": "worker", "quantity": 1}, "size_config": "starter", "worker": {"node_type": "worker", "quantity": 1}}, "coordinator": {"node_type": "worker", "quantity": 1}, "created_at": 0, "created_by": "@.com", "description": "prestissimo engine for running sql queries", "display_name": "sampleEngine", "external_host_name": "your-hostname.apps.your-domain.com", "failure_message": "Failed to start engine", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "id": "prestissimo123", "is_qhmm_engine": true, "last_time_analyzed": "not_started", "optimizer_enabled": "false", "origin": "native", "port": 0, "properties": {"catalog": {"mapKey": {"coordinator": {"anyKey": "anyValue"}, "worker": {"anyKey": "anyValue"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "global": {"mapKey": "Inner"}, "jvm": {"coordinator": {"mapKey": "Inner"}}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "optimizer_properties": {"mapKey": "Inner"}, "velox": {"mapKey": "Inner"}}, "query_status": "completed", "region": "us-south", "size_config": "starter", "status": "running", "status_code": 0, "tags": ["Tags"], "remove_engine_properties": {"catalog": {"mapKey": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "global": ["Global"], "jvm": {"coordinator": ["Coordinator"]}, "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "optimizer_properties": ["OptimizerProperties"], "velox": ["Velox"]}, "restart_type": "force", "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 1}}`) })) }) - It(`Invoke GetServiceDetail successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -9797,57 +10613,193 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetServiceDetail(nil) + result, response, operationErr := watsonxDataService.UpdatePrestissimoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetServiceDetailOptions model - getServiceDetailOptionsModel := new(watsonxdatav2.GetServiceDetailOptions) - getServiceDetailOptionsModel.Target = core.StringPtr("testString") - getServiceDetailOptionsModel.EngineOrServiceType = core.StringPtr("testString") - getServiceDetailOptionsModel.ID = core.StringPtr("testString") - getServiceDetailOptionsModel.Database = core.StringPtr("testString") - getServiceDetailOptionsModel.InternalHost = core.BoolPtr(false) - getServiceDetailOptionsModel.AuthInstanceID = core.StringPtr("testString") - getServiceDetailOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PrestissimoEnginePropertiesCatalogAdditionalProperties model + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties) + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Worker = map[string]interface{}{"anyKey": "anyValue"} + + // Construct an instance of the PrestissimoEnginePropertiesConfiguration model + prestissimoEnginePropertiesConfigurationModel := new(watsonxdatav3.PrestissimoEnginePropertiesConfiguration) + prestissimoEnginePropertiesConfigurationModel.Coordinator = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesConfigurationModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEnginePropertiesJvm model + prestissimoEnginePropertiesJvmModel := new(watsonxdatav3.PrestissimoEnginePropertiesJvm) + prestissimoEnginePropertiesJvmModel.Coordinator = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEnginePropertiesLogConfig model + prestissimoEnginePropertiesLogConfigModel := new(watsonxdatav3.PrestissimoEnginePropertiesLogConfig) + prestissimoEnginePropertiesLogConfigModel.Coordinator = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesLogConfigModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEngineProperties model + prestissimoEnginePropertiesModel := new(watsonxdatav3.PrestissimoEngineProperties) + prestissimoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel} + prestissimoEnginePropertiesModel.Configuration = prestissimoEnginePropertiesConfigurationModel + prestissimoEnginePropertiesModel.Global = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Jvm = prestissimoEnginePropertiesJvmModel + prestissimoEnginePropertiesModel.LogConfig = prestissimoEnginePropertiesLogConfigModel + prestissimoEnginePropertiesModel.OptimizerProperties = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Velox = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Catalog["foo"] = *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the RemovePrestissimoEnginePropertiesCatalogAdditionalProperties model + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties) + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesConfiguration model + removePrestissimoEnginePropertiesConfigurationModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesConfiguration) + removePrestissimoEnginePropertiesConfigurationModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesConfigurationModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesJvm model + removePrestissimoEnginePropertiesJvmModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesJvm) + removePrestissimoEnginePropertiesJvmModel.Coordinator = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesLogConfig model + removePrestissimoEnginePropertiesLogConfigModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesLogConfig) + removePrestissimoEnginePropertiesLogConfigModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesLogConfigModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEngineProperties model + removePrestissimoEnginePropertiesModel := new(watsonxdatav3.RemovePrestissimoEngineProperties) + removePrestissimoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel} + removePrestissimoEnginePropertiesModel.Configuration = removePrestissimoEnginePropertiesConfigurationModel + removePrestissimoEnginePropertiesModel.Global = []string{"testString"} + removePrestissimoEnginePropertiesModel.Jvm = removePrestissimoEnginePropertiesJvmModel + removePrestissimoEnginePropertiesModel.LogConfig = removePrestissimoEnginePropertiesLogConfigModel + removePrestissimoEnginePropertiesModel.OptimizerProperties = []string{"testString"} + removePrestissimoEnginePropertiesModel.Velox = []string{"testString"} + removePrestissimoEnginePropertiesModel.Catalog["foo"] = *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel - // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetServiceDetail(getServiceDetailOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) + // Construct an instance of the PrestissimoEnginePatch model + prestissimoEnginePatchModel := new(watsonxdatav3.PrestissimoEnginePatch) + prestissimoEnginePatchModel.Description = core.StringPtr("updated description for prestissimo engine") + prestissimoEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + prestissimoEnginePatchModel.Properties = prestissimoEnginePropertiesModel + prestissimoEnginePatchModel.RemoveEngineProperties = removePrestissimoEnginePropertiesModel + prestissimoEnginePatchModel.RestartType = core.StringPtr("force") + prestissimoEnginePatchModel.Tags = []string{"tag1", "tag2"} + prestissimoEnginePatchModelAsPatch, asPatchErr := prestissimoEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePrestissimoEngineOptions model + updatePrestissimoEngineOptionsModel := new(watsonxdatav3.UpdatePrestissimoEngineOptions) + updatePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + updatePrestissimoEngineOptionsModel.Body = prestissimoEnginePatchModelAsPatch + updatePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) }) - It(`Invoke GetServiceDetail with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestissimoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetServiceDetailOptions model - getServiceDetailOptionsModel := new(watsonxdatav2.GetServiceDetailOptions) - getServiceDetailOptionsModel.Target = core.StringPtr("testString") - getServiceDetailOptionsModel.EngineOrServiceType = core.StringPtr("testString") - getServiceDetailOptionsModel.ID = core.StringPtr("testString") - getServiceDetailOptionsModel.Database = core.StringPtr("testString") - getServiceDetailOptionsModel.InternalHost = core.BoolPtr(false) - getServiceDetailOptionsModel.AuthInstanceID = core.StringPtr("testString") - getServiceDetailOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PrestissimoEnginePropertiesCatalogAdditionalProperties model + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties) + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Worker = map[string]interface{}{"anyKey": "anyValue"} + + // Construct an instance of the PrestissimoEnginePropertiesConfiguration model + prestissimoEnginePropertiesConfigurationModel := new(watsonxdatav3.PrestissimoEnginePropertiesConfiguration) + prestissimoEnginePropertiesConfigurationModel.Coordinator = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesConfigurationModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEnginePropertiesJvm model + prestissimoEnginePropertiesJvmModel := new(watsonxdatav3.PrestissimoEnginePropertiesJvm) + prestissimoEnginePropertiesJvmModel.Coordinator = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEnginePropertiesLogConfig model + prestissimoEnginePropertiesLogConfigModel := new(watsonxdatav3.PrestissimoEnginePropertiesLogConfig) + prestissimoEnginePropertiesLogConfigModel.Coordinator = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesLogConfigModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEngineProperties model + prestissimoEnginePropertiesModel := new(watsonxdatav3.PrestissimoEngineProperties) + prestissimoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel} + prestissimoEnginePropertiesModel.Configuration = prestissimoEnginePropertiesConfigurationModel + prestissimoEnginePropertiesModel.Global = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Jvm = prestissimoEnginePropertiesJvmModel + prestissimoEnginePropertiesModel.LogConfig = prestissimoEnginePropertiesLogConfigModel + prestissimoEnginePropertiesModel.OptimizerProperties = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Velox = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Catalog["foo"] = *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the RemovePrestissimoEnginePropertiesCatalogAdditionalProperties model + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties) + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesConfiguration model + removePrestissimoEnginePropertiesConfigurationModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesConfiguration) + removePrestissimoEnginePropertiesConfigurationModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesConfigurationModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesJvm model + removePrestissimoEnginePropertiesJvmModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesJvm) + removePrestissimoEnginePropertiesJvmModel.Coordinator = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesLogConfig model + removePrestissimoEnginePropertiesLogConfigModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesLogConfig) + removePrestissimoEnginePropertiesLogConfigModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesLogConfigModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEngineProperties model + removePrestissimoEnginePropertiesModel := new(watsonxdatav3.RemovePrestissimoEngineProperties) + removePrestissimoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel} + removePrestissimoEnginePropertiesModel.Configuration = removePrestissimoEnginePropertiesConfigurationModel + removePrestissimoEnginePropertiesModel.Global = []string{"testString"} + removePrestissimoEnginePropertiesModel.Jvm = removePrestissimoEnginePropertiesJvmModel + removePrestissimoEnginePropertiesModel.LogConfig = removePrestissimoEnginePropertiesLogConfigModel + removePrestissimoEnginePropertiesModel.OptimizerProperties = []string{"testString"} + removePrestissimoEnginePropertiesModel.Velox = []string{"testString"} + removePrestissimoEnginePropertiesModel.Catalog["foo"] = *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the PrestissimoEnginePatch model + prestissimoEnginePatchModel := new(watsonxdatav3.PrestissimoEnginePatch) + prestissimoEnginePatchModel.Description = core.StringPtr("updated description for prestissimo engine") + prestissimoEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + prestissimoEnginePatchModel.Properties = prestissimoEnginePropertiesModel + prestissimoEnginePatchModel.RemoveEngineProperties = removePrestissimoEnginePropertiesModel + prestissimoEnginePatchModel.RestartType = core.StringPtr("force") + prestissimoEnginePatchModel.Tags = []string{"tag1", "tag2"} + prestissimoEnginePatchModelAsPatch, asPatchErr := prestissimoEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePrestissimoEngineOptions model + updatePrestissimoEngineOptionsModel := new(watsonxdatav3.UpdatePrestissimoEngineOptions) + updatePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + updatePrestissimoEngineOptionsModel.Body = prestissimoEnginePatchModelAsPatch + updatePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetServiceDetail(getServiceDetailOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetServiceDetailOptions model with no property values - getServiceDetailOptionsModelNew := new(watsonxdatav2.GetServiceDetailOptions) + // Construct a second instance of the UpdatePrestissimoEngineOptions model with no property values + updatePrestissimoEngineOptionsModelNew := new(watsonxdatav3.UpdatePrestissimoEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetServiceDetail(getServiceDetailOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -9865,26 +10817,94 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetServiceDetail successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdatePrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetServiceDetailOptions model - getServiceDetailOptionsModel := new(watsonxdatav2.GetServiceDetailOptions) - getServiceDetailOptionsModel.Target = core.StringPtr("testString") - getServiceDetailOptionsModel.EngineOrServiceType = core.StringPtr("testString") - getServiceDetailOptionsModel.ID = core.StringPtr("testString") - getServiceDetailOptionsModel.Database = core.StringPtr("testString") - getServiceDetailOptionsModel.InternalHost = core.BoolPtr(false) - getServiceDetailOptionsModel.AuthInstanceID = core.StringPtr("testString") - getServiceDetailOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PrestissimoEnginePropertiesCatalogAdditionalProperties model + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties) + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + prestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Worker = map[string]interface{}{"anyKey": "anyValue"} + + // Construct an instance of the PrestissimoEnginePropertiesConfiguration model + prestissimoEnginePropertiesConfigurationModel := new(watsonxdatav3.PrestissimoEnginePropertiesConfiguration) + prestissimoEnginePropertiesConfigurationModel.Coordinator = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesConfigurationModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEnginePropertiesJvm model + prestissimoEnginePropertiesJvmModel := new(watsonxdatav3.PrestissimoEnginePropertiesJvm) + prestissimoEnginePropertiesJvmModel.Coordinator = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEnginePropertiesLogConfig model + prestissimoEnginePropertiesLogConfigModel := new(watsonxdatav3.PrestissimoEnginePropertiesLogConfig) + prestissimoEnginePropertiesLogConfigModel.Coordinator = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesLogConfigModel.Worker = map[string]string{"key1": "testString"} + + // Construct an instance of the PrestissimoEngineProperties model + prestissimoEnginePropertiesModel := new(watsonxdatav3.PrestissimoEngineProperties) + prestissimoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel} + prestissimoEnginePropertiesModel.Configuration = prestissimoEnginePropertiesConfigurationModel + prestissimoEnginePropertiesModel.Global = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Jvm = prestissimoEnginePropertiesJvmModel + prestissimoEnginePropertiesModel.LogConfig = prestissimoEnginePropertiesLogConfigModel + prestissimoEnginePropertiesModel.OptimizerProperties = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Velox = map[string]string{"key1": "testString"} + prestissimoEnginePropertiesModel.Catalog["foo"] = *prestissimoEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the RemovePrestissimoEnginePropertiesCatalogAdditionalProperties model + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties) + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesConfiguration model + removePrestissimoEnginePropertiesConfigurationModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesConfiguration) + removePrestissimoEnginePropertiesConfigurationModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesConfigurationModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesJvm model + removePrestissimoEnginePropertiesJvmModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesJvm) + removePrestissimoEnginePropertiesJvmModel.Coordinator = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEnginePropertiesLogConfig model + removePrestissimoEnginePropertiesLogConfigModel := new(watsonxdatav3.RemovePrestissimoEnginePropertiesLogConfig) + removePrestissimoEnginePropertiesLogConfigModel.Coordinator = []string{"testString"} + removePrestissimoEnginePropertiesLogConfigModel.Worker = []string{"testString"} + + // Construct an instance of the RemovePrestissimoEngineProperties model + removePrestissimoEnginePropertiesModel := new(watsonxdatav3.RemovePrestissimoEngineProperties) + removePrestissimoEnginePropertiesModel.Catalog = map[string]watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel} + removePrestissimoEnginePropertiesModel.Configuration = removePrestissimoEnginePropertiesConfigurationModel + removePrestissimoEnginePropertiesModel.Global = []string{"testString"} + removePrestissimoEnginePropertiesModel.Jvm = removePrestissimoEnginePropertiesJvmModel + removePrestissimoEnginePropertiesModel.LogConfig = removePrestissimoEnginePropertiesLogConfigModel + removePrestissimoEnginePropertiesModel.OptimizerProperties = []string{"testString"} + removePrestissimoEnginePropertiesModel.Velox = []string{"testString"} + removePrestissimoEnginePropertiesModel.Catalog["foo"] = *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel + + // Construct an instance of the PrestissimoEnginePatch model + prestissimoEnginePatchModel := new(watsonxdatav3.PrestissimoEnginePatch) + prestissimoEnginePatchModel.Description = core.StringPtr("updated description for prestissimo engine") + prestissimoEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + prestissimoEnginePatchModel.Properties = prestissimoEnginePropertiesModel + prestissimoEnginePatchModel.RemoveEngineProperties = removePrestissimoEnginePropertiesModel + prestissimoEnginePatchModel.RestartType = core.StringPtr("force") + prestissimoEnginePatchModel.Tags = []string{"tag1", "tag2"} + prestissimoEnginePatchModelAsPatch, asPatchErr := prestissimoEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdatePrestissimoEngineOptions model + updatePrestissimoEngineOptionsModel := new(watsonxdatav3.UpdatePrestissimoEngineOptions) + updatePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + updatePrestissimoEngineOptionsModel.Body = prestissimoEnginePatchModelAsPatch + updatePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updatePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetServiceDetail(getServiceDetailOptionsModel) + result, response, operationErr := watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -9896,15 +10916,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListPrestissimoEngines(listPrestissimoEnginesOptions *ListPrestissimoEnginesOptions) - Operation response error`, func() { - listPrestissimoEnginesPath := "/prestissimo_engines" + Describe(`ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptions *ListPrestissimoEngineCatalogsOptions) - Operation response error`, func() { + listPrestissimoEngineCatalogsPath := "/v3/prestissimo_engines/testString/catalogs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEngineCatalogsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -9913,27 +10933,28 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListPrestissimoEngines with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestissimoEngineCatalogs with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestissimoEnginesOptions model - listPrestissimoEnginesOptionsModel := new(watsonxdatav2.ListPrestissimoEnginesOptions) - listPrestissimoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestissimoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestissimoEngineCatalogsOptions model + listPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.ListPrestissimoEngineCatalogsOptions) + listPrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + listPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) + result, response, operationErr = watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -9943,15 +10964,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListPrestissimoEngines(listPrestissimoEnginesOptions *ListPrestissimoEnginesOptions)`, func() { - listPrestissimoEnginesPath := "/prestissimo_engines" + Describe(`ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptions *ListPrestissimoEngineCatalogsOptions)`, func() { + listPrestissimoEngineCatalogsPath := "/v3/prestissimo_engines/testString/catalogs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEngineCatalogsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -9962,11 +10983,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"prestissimo_engines": [{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "worker", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "prestissimo engine for running sql queries", "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications"}, "instance_id": "instance_id", "managed_by": "fully/self", "metastore_host": "1.2.3.4", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"node_type": "worker", "quantity": 8}, "worker": {"node_type": "worker", "quantity": 8}}, "velox": {"velox_property": ["VeloxProperty"]}, "jvm": {"coordinator": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": ["CatalogName"]}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"]}, "velox": ["Velox"]}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 8}}]}`) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke ListPrestissimoEngines successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestissimoEngineCatalogs successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -9974,21 +10995,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListPrestissimoEnginesOptions model - listPrestissimoEnginesOptionsModel := new(watsonxdatav2.ListPrestissimoEnginesOptions) - listPrestissimoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestissimoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestissimoEngineCatalogsOptions model + listPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.ListPrestissimoEngineCatalogsOptions) + listPrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + listPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListPrestissimoEnginesWithContext(ctx, listPrestissimoEnginesOptionsModel) + _, _, operationErr := watsonxDataService.ListPrestissimoEngineCatalogsWithContext(ctx, listPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -9996,7 +11018,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListPrestissimoEnginesWithContext(ctx, listPrestissimoEnginesOptionsModel) + _, _, operationErr = watsonxDataService.ListPrestissimoEngineCatalogsWithContext(ctx, listPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -10010,7 +11032,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEngineCatalogsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -10018,11 +11040,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"prestissimo_engines": [{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "worker", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "prestissimo engine for running sql queries", "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications"}, "instance_id": "instance_id", "managed_by": "fully/self", "metastore_host": "1.2.3.4", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"node_type": "worker", "quantity": 8}, "worker": {"node_type": "worker", "quantity": 8}}, "velox": {"velox_property": ["VeloxProperty"]}, "jvm": {"coordinator": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": ["CatalogName"]}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"]}, "velox": ["Velox"]}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 8}}]}`) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke ListPrestissimoEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestissimoEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -10030,43 +11052,52 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListPrestissimoEngines(nil) + result, response, operationErr := watsonxDataService.ListPrestissimoEngineCatalogs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListPrestissimoEnginesOptions model - listPrestissimoEnginesOptionsModel := new(watsonxdatav2.ListPrestissimoEnginesOptions) - listPrestissimoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestissimoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestissimoEngineCatalogsOptions model + listPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.ListPrestissimoEngineCatalogsOptions) + listPrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + listPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) + result, response, operationErr = watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListPrestissimoEngines with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestissimoEngineCatalogs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestissimoEnginesOptions model - listPrestissimoEnginesOptionsModel := new(watsonxdatav2.ListPrestissimoEnginesOptions) - listPrestissimoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestissimoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestissimoEngineCatalogsOptions model + listPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.ListPrestissimoEngineCatalogsOptions) + listPrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + listPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the ListPrestissimoEngineCatalogsOptions model with no property values + listPrestissimoEngineCatalogsOptionsModelNew := new(watsonxdatav3.ListPrestissimoEngineCatalogsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -10081,21 +11112,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListPrestissimoEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListPrestissimoEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestissimoEnginesOptions model - listPrestissimoEnginesOptionsModel := new(watsonxdatav2.ListPrestissimoEnginesOptions) - listPrestissimoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestissimoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListPrestissimoEngineCatalogsOptions model + listPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.ListPrestissimoEngineCatalogsOptions) + listPrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + listPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListPrestissimoEngines(listPrestissimoEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -10107,15 +11139,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreatePrestissimoEngine(createPrestissimoEngineOptions *CreatePrestissimoEngineOptions) - Operation response error`, func() { - createPrestissimoEnginePath := "/prestissimo_engines" + Describe(`CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptions *CreatePrestissimoEngineCatalogsOptions) - Operation response error`, func() { + createPrestissimoEngineCatalogsPath := "/v3/prestissimo_engines/testString/catalogs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEngineCatalogsPath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -10124,62 +11156,29 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreatePrestissimoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestissimoEngineCatalogs with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the PrestissimoEndpoints model - prestissimoEndpointsModel := new(watsonxdatav2.PrestissimoEndpoints) - prestissimoEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/") - prestissimoEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") - prestissimoEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-") - prestissimoEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") - prestissimoEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") - prestissimoEndpointsModel.ViewHistoryServer = core.StringPtr("testString") - prestissimoEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") - - // Construct an instance of the PrestissimoEngineDetails model - prestissimoEngineDetailsModel := new(watsonxdatav2.PrestissimoEngineDetails) - prestissimoEngineDetailsModel.ApiKey = core.StringPtr("") - prestissimoEngineDetailsModel.ConnectionString = core.StringPtr("1.2.3.4") - prestissimoEngineDetailsModel.Coordinator = prestissimoNodeDescriptionBodyModel - prestissimoEngineDetailsModel.Endpoints = prestissimoEndpointsModel - prestissimoEngineDetailsModel.InstanceID = core.StringPtr("instance_id") - prestissimoEngineDetailsModel.ManagedBy = core.StringPtr("fully/self") - prestissimoEngineDetailsModel.MetastoreHost = core.StringPtr("1.2.3.4") - prestissimoEngineDetailsModel.SizeConfig = core.StringPtr("starter") - prestissimoEngineDetailsModel.Worker = prestissimoNodeDescriptionBodyModel - - // Construct an instance of the CreatePrestissimoEngineOptions model - createPrestissimoEngineOptionsModel := new(watsonxdatav2.CreatePrestissimoEngineOptions) - createPrestissimoEngineOptionsModel.Origin = core.StringPtr("native") - createPrestissimoEngineOptionsModel.AssociatedCatalogs = []string{"hive_data"} - createPrestissimoEngineOptionsModel.Description = core.StringPtr("prestissimo engine description") - createPrestissimoEngineOptionsModel.EngineDetails = prestissimoEngineDetailsModel - createPrestissimoEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createPrestissimoEngineOptionsModel.Region = core.StringPtr("us-south") - createPrestissimoEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createPrestissimoEngineOptionsModel.Version = core.StringPtr("1.2.3") - createPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreatePrestissimoEngineCatalogsOptions model + createPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.CreatePrestissimoEngineCatalogsOptions) + createPrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + createPrestissimoEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -10189,15 +11188,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreatePrestissimoEngine(createPrestissimoEngineOptions *CreatePrestissimoEngineOptions)`, func() { - createPrestissimoEnginePath := "/prestissimo_engines" + Describe(`CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptions *CreatePrestissimoEngineCatalogsOptions)`, func() { + createPrestissimoEngineCatalogsPath := "/v3/prestissimo_engines/testString/catalogs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEngineCatalogsPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -10224,11 +11223,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "worker", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "prestissimo engine for running sql queries", "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications"}, "instance_id": "instance_id", "managed_by": "fully/self", "metastore_host": "1.2.3.4", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"node_type": "worker", "quantity": 8}, "worker": {"node_type": "worker", "quantity": 8}}, "velox": {"velox_property": ["VeloxProperty"]}, "jvm": {"coordinator": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": ["CatalogName"]}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"]}, "velox": ["Velox"]}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 8}}`) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke CreatePrestissimoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestissimoEngineCatalogs successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -10236,56 +11235,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the PrestissimoEndpoints model - prestissimoEndpointsModel := new(watsonxdatav2.PrestissimoEndpoints) - prestissimoEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/") - prestissimoEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") - prestissimoEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-") - prestissimoEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") - prestissimoEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") - prestissimoEndpointsModel.ViewHistoryServer = core.StringPtr("testString") - prestissimoEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") - - // Construct an instance of the PrestissimoEngineDetails model - prestissimoEngineDetailsModel := new(watsonxdatav2.PrestissimoEngineDetails) - prestissimoEngineDetailsModel.ApiKey = core.StringPtr("") - prestissimoEngineDetailsModel.ConnectionString = core.StringPtr("1.2.3.4") - prestissimoEngineDetailsModel.Coordinator = prestissimoNodeDescriptionBodyModel - prestissimoEngineDetailsModel.Endpoints = prestissimoEndpointsModel - prestissimoEngineDetailsModel.InstanceID = core.StringPtr("instance_id") - prestissimoEngineDetailsModel.ManagedBy = core.StringPtr("fully/self") - prestissimoEngineDetailsModel.MetastoreHost = core.StringPtr("1.2.3.4") - prestissimoEngineDetailsModel.SizeConfig = core.StringPtr("starter") - prestissimoEngineDetailsModel.Worker = prestissimoNodeDescriptionBodyModel - - // Construct an instance of the CreatePrestissimoEngineOptions model - createPrestissimoEngineOptionsModel := new(watsonxdatav2.CreatePrestissimoEngineOptions) - createPrestissimoEngineOptionsModel.Origin = core.StringPtr("native") - createPrestissimoEngineOptionsModel.AssociatedCatalogs = []string{"hive_data"} - createPrestissimoEngineOptionsModel.Description = core.StringPtr("prestissimo engine description") - createPrestissimoEngineOptionsModel.EngineDetails = prestissimoEngineDetailsModel - createPrestissimoEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createPrestissimoEngineOptionsModel.Region = core.StringPtr("us-south") - createPrestissimoEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createPrestissimoEngineOptionsModel.Version = core.StringPtr("1.2.3") - createPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreatePrestissimoEngineCatalogsOptions model + createPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.CreatePrestissimoEngineCatalogsOptions) + createPrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + createPrestissimoEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreatePrestissimoEngineWithContext(ctx, createPrestissimoEngineOptionsModel) + _, _, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogsWithContext(ctx, createPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -10293,7 +11259,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreatePrestissimoEngineWithContext(ctx, createPrestissimoEngineOptionsModel) + _, _, operationErr = watsonxDataService.CreatePrestissimoEngineCatalogsWithContext(ctx, createPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -10307,7 +11273,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEngineCatalogsPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -10331,11 +11297,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "worker", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "prestissimo engine for running sql queries", "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications"}, "instance_id": "instance_id", "managed_by": "fully/self", "metastore_host": "1.2.3.4", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"node_type": "worker", "quantity": 8}, "worker": {"node_type": "worker", "quantity": 8}}, "velox": {"velox_property": ["VeloxProperty"]}, "jvm": {"coordinator": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": ["CatalogName"]}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"]}, "velox": ["Velox"]}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 8}}`) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke CreatePrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestissimoEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -10343,117 +11309,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreatePrestissimoEngine(nil) + result, response, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the PrestissimoEndpoints model - prestissimoEndpointsModel := new(watsonxdatav2.PrestissimoEndpoints) - prestissimoEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/") - prestissimoEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") - prestissimoEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-") - prestissimoEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") - prestissimoEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") - prestissimoEndpointsModel.ViewHistoryServer = core.StringPtr("testString") - prestissimoEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") - - // Construct an instance of the PrestissimoEngineDetails model - prestissimoEngineDetailsModel := new(watsonxdatav2.PrestissimoEngineDetails) - prestissimoEngineDetailsModel.ApiKey = core.StringPtr("") - prestissimoEngineDetailsModel.ConnectionString = core.StringPtr("1.2.3.4") - prestissimoEngineDetailsModel.Coordinator = prestissimoNodeDescriptionBodyModel - prestissimoEngineDetailsModel.Endpoints = prestissimoEndpointsModel - prestissimoEngineDetailsModel.InstanceID = core.StringPtr("instance_id") - prestissimoEngineDetailsModel.ManagedBy = core.StringPtr("fully/self") - prestissimoEngineDetailsModel.MetastoreHost = core.StringPtr("1.2.3.4") - prestissimoEngineDetailsModel.SizeConfig = core.StringPtr("starter") - prestissimoEngineDetailsModel.Worker = prestissimoNodeDescriptionBodyModel - - // Construct an instance of the CreatePrestissimoEngineOptions model - createPrestissimoEngineOptionsModel := new(watsonxdatav2.CreatePrestissimoEngineOptions) - createPrestissimoEngineOptionsModel.Origin = core.StringPtr("native") - createPrestissimoEngineOptionsModel.AssociatedCatalogs = []string{"hive_data"} - createPrestissimoEngineOptionsModel.Description = core.StringPtr("prestissimo engine description") - createPrestissimoEngineOptionsModel.EngineDetails = prestissimoEngineDetailsModel - createPrestissimoEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createPrestissimoEngineOptionsModel.Region = core.StringPtr("us-south") - createPrestissimoEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createPrestissimoEngineOptionsModel.Version = core.StringPtr("1.2.3") - createPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreatePrestissimoEngineCatalogsOptions model + createPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.CreatePrestissimoEngineCatalogsOptions) + createPrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + createPrestissimoEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreatePrestissimoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestissimoEngineCatalogs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the PrestissimoEndpoints model - prestissimoEndpointsModel := new(watsonxdatav2.PrestissimoEndpoints) - prestissimoEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/") - prestissimoEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") - prestissimoEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-") - prestissimoEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") - prestissimoEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") - prestissimoEndpointsModel.ViewHistoryServer = core.StringPtr("testString") - prestissimoEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") - - // Construct an instance of the PrestissimoEngineDetails model - prestissimoEngineDetailsModel := new(watsonxdatav2.PrestissimoEngineDetails) - prestissimoEngineDetailsModel.ApiKey = core.StringPtr("") - prestissimoEngineDetailsModel.ConnectionString = core.StringPtr("1.2.3.4") - prestissimoEngineDetailsModel.Coordinator = prestissimoNodeDescriptionBodyModel - prestissimoEngineDetailsModel.Endpoints = prestissimoEndpointsModel - prestissimoEngineDetailsModel.InstanceID = core.StringPtr("instance_id") - prestissimoEngineDetailsModel.ManagedBy = core.StringPtr("fully/self") - prestissimoEngineDetailsModel.MetastoreHost = core.StringPtr("1.2.3.4") - prestissimoEngineDetailsModel.SizeConfig = core.StringPtr("starter") - prestissimoEngineDetailsModel.Worker = prestissimoNodeDescriptionBodyModel - - // Construct an instance of the CreatePrestissimoEngineOptions model - createPrestissimoEngineOptionsModel := new(watsonxdatav2.CreatePrestissimoEngineOptions) - createPrestissimoEngineOptionsModel.Origin = core.StringPtr("native") - createPrestissimoEngineOptionsModel.AssociatedCatalogs = []string{"hive_data"} - createPrestissimoEngineOptionsModel.Description = core.StringPtr("prestissimo engine description") - createPrestissimoEngineOptionsModel.EngineDetails = prestissimoEngineDetailsModel - createPrestissimoEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createPrestissimoEngineOptionsModel.Region = core.StringPtr("us-south") - createPrestissimoEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createPrestissimoEngineOptionsModel.Version = core.StringPtr("1.2.3") - createPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreatePrestissimoEngineCatalogsOptions model + createPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.CreatePrestissimoEngineCatalogsOptions) + createPrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + createPrestissimoEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreatePrestissimoEngineOptions model with no property values - createPrestissimoEngineOptionsModelNew := new(watsonxdatav2.CreatePrestissimoEngineOptions) + // Construct a second instance of the CreatePrestissimoEngineCatalogsOptions model with no property values + createPrestissimoEngineCatalogsOptionsModelNew := new(watsonxdatav3.CreatePrestissimoEngineCatalogsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -10471,56 +11371,23 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreatePrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreatePrestissimoEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the PrestissimoEndpoints model - prestissimoEndpointsModel := new(watsonxdatav2.PrestissimoEndpoints) - prestissimoEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/") - prestissimoEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") - prestissimoEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-") - prestissimoEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") - prestissimoEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") - prestissimoEndpointsModel.ViewHistoryServer = core.StringPtr("testString") - prestissimoEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") - - // Construct an instance of the PrestissimoEngineDetails model - prestissimoEngineDetailsModel := new(watsonxdatav2.PrestissimoEngineDetails) - prestissimoEngineDetailsModel.ApiKey = core.StringPtr("") - prestissimoEngineDetailsModel.ConnectionString = core.StringPtr("1.2.3.4") - prestissimoEngineDetailsModel.Coordinator = prestissimoNodeDescriptionBodyModel - prestissimoEngineDetailsModel.Endpoints = prestissimoEndpointsModel - prestissimoEngineDetailsModel.InstanceID = core.StringPtr("instance_id") - prestissimoEngineDetailsModel.ManagedBy = core.StringPtr("fully/self") - prestissimoEngineDetailsModel.MetastoreHost = core.StringPtr("1.2.3.4") - prestissimoEngineDetailsModel.SizeConfig = core.StringPtr("starter") - prestissimoEngineDetailsModel.Worker = prestissimoNodeDescriptionBodyModel - - // Construct an instance of the CreatePrestissimoEngineOptions model - createPrestissimoEngineOptionsModel := new(watsonxdatav2.CreatePrestissimoEngineOptions) - createPrestissimoEngineOptionsModel.Origin = core.StringPtr("native") - createPrestissimoEngineOptionsModel.AssociatedCatalogs = []string{"hive_data"} - createPrestissimoEngineOptionsModel.Description = core.StringPtr("prestissimo engine description") - createPrestissimoEngineOptionsModel.EngineDetails = prestissimoEngineDetailsModel - createPrestissimoEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createPrestissimoEngineOptionsModel.Region = core.StringPtr("us-south") - createPrestissimoEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createPrestissimoEngineOptionsModel.Version = core.StringPtr("1.2.3") - createPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreatePrestissimoEngineCatalogsOptions model + createPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.CreatePrestissimoEngineCatalogsOptions) + createPrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + createPrestissimoEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreatePrestissimoEngine(createPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -10532,16 +11399,91 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetPrestissimoEngine(getPrestissimoEngineOptions *GetPrestissimoEngineOptions) - Operation response error`, func() { - getPrestissimoEnginePath := "/prestissimo_engines/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptions *DeletePrestissimoEngineCatalogsOptions)`, func() { + deletePrestissimoEngineCatalogsPath := "/v3/prestissimo_engines/testString/catalogs" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEnginePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deletePrestissimoEngineCatalogsPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["catalog_names"]).To(Equal([]string{"testString"})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeletePrestissimoEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeletePrestissimoEngineCatalogs(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeletePrestissimoEngineCatalogsOptions model + deletePrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.DeletePrestissimoEngineCatalogsOptions) + deletePrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + deletePrestissimoEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") + deletePrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + deletePrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeletePrestissimoEngineCatalogs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DeletePrestissimoEngineCatalogsOptions model + deletePrestissimoEngineCatalogsOptionsModel := new(watsonxdatav3.DeletePrestissimoEngineCatalogsOptions) + deletePrestissimoEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + deletePrestissimoEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") + deletePrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + deletePrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeletePrestissimoEngineCatalogsOptions model with no property values + deletePrestissimoEngineCatalogsOptionsModelNew := new(watsonxdatav3.DeletePrestissimoEngineCatalogsOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`PausePrestissimoEngine(pausePrestissimoEngineOptions *PausePrestissimoEngineOptions) - Operation response error`, func() { + pausePrestissimoEnginePath := "/v3/prestissimo_engines/testString/pause" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(pausePrestissimoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -10549,28 +11491,28 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetPrestissimoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PausePrestissimoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestissimoEngineOptions model - getPrestissimoEngineOptionsModel := new(watsonxdatav2.GetPrestissimoEngineOptions) - getPrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - getPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PausePrestissimoEngineOptions model + pausePrestissimoEngineOptionsModel := new(watsonxdatav3.PausePrestissimoEngineOptions) + pausePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + pausePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pausePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -10580,16 +11522,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetPrestissimoEngine(getPrestissimoEngineOptions *GetPrestissimoEngineOptions)`, func() { - getPrestissimoEnginePath := "/prestissimo_engines/testString" + Describe(`PausePrestissimoEngine(pausePrestissimoEngineOptions *PausePrestissimoEngineOptions)`, func() { + pausePrestissimoEnginePath := "/v3/prestissimo_engines/testString/pause" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEnginePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(pausePrestissimoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -10599,11 +11541,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "worker", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "prestissimo engine for running sql queries", "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications"}, "instance_id": "instance_id", "managed_by": "fully/self", "metastore_host": "1.2.3.4", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"node_type": "worker", "quantity": 8}, "worker": {"node_type": "worker", "quantity": 8}}, "velox": {"velox_property": ["VeloxProperty"]}, "jvm": {"coordinator": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": ["CatalogName"]}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"]}, "velox": ["Velox"]}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 8}}`) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke GetPrestissimoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PausePrestissimoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -10611,22 +11553,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetPrestissimoEngineOptions model - getPrestissimoEngineOptionsModel := new(watsonxdatav2.GetPrestissimoEngineOptions) - getPrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - getPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PausePrestissimoEngineOptions model + pausePrestissimoEngineOptionsModel := new(watsonxdatav3.PausePrestissimoEngineOptions) + pausePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + pausePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pausePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetPrestissimoEngineWithContext(ctx, getPrestissimoEngineOptionsModel) + _, _, operationErr := watsonxDataService.PausePrestissimoEngineWithContext(ctx, pausePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -10634,7 +11576,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetPrestissimoEngineWithContext(ctx, getPrestissimoEngineOptionsModel) + _, _, operationErr = watsonxDataService.PausePrestissimoEngineWithContext(ctx, pausePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -10648,19 +11590,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEnginePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(pausePrestissimoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "worker", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "prestissimo engine for running sql queries", "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications"}, "instance_id": "instance_id", "managed_by": "fully/self", "metastore_host": "1.2.3.4", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"node_type": "worker", "quantity": 8}, "worker": {"node_type": "worker", "quantity": 8}}, "velox": {"velox_property": ["VeloxProperty"]}, "jvm": {"coordinator": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": ["CatalogName"]}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"]}, "velox": ["Velox"]}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 8}}`) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke GetPrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PausePrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -10668,49 +11610,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetPrestissimoEngine(nil) + result, response, operationErr := watsonxDataService.PausePrestissimoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetPrestissimoEngineOptions model - getPrestissimoEngineOptionsModel := new(watsonxdatav2.GetPrestissimoEngineOptions) - getPrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - getPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PausePrestissimoEngineOptions model + pausePrestissimoEngineOptionsModel := new(watsonxdatav3.PausePrestissimoEngineOptions) + pausePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + pausePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pausePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetPrestissimoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PausePrestissimoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestissimoEngineOptions model - getPrestissimoEngineOptionsModel := new(watsonxdatav2.GetPrestissimoEngineOptions) - getPrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - getPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PausePrestissimoEngineOptions model + pausePrestissimoEngineOptionsModel := new(watsonxdatav3.PausePrestissimoEngineOptions) + pausePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + pausePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pausePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetPrestissimoEngineOptions model with no property values - getPrestissimoEngineOptionsModelNew := new(watsonxdatav2.GetPrestissimoEngineOptions) + // Construct a second instance of the PausePrestissimoEngineOptions model with no property values + pausePrestissimoEngineOptionsModelNew := new(watsonxdatav3.PausePrestissimoEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -10728,22 +11670,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetPrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PausePrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestissimoEngineOptions model - getPrestissimoEngineOptionsModel := new(watsonxdatav2.GetPrestissimoEngineOptions) - getPrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - getPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PausePrestissimoEngineOptions model + pausePrestissimoEngineOptionsModel := new(watsonxdatav3.PausePrestissimoEngineOptions) + pausePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + pausePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pausePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetPrestissimoEngine(getPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -10755,88 +11697,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeletePrestissimoEngine(deletePrestissimoEngineOptions *DeletePrestissimoEngineOptions)`, func() { - deletePrestissimoEnginePath := "/prestissimo_engines/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deletePrestissimoEnginePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(204) - })) - }) - It(`Invoke DeletePrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeletePrestissimoEngine(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeletePrestissimoEngineOptions model - deletePrestissimoEngineOptionsModel := new(watsonxdatav2.DeletePrestissimoEngineOptions) - deletePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - deletePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deletePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeletePrestissimoEngine(deletePrestissimoEngineOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeletePrestissimoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeletePrestissimoEngineOptions model - deletePrestissimoEngineOptionsModel := new(watsonxdatav2.DeletePrestissimoEngineOptions) - deletePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - deletePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deletePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeletePrestissimoEngine(deletePrestissimoEngineOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeletePrestissimoEngineOptions model with no property values - deletePrestissimoEngineOptionsModelNew := new(watsonxdatav2.DeletePrestissimoEngineOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeletePrestissimoEngine(deletePrestissimoEngineOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdatePrestissimoEngine(updatePrestissimoEngineOptions *UpdatePrestissimoEngineOptions) - Operation response error`, func() { - updatePrestissimoEnginePath := "/prestissimo_engines/testString" + Describe(`RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptions *RunPrestissimoExplainStatementOptions) - Operation response error`, func() { + runPrestissimoExplainStatementPath := "/v3/prestissimo_engines/testString/query_explain" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updatePrestissimoEnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainStatementPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -10844,94 +11714,33 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdatePrestissimoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunPrestissimoExplainStatement with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the EnginePropertiesCatalog model - enginePropertiesCatalogModel := new(watsonxdatav2.EnginePropertiesCatalog) - enginePropertiesCatalogModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesCatalogModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestissimoPropertiesCatalog model - prestissimoPropertiesCatalogModel := new(watsonxdatav2.PrestissimoPropertiesCatalog) - prestissimoPropertiesCatalogModel.CatalogName = enginePropertiesCatalogModel - - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the EnginePropertiesOaiGenConfiguration model - enginePropertiesOaiGenConfigurationModel := new(watsonxdatav2.EnginePropertiesOaiGenConfiguration) - enginePropertiesOaiGenConfigurationModel.Coordinator = prestissimoNodeDescriptionBodyModel - enginePropertiesOaiGenConfigurationModel.Worker = prestissimoNodeDescriptionBodyModel - - // Construct an instance of the PrestissimoEnginePropertiesVelox model - prestissimoEnginePropertiesVeloxModel := new(watsonxdatav2.PrestissimoEnginePropertiesVelox) - prestissimoEnginePropertiesVeloxModel.VeloxProperty = []string{"testString"} - - // Construct an instance of the PrestissimoEnginePropertiesOaiGen1Jvm model - prestissimoEnginePropertiesOaiGen1JvmModel := new(watsonxdatav2.PrestissimoEnginePropertiesOaiGen1Jvm) - prestissimoEnginePropertiesOaiGen1JvmModel.Coordinator = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestissimoEngineEngineProperties model - prestissimoEngineEnginePropertiesModel := new(watsonxdatav2.PrestissimoEngineEngineProperties) - prestissimoEngineEnginePropertiesModel.Catalog = prestissimoPropertiesCatalogModel - prestissimoEngineEnginePropertiesModel.Configuration = enginePropertiesOaiGenConfigurationModel - prestissimoEngineEnginePropertiesModel.Velox = prestissimoEnginePropertiesVeloxModel - prestissimoEngineEnginePropertiesModel.Jvm = prestissimoEnginePropertiesOaiGen1JvmModel - - // Construct an instance of the PrestissimoEnginePropertiesCatalog model - prestissimoEnginePropertiesCatalogModel := new(watsonxdatav2.PrestissimoEnginePropertiesCatalog) - prestissimoEnginePropertiesCatalogModel.CatalogName = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesConfiguration model - removeEnginePropertiesConfigurationModel := new(watsonxdatav2.RemoveEnginePropertiesConfiguration) - removeEnginePropertiesConfigurationModel.Coordinator = []string{"testString"} - removeEnginePropertiesConfigurationModel.Worker = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesPrestissimoOaiGenJvm model - removeEnginePropertiesPrestissimoOaiGenJvmModel := new(watsonxdatav2.RemoveEnginePropertiesPrestissimoOaiGenJvm) - removeEnginePropertiesPrestissimoOaiGenJvmModel.Coordinator = []string{"testString"} - - // Construct an instance of the RemoveEngineProperties model - removeEnginePropertiesModel := new(watsonxdatav2.RemoveEngineProperties) - removeEnginePropertiesModel.Catalog = prestissimoEnginePropertiesCatalogModel - removeEnginePropertiesModel.Configuration = removeEnginePropertiesConfigurationModel - removeEnginePropertiesModel.Jvm = removeEnginePropertiesPrestissimoOaiGenJvmModel - removeEnginePropertiesModel.Velox = []string{"testString"} - - // Construct an instance of the PrestissimoEnginePatch model - prestissimoEnginePatchModel := new(watsonxdatav2.PrestissimoEnginePatch) - prestissimoEnginePatchModel.Description = core.StringPtr("updated description for prestissimo engine") - prestissimoEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - prestissimoEnginePatchModel.EngineProperties = prestissimoEngineEnginePropertiesModel - prestissimoEnginePatchModel.EngineRestart = core.StringPtr("force") - prestissimoEnginePatchModel.RemoveEngineProperties = removeEnginePropertiesModel - prestissimoEnginePatchModel.Tags = []string{"tag1", "tag2"} - prestissimoEnginePatchModelAsPatch, asPatchErr := prestissimoEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePrestissimoEngineOptions model - updatePrestissimoEngineOptionsModel := new(watsonxdatav2.UpdatePrestissimoEngineOptions) - updatePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - updatePrestissimoEngineOptionsModel.Body = prestissimoEnginePatchModelAsPatch - updatePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updatePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunPrestissimoExplainStatementOptions model + runPrestissimoExplainStatementOptionsModel := new(watsonxdatav3.RunPrestissimoExplainStatementOptions) + runPrestissimoExplainStatementOptionsModel.ID = core.StringPtr("testString") + runPrestissimoExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runPrestissimoExplainStatementOptionsModel.Catalog = core.StringPtr("catalog_name") + runPrestissimoExplainStatementOptionsModel.Format = core.StringPtr("json") + runPrestissimoExplainStatementOptionsModel.Schema = core.StringPtr("schema_name") + runPrestissimoExplainStatementOptionsModel.Type = core.StringPtr("io") + runPrestissimoExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runPrestissimoExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -10941,16 +11750,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdatePrestissimoEngine(updatePrestissimoEngineOptions *UpdatePrestissimoEngineOptions)`, func() { - updatePrestissimoEnginePath := "/prestissimo_engines/testString" + Describe(`RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptions *RunPrestissimoExplainStatementOptions)`, func() { + runPrestissimoExplainStatementPath := "/v3/prestissimo_engines/testString/query_explain" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updatePrestissimoEnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainStatementPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -10976,11 +11785,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "worker", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "prestissimo engine for running sql queries", "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications"}, "instance_id": "instance_id", "managed_by": "fully/self", "metastore_host": "1.2.3.4", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"node_type": "worker", "quantity": 8}, "worker": {"node_type": "worker", "quantity": 8}}, "velox": {"velox_property": ["VeloxProperty"]}, "jvm": {"coordinator": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": ["CatalogName"]}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"]}, "velox": ["Velox"]}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 8}}`) + fmt.Fprintf(res, "%s", `{"result": "Result"}`) })) }) - It(`Invoke UpdatePrestissimoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunPrestissimoExplainStatement successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -10988,88 +11797,27 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the EnginePropertiesCatalog model - enginePropertiesCatalogModel := new(watsonxdatav2.EnginePropertiesCatalog) - enginePropertiesCatalogModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesCatalogModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestissimoPropertiesCatalog model - prestissimoPropertiesCatalogModel := new(watsonxdatav2.PrestissimoPropertiesCatalog) - prestissimoPropertiesCatalogModel.CatalogName = enginePropertiesCatalogModel - - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the EnginePropertiesOaiGenConfiguration model - enginePropertiesOaiGenConfigurationModel := new(watsonxdatav2.EnginePropertiesOaiGenConfiguration) - enginePropertiesOaiGenConfigurationModel.Coordinator = prestissimoNodeDescriptionBodyModel - enginePropertiesOaiGenConfigurationModel.Worker = prestissimoNodeDescriptionBodyModel - - // Construct an instance of the PrestissimoEnginePropertiesVelox model - prestissimoEnginePropertiesVeloxModel := new(watsonxdatav2.PrestissimoEnginePropertiesVelox) - prestissimoEnginePropertiesVeloxModel.VeloxProperty = []string{"testString"} - - // Construct an instance of the PrestissimoEnginePropertiesOaiGen1Jvm model - prestissimoEnginePropertiesOaiGen1JvmModel := new(watsonxdatav2.PrestissimoEnginePropertiesOaiGen1Jvm) - prestissimoEnginePropertiesOaiGen1JvmModel.Coordinator = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestissimoEngineEngineProperties model - prestissimoEngineEnginePropertiesModel := new(watsonxdatav2.PrestissimoEngineEngineProperties) - prestissimoEngineEnginePropertiesModel.Catalog = prestissimoPropertiesCatalogModel - prestissimoEngineEnginePropertiesModel.Configuration = enginePropertiesOaiGenConfigurationModel - prestissimoEngineEnginePropertiesModel.Velox = prestissimoEnginePropertiesVeloxModel - prestissimoEngineEnginePropertiesModel.Jvm = prestissimoEnginePropertiesOaiGen1JvmModel - - // Construct an instance of the PrestissimoEnginePropertiesCatalog model - prestissimoEnginePropertiesCatalogModel := new(watsonxdatav2.PrestissimoEnginePropertiesCatalog) - prestissimoEnginePropertiesCatalogModel.CatalogName = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesConfiguration model - removeEnginePropertiesConfigurationModel := new(watsonxdatav2.RemoveEnginePropertiesConfiguration) - removeEnginePropertiesConfigurationModel.Coordinator = []string{"testString"} - removeEnginePropertiesConfigurationModel.Worker = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesPrestissimoOaiGenJvm model - removeEnginePropertiesPrestissimoOaiGenJvmModel := new(watsonxdatav2.RemoveEnginePropertiesPrestissimoOaiGenJvm) - removeEnginePropertiesPrestissimoOaiGenJvmModel.Coordinator = []string{"testString"} - - // Construct an instance of the RemoveEngineProperties model - removeEnginePropertiesModel := new(watsonxdatav2.RemoveEngineProperties) - removeEnginePropertiesModel.Catalog = prestissimoEnginePropertiesCatalogModel - removeEnginePropertiesModel.Configuration = removeEnginePropertiesConfigurationModel - removeEnginePropertiesModel.Jvm = removeEnginePropertiesPrestissimoOaiGenJvmModel - removeEnginePropertiesModel.Velox = []string{"testString"} - - // Construct an instance of the PrestissimoEnginePatch model - prestissimoEnginePatchModel := new(watsonxdatav2.PrestissimoEnginePatch) - prestissimoEnginePatchModel.Description = core.StringPtr("updated description for prestissimo engine") - prestissimoEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - prestissimoEnginePatchModel.EngineProperties = prestissimoEngineEnginePropertiesModel - prestissimoEnginePatchModel.EngineRestart = core.StringPtr("force") - prestissimoEnginePatchModel.RemoveEngineProperties = removeEnginePropertiesModel - prestissimoEnginePatchModel.Tags = []string{"tag1", "tag2"} - prestissimoEnginePatchModelAsPatch, asPatchErr := prestissimoEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePrestissimoEngineOptions model - updatePrestissimoEngineOptionsModel := new(watsonxdatav2.UpdatePrestissimoEngineOptions) - updatePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - updatePrestissimoEngineOptionsModel.Body = prestissimoEnginePatchModelAsPatch - updatePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updatePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunPrestissimoExplainStatementOptions model + runPrestissimoExplainStatementOptionsModel := new(watsonxdatav3.RunPrestissimoExplainStatementOptions) + runPrestissimoExplainStatementOptionsModel.ID = core.StringPtr("testString") + runPrestissimoExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runPrestissimoExplainStatementOptionsModel.Catalog = core.StringPtr("catalog_name") + runPrestissimoExplainStatementOptionsModel.Format = core.StringPtr("json") + runPrestissimoExplainStatementOptionsModel.Schema = core.StringPtr("schema_name") + runPrestissimoExplainStatementOptionsModel.Type = core.StringPtr("io") + runPrestissimoExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runPrestissimoExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdatePrestissimoEngineWithContext(ctx, updatePrestissimoEngineOptionsModel) + _, _, operationErr := watsonxDataService.RunPrestissimoExplainStatementWithContext(ctx, runPrestissimoExplainStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -11077,7 +11825,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdatePrestissimoEngineWithContext(ctx, updatePrestissimoEngineOptionsModel) + _, _, operationErr = watsonxDataService.RunPrestissimoExplainStatementWithContext(ctx, runPrestissimoExplainStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -11091,8 +11839,8 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updatePrestissimoEnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainStatementPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -11115,11 +11863,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "worker", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "prestissimo engine for running sql queries", "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications"}, "instance_id": "instance_id", "managed_by": "fully/self", "metastore_host": "1.2.3.4", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"node_type": "worker", "quantity": 8}, "worker": {"node_type": "worker", "quantity": 8}}, "velox": {"velox_property": ["VeloxProperty"]}, "jvm": {"coordinator": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "xyz-prestissimo-01-prestissimo-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": ["CatalogName"]}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"]}, "velox": ["Velox"]}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "prestissimo", "version": "1.2.0", "worker": {"node_type": "worker", "quantity": 8}}`) + fmt.Fprintf(res, "%s", `{"result": "Result"}`) })) }) - It(`Invoke UpdatePrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunPrestissimoExplainStatement successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -11127,181 +11875,59 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdatePrestissimoEngine(nil) + result, response, operationErr := watsonxDataService.RunPrestissimoExplainStatement(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the EnginePropertiesCatalog model - enginePropertiesCatalogModel := new(watsonxdatav2.EnginePropertiesCatalog) - enginePropertiesCatalogModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesCatalogModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestissimoPropertiesCatalog model - prestissimoPropertiesCatalogModel := new(watsonxdatav2.PrestissimoPropertiesCatalog) - prestissimoPropertiesCatalogModel.CatalogName = enginePropertiesCatalogModel - - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the EnginePropertiesOaiGenConfiguration model - enginePropertiesOaiGenConfigurationModel := new(watsonxdatav2.EnginePropertiesOaiGenConfiguration) - enginePropertiesOaiGenConfigurationModel.Coordinator = prestissimoNodeDescriptionBodyModel - enginePropertiesOaiGenConfigurationModel.Worker = prestissimoNodeDescriptionBodyModel - - // Construct an instance of the PrestissimoEnginePropertiesVelox model - prestissimoEnginePropertiesVeloxModel := new(watsonxdatav2.PrestissimoEnginePropertiesVelox) - prestissimoEnginePropertiesVeloxModel.VeloxProperty = []string{"testString"} - - // Construct an instance of the PrestissimoEnginePropertiesOaiGen1Jvm model - prestissimoEnginePropertiesOaiGen1JvmModel := new(watsonxdatav2.PrestissimoEnginePropertiesOaiGen1Jvm) - prestissimoEnginePropertiesOaiGen1JvmModel.Coordinator = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestissimoEngineEngineProperties model - prestissimoEngineEnginePropertiesModel := new(watsonxdatav2.PrestissimoEngineEngineProperties) - prestissimoEngineEnginePropertiesModel.Catalog = prestissimoPropertiesCatalogModel - prestissimoEngineEnginePropertiesModel.Configuration = enginePropertiesOaiGenConfigurationModel - prestissimoEngineEnginePropertiesModel.Velox = prestissimoEnginePropertiesVeloxModel - prestissimoEngineEnginePropertiesModel.Jvm = prestissimoEnginePropertiesOaiGen1JvmModel - - // Construct an instance of the PrestissimoEnginePropertiesCatalog model - prestissimoEnginePropertiesCatalogModel := new(watsonxdatav2.PrestissimoEnginePropertiesCatalog) - prestissimoEnginePropertiesCatalogModel.CatalogName = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesConfiguration model - removeEnginePropertiesConfigurationModel := new(watsonxdatav2.RemoveEnginePropertiesConfiguration) - removeEnginePropertiesConfigurationModel.Coordinator = []string{"testString"} - removeEnginePropertiesConfigurationModel.Worker = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesPrestissimoOaiGenJvm model - removeEnginePropertiesPrestissimoOaiGenJvmModel := new(watsonxdatav2.RemoveEnginePropertiesPrestissimoOaiGenJvm) - removeEnginePropertiesPrestissimoOaiGenJvmModel.Coordinator = []string{"testString"} - - // Construct an instance of the RemoveEngineProperties model - removeEnginePropertiesModel := new(watsonxdatav2.RemoveEngineProperties) - removeEnginePropertiesModel.Catalog = prestissimoEnginePropertiesCatalogModel - removeEnginePropertiesModel.Configuration = removeEnginePropertiesConfigurationModel - removeEnginePropertiesModel.Jvm = removeEnginePropertiesPrestissimoOaiGenJvmModel - removeEnginePropertiesModel.Velox = []string{"testString"} - - // Construct an instance of the PrestissimoEnginePatch model - prestissimoEnginePatchModel := new(watsonxdatav2.PrestissimoEnginePatch) - prestissimoEnginePatchModel.Description = core.StringPtr("updated description for prestissimo engine") - prestissimoEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - prestissimoEnginePatchModel.EngineProperties = prestissimoEngineEnginePropertiesModel - prestissimoEnginePatchModel.EngineRestart = core.StringPtr("force") - prestissimoEnginePatchModel.RemoveEngineProperties = removeEnginePropertiesModel - prestissimoEnginePatchModel.Tags = []string{"tag1", "tag2"} - prestissimoEnginePatchModelAsPatch, asPatchErr := prestissimoEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePrestissimoEngineOptions model - updatePrestissimoEngineOptionsModel := new(watsonxdatav2.UpdatePrestissimoEngineOptions) - updatePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - updatePrestissimoEngineOptionsModel.Body = prestissimoEnginePatchModelAsPatch - updatePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updatePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunPrestissimoExplainStatementOptions model + runPrestissimoExplainStatementOptionsModel := new(watsonxdatav3.RunPrestissimoExplainStatementOptions) + runPrestissimoExplainStatementOptionsModel.ID = core.StringPtr("testString") + runPrestissimoExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runPrestissimoExplainStatementOptionsModel.Catalog = core.StringPtr("catalog_name") + runPrestissimoExplainStatementOptionsModel.Format = core.StringPtr("json") + runPrestissimoExplainStatementOptionsModel.Schema = core.StringPtr("schema_name") + runPrestissimoExplainStatementOptionsModel.Type = core.StringPtr("io") + runPrestissimoExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runPrestissimoExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdatePrestissimoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunPrestissimoExplainStatement with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the EnginePropertiesCatalog model - enginePropertiesCatalogModel := new(watsonxdatav2.EnginePropertiesCatalog) - enginePropertiesCatalogModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesCatalogModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestissimoPropertiesCatalog model - prestissimoPropertiesCatalogModel := new(watsonxdatav2.PrestissimoPropertiesCatalog) - prestissimoPropertiesCatalogModel.CatalogName = enginePropertiesCatalogModel - - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the EnginePropertiesOaiGenConfiguration model - enginePropertiesOaiGenConfigurationModel := new(watsonxdatav2.EnginePropertiesOaiGenConfiguration) - enginePropertiesOaiGenConfigurationModel.Coordinator = prestissimoNodeDescriptionBodyModel - enginePropertiesOaiGenConfigurationModel.Worker = prestissimoNodeDescriptionBodyModel - - // Construct an instance of the PrestissimoEnginePropertiesVelox model - prestissimoEnginePropertiesVeloxModel := new(watsonxdatav2.PrestissimoEnginePropertiesVelox) - prestissimoEnginePropertiesVeloxModel.VeloxProperty = []string{"testString"} - - // Construct an instance of the PrestissimoEnginePropertiesOaiGen1Jvm model - prestissimoEnginePropertiesOaiGen1JvmModel := new(watsonxdatav2.PrestissimoEnginePropertiesOaiGen1Jvm) - prestissimoEnginePropertiesOaiGen1JvmModel.Coordinator = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestissimoEngineEngineProperties model - prestissimoEngineEnginePropertiesModel := new(watsonxdatav2.PrestissimoEngineEngineProperties) - prestissimoEngineEnginePropertiesModel.Catalog = prestissimoPropertiesCatalogModel - prestissimoEngineEnginePropertiesModel.Configuration = enginePropertiesOaiGenConfigurationModel - prestissimoEngineEnginePropertiesModel.Velox = prestissimoEnginePropertiesVeloxModel - prestissimoEngineEnginePropertiesModel.Jvm = prestissimoEnginePropertiesOaiGen1JvmModel - - // Construct an instance of the PrestissimoEnginePropertiesCatalog model - prestissimoEnginePropertiesCatalogModel := new(watsonxdatav2.PrestissimoEnginePropertiesCatalog) - prestissimoEnginePropertiesCatalogModel.CatalogName = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesConfiguration model - removeEnginePropertiesConfigurationModel := new(watsonxdatav2.RemoveEnginePropertiesConfiguration) - removeEnginePropertiesConfigurationModel.Coordinator = []string{"testString"} - removeEnginePropertiesConfigurationModel.Worker = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesPrestissimoOaiGenJvm model - removeEnginePropertiesPrestissimoOaiGenJvmModel := new(watsonxdatav2.RemoveEnginePropertiesPrestissimoOaiGenJvm) - removeEnginePropertiesPrestissimoOaiGenJvmModel.Coordinator = []string{"testString"} - - // Construct an instance of the RemoveEngineProperties model - removeEnginePropertiesModel := new(watsonxdatav2.RemoveEngineProperties) - removeEnginePropertiesModel.Catalog = prestissimoEnginePropertiesCatalogModel - removeEnginePropertiesModel.Configuration = removeEnginePropertiesConfigurationModel - removeEnginePropertiesModel.Jvm = removeEnginePropertiesPrestissimoOaiGenJvmModel - removeEnginePropertiesModel.Velox = []string{"testString"} - - // Construct an instance of the PrestissimoEnginePatch model - prestissimoEnginePatchModel := new(watsonxdatav2.PrestissimoEnginePatch) - prestissimoEnginePatchModel.Description = core.StringPtr("updated description for prestissimo engine") - prestissimoEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - prestissimoEnginePatchModel.EngineProperties = prestissimoEngineEnginePropertiesModel - prestissimoEnginePatchModel.EngineRestart = core.StringPtr("force") - prestissimoEnginePatchModel.RemoveEngineProperties = removeEnginePropertiesModel - prestissimoEnginePatchModel.Tags = []string{"tag1", "tag2"} - prestissimoEnginePatchModelAsPatch, asPatchErr := prestissimoEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePrestissimoEngineOptions model - updatePrestissimoEngineOptionsModel := new(watsonxdatav2.UpdatePrestissimoEngineOptions) - updatePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - updatePrestissimoEngineOptionsModel.Body = prestissimoEnginePatchModelAsPatch - updatePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updatePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunPrestissimoExplainStatementOptions model + runPrestissimoExplainStatementOptionsModel := new(watsonxdatav3.RunPrestissimoExplainStatementOptions) + runPrestissimoExplainStatementOptionsModel.ID = core.StringPtr("testString") + runPrestissimoExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runPrestissimoExplainStatementOptionsModel.Catalog = core.StringPtr("catalog_name") + runPrestissimoExplainStatementOptionsModel.Format = core.StringPtr("json") + runPrestissimoExplainStatementOptionsModel.Schema = core.StringPtr("schema_name") + runPrestissimoExplainStatementOptionsModel.Type = core.StringPtr("io") + runPrestissimoExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runPrestissimoExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdatePrestissimoEngineOptions model with no property values - updatePrestissimoEngineOptionsModelNew := new(watsonxdatav2.UpdatePrestissimoEngineOptions) + // Construct a second instance of the RunPrestissimoExplainStatementOptions model with no property values + runPrestissimoExplainStatementOptionsModelNew := new(watsonxdatav3.RunPrestissimoExplainStatementOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -11319,88 +11945,27 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdatePrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunPrestissimoExplainStatement successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the EnginePropertiesCatalog model - enginePropertiesCatalogModel := new(watsonxdatav2.EnginePropertiesCatalog) - enginePropertiesCatalogModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesCatalogModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestissimoPropertiesCatalog model - prestissimoPropertiesCatalogModel := new(watsonxdatav2.PrestissimoPropertiesCatalog) - prestissimoPropertiesCatalogModel.CatalogName = enginePropertiesCatalogModel - - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the EnginePropertiesOaiGenConfiguration model - enginePropertiesOaiGenConfigurationModel := new(watsonxdatav2.EnginePropertiesOaiGenConfiguration) - enginePropertiesOaiGenConfigurationModel.Coordinator = prestissimoNodeDescriptionBodyModel - enginePropertiesOaiGenConfigurationModel.Worker = prestissimoNodeDescriptionBodyModel - - // Construct an instance of the PrestissimoEnginePropertiesVelox model - prestissimoEnginePropertiesVeloxModel := new(watsonxdatav2.PrestissimoEnginePropertiesVelox) - prestissimoEnginePropertiesVeloxModel.VeloxProperty = []string{"testString"} - - // Construct an instance of the PrestissimoEnginePropertiesOaiGen1Jvm model - prestissimoEnginePropertiesOaiGen1JvmModel := new(watsonxdatav2.PrestissimoEnginePropertiesOaiGen1Jvm) - prestissimoEnginePropertiesOaiGen1JvmModel.Coordinator = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestissimoEngineEngineProperties model - prestissimoEngineEnginePropertiesModel := new(watsonxdatav2.PrestissimoEngineEngineProperties) - prestissimoEngineEnginePropertiesModel.Catalog = prestissimoPropertiesCatalogModel - prestissimoEngineEnginePropertiesModel.Configuration = enginePropertiesOaiGenConfigurationModel - prestissimoEngineEnginePropertiesModel.Velox = prestissimoEnginePropertiesVeloxModel - prestissimoEngineEnginePropertiesModel.Jvm = prestissimoEnginePropertiesOaiGen1JvmModel - - // Construct an instance of the PrestissimoEnginePropertiesCatalog model - prestissimoEnginePropertiesCatalogModel := new(watsonxdatav2.PrestissimoEnginePropertiesCatalog) - prestissimoEnginePropertiesCatalogModel.CatalogName = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesConfiguration model - removeEnginePropertiesConfigurationModel := new(watsonxdatav2.RemoveEnginePropertiesConfiguration) - removeEnginePropertiesConfigurationModel.Coordinator = []string{"testString"} - removeEnginePropertiesConfigurationModel.Worker = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesPrestissimoOaiGenJvm model - removeEnginePropertiesPrestissimoOaiGenJvmModel := new(watsonxdatav2.RemoveEnginePropertiesPrestissimoOaiGenJvm) - removeEnginePropertiesPrestissimoOaiGenJvmModel.Coordinator = []string{"testString"} - - // Construct an instance of the RemoveEngineProperties model - removeEnginePropertiesModel := new(watsonxdatav2.RemoveEngineProperties) - removeEnginePropertiesModel.Catalog = prestissimoEnginePropertiesCatalogModel - removeEnginePropertiesModel.Configuration = removeEnginePropertiesConfigurationModel - removeEnginePropertiesModel.Jvm = removeEnginePropertiesPrestissimoOaiGenJvmModel - removeEnginePropertiesModel.Velox = []string{"testString"} - - // Construct an instance of the PrestissimoEnginePatch model - prestissimoEnginePatchModel := new(watsonxdatav2.PrestissimoEnginePatch) - prestissimoEnginePatchModel.Description = core.StringPtr("updated description for prestissimo engine") - prestissimoEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - prestissimoEnginePatchModel.EngineProperties = prestissimoEngineEnginePropertiesModel - prestissimoEnginePatchModel.EngineRestart = core.StringPtr("force") - prestissimoEnginePatchModel.RemoveEngineProperties = removeEnginePropertiesModel - prestissimoEnginePatchModel.Tags = []string{"tag1", "tag2"} - prestissimoEnginePatchModelAsPatch, asPatchErr := prestissimoEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePrestissimoEngineOptions model - updatePrestissimoEngineOptionsModel := new(watsonxdatav2.UpdatePrestissimoEngineOptions) - updatePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - updatePrestissimoEngineOptionsModel.Body = prestissimoEnginePatchModelAsPatch - updatePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updatePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunPrestissimoExplainStatementOptions model + runPrestissimoExplainStatementOptionsModel := new(watsonxdatav3.RunPrestissimoExplainStatementOptions) + runPrestissimoExplainStatementOptionsModel.ID = core.StringPtr("testString") + runPrestissimoExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runPrestissimoExplainStatementOptionsModel.Catalog = core.StringPtr("catalog_name") + runPrestissimoExplainStatementOptionsModel.Format = core.StringPtr("json") + runPrestissimoExplainStatementOptionsModel.Schema = core.StringPtr("schema_name") + runPrestissimoExplainStatementOptionsModel.Type = core.StringPtr("io") + runPrestissimoExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runPrestissimoExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdatePrestissimoEngine(updatePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -11412,16 +11977,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptions *ListPrestissimoEngineCatalogsOptions) - Operation response error`, func() { - listPrestissimoEngineCatalogsPath := "/prestissimo_engines/testString/catalogs" + Describe(`RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptions *RunPrestissimoExplainAnalyzeStatementOptions) - Operation response error`, func() { + runPrestissimoExplainAnalyzeStatementPath := "/v3/prestissimo_engines/testString/query_explain_analyze" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEngineCatalogsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainAnalyzeStatementPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -11429,28 +11994,30 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListPrestissimoEngineCatalogs with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunPrestissimoExplainAnalyzeStatement with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestissimoEngineCatalogsOptions model - listPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.ListPrestissimoEngineCatalogsOptions) - listPrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunPrestissimoExplainAnalyzeStatementOptions model + runPrestissimoExplainAnalyzeStatementOptionsModel := new(watsonxdatav3.RunPrestissimoExplainAnalyzeStatementOptions) + runPrestissimoExplainAnalyzeStatementOptionsModel.ID = core.StringPtr("testString") + runPrestissimoExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runPrestissimoExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) + runPrestissimoExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runPrestissimoExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -11460,16 +12027,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptions *ListPrestissimoEngineCatalogsOptions)`, func() { - listPrestissimoEngineCatalogsPath := "/prestissimo_engines/testString/catalogs" + Describe(`RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptions *RunPrestissimoExplainAnalyzeStatementOptions)`, func() { + runPrestissimoExplainAnalyzeStatementPath := "/v3/prestissimo_engines/testString/query_explain_analyze" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEngineCatalogsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainAnalyzeStatementPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -11479,11 +12062,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}]}`) + fmt.Fprintf(res, "%s", `{"result": "Result"}`) })) }) - It(`Invoke ListPrestissimoEngineCatalogs successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunPrestissimoExplainAnalyzeStatement successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -11491,22 +12074,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListPrestissimoEngineCatalogsOptions model - listPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.ListPrestissimoEngineCatalogsOptions) - listPrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunPrestissimoExplainAnalyzeStatementOptions model + runPrestissimoExplainAnalyzeStatementOptionsModel := new(watsonxdatav3.RunPrestissimoExplainAnalyzeStatementOptions) + runPrestissimoExplainAnalyzeStatementOptionsModel.ID = core.StringPtr("testString") + runPrestissimoExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runPrestissimoExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) + runPrestissimoExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runPrestissimoExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListPrestissimoEngineCatalogsWithContext(ctx, listPrestissimoEngineCatalogsOptionsModel) + _, _, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatementWithContext(ctx, runPrestissimoExplainAnalyzeStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -11514,7 +12099,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListPrestissimoEngineCatalogsWithContext(ctx, listPrestissimoEngineCatalogsOptionsModel) + _, _, operationErr = watsonxDataService.RunPrestissimoExplainAnalyzeStatementWithContext(ctx, runPrestissimoExplainAnalyzeStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -11528,19 +12113,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestissimoEngineCatalogsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainAnalyzeStatementPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}]}`) + fmt.Fprintf(res, "%s", `{"result": "Result"}`) })) }) - It(`Invoke ListPrestissimoEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunPrestissimoExplainAnalyzeStatement successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -11548,49 +12149,53 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListPrestissimoEngineCatalogs(nil) + result, response, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatement(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListPrestissimoEngineCatalogsOptions model - listPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.ListPrestissimoEngineCatalogsOptions) - listPrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunPrestissimoExplainAnalyzeStatementOptions model + runPrestissimoExplainAnalyzeStatementOptionsModel := new(watsonxdatav3.RunPrestissimoExplainAnalyzeStatementOptions) + runPrestissimoExplainAnalyzeStatementOptionsModel.ID = core.StringPtr("testString") + runPrestissimoExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runPrestissimoExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) + runPrestissimoExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runPrestissimoExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListPrestissimoEngineCatalogs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunPrestissimoExplainAnalyzeStatement with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestissimoEngineCatalogsOptions model - listPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.ListPrestissimoEngineCatalogsOptions) - listPrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunPrestissimoExplainAnalyzeStatementOptions model + runPrestissimoExplainAnalyzeStatementOptionsModel := new(watsonxdatav3.RunPrestissimoExplainAnalyzeStatementOptions) + runPrestissimoExplainAnalyzeStatementOptionsModel.ID = core.StringPtr("testString") + runPrestissimoExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runPrestissimoExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) + runPrestissimoExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runPrestissimoExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListPrestissimoEngineCatalogsOptions model with no property values - listPrestissimoEngineCatalogsOptionsModelNew := new(watsonxdatav2.ListPrestissimoEngineCatalogsOptions) + // Construct a second instance of the RunPrestissimoExplainAnalyzeStatementOptions model with no property values + runPrestissimoExplainAnalyzeStatementOptionsModelNew := new(watsonxdatav3.RunPrestissimoExplainAnalyzeStatementOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModelNew) + result, response, operationErr = watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -11608,22 +12213,24 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListPrestissimoEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RunPrestissimoExplainAnalyzeStatement successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestissimoEngineCatalogsOptions model - listPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.ListPrestissimoEngineCatalogsOptions) - listPrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RunPrestissimoExplainAnalyzeStatementOptions model + runPrestissimoExplainAnalyzeStatementOptionsModel := new(watsonxdatav3.RunPrestissimoExplainAnalyzeStatementOptions) + runPrestissimoExplainAnalyzeStatementOptionsModel.ID = core.StringPtr("testString") + runPrestissimoExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") + runPrestissimoExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) + runPrestissimoExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") + runPrestissimoExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListPrestissimoEngineCatalogs(listPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -11635,46 +12242,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptions *CreatePrestissimoEngineCatalogsOptions) - Operation response error`, func() { - createPrestissimoEngineCatalogsPath := "/prestissimo_engines/testString/catalogs" + Describe(`RestartPrestissimoEngine(restartPrestissimoEngineOptions *RestartPrestissimoEngineOptions) - Operation response error`, func() { + restartPrestissimoEnginePath := "/v3/prestissimo_engines/testString/restart" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEngineCatalogsPath)) + Expect(req.URL.EscapedPath()).To(Equal(restartPrestissimoEnginePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreatePrestissimoEngineCatalogs with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RestartPrestissimoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreatePrestissimoEngineCatalogsOptions model - createPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.CreatePrestissimoEngineCatalogsOptions) - createPrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RestartPrestissimoEngineOptions model + restartPrestissimoEngineOptionsModel := new(watsonxdatav3.RestartPrestissimoEngineOptions) + restartPrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + restartPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + restartPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -11684,33 +12290,17 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptions *CreatePrestissimoEngineCatalogsOptions)`, func() { - createPrestissimoEngineCatalogsPath := "/prestissimo_engines/testString/catalogs" + Describe(`RestartPrestissimoEngine(restartPrestissimoEngineOptions *RestartPrestissimoEngineOptions)`, func() { + restartPrestissimoEnginePath := "/v3/prestissimo_engines/testString/restart" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEngineCatalogsPath)) + Expect(req.URL.EscapedPath()).To(Equal(restartPrestissimoEnginePath)) Expect(req.Method).To(Equal("POST")) - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Sleep a short time to support a timeout test @@ -11718,12 +12308,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke CreatePrestissimoEngineCatalogs successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RestartPrestissimoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -11731,23 +12321,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreatePrestissimoEngineCatalogsOptions model - createPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.CreatePrestissimoEngineCatalogsOptions) - createPrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RestartPrestissimoEngineOptions model + restartPrestissimoEngineOptionsModel := new(watsonxdatav3.RestartPrestissimoEngineOptions) + restartPrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + restartPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + restartPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogsWithContext(ctx, createPrestissimoEngineCatalogsOptionsModel) + _, _, operationErr := watsonxDataService.RestartPrestissimoEngineWithContext(ctx, restartPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -11755,7 +12344,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreatePrestissimoEngineCatalogsWithContext(ctx, createPrestissimoEngineCatalogsOptionsModel) + _, _, operationErr = watsonxDataService.RestartPrestissimoEngineWithContext(ctx, restartPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -11769,35 +12358,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestissimoEngineCatalogsPath)) + Expect(req.URL.EscapedPath()).To(Equal(restartPrestissimoEnginePath)) Expect(req.Method).To(Equal("POST")) - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke CreatePrestissimoEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RestartPrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -11805,51 +12378,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogs(nil) + result, response, operationErr := watsonxDataService.RestartPrestissimoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreatePrestissimoEngineCatalogsOptions model - createPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.CreatePrestissimoEngineCatalogsOptions) - createPrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RestartPrestissimoEngineOptions model + restartPrestissimoEngineOptionsModel := new(watsonxdatav3.RestartPrestissimoEngineOptions) + restartPrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + restartPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + restartPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreatePrestissimoEngineCatalogs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RestartPrestissimoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreatePrestissimoEngineCatalogsOptions model - createPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.CreatePrestissimoEngineCatalogsOptions) - createPrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RestartPrestissimoEngineOptions model + restartPrestissimoEngineOptionsModel := new(watsonxdatav3.RestartPrestissimoEngineOptions) + restartPrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + restartPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + restartPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreatePrestissimoEngineCatalogsOptions model with no property values - createPrestissimoEngineCatalogsOptionsModelNew := new(watsonxdatav2.CreatePrestissimoEngineCatalogsOptions) + // Construct a second instance of the RestartPrestissimoEngineOptions model with no property values + restartPrestissimoEngineOptionsModelNew := new(watsonxdatav3.RestartPrestissimoEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModelNew) + result, response, operationErr = watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -11864,26 +12435,25 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreatePrestissimoEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RestartPrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreatePrestissimoEngineCatalogsOptions model - createPrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.CreatePrestissimoEngineCatalogsOptions) - createPrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RestartPrestissimoEngineOptions model + restartPrestissimoEngineOptionsModel := new(watsonxdatav3.RestartPrestissimoEngineOptions) + restartPrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + restartPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + restartPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreatePrestissimoEngineCatalogs(createPrestissimoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -11895,91 +12465,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptions *DeletePrestissimoEngineCatalogsOptions)`, func() { - deletePrestissimoEngineCatalogsPath := "/prestissimo_engines/testString/catalogs" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deletePrestissimoEngineCatalogsPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_names"]).To(Equal([]string{"testString"})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeletePrestissimoEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeletePrestissimoEngineCatalogs(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeletePrestissimoEngineCatalogsOptions model - deletePrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.DeletePrestissimoEngineCatalogsOptions) - deletePrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - deletePrestissimoEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") - deletePrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - deletePrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeletePrestissimoEngineCatalogs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeletePrestissimoEngineCatalogsOptions model - deletePrestissimoEngineCatalogsOptionsModel := new(watsonxdatav2.DeletePrestissimoEngineCatalogsOptions) - deletePrestissimoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - deletePrestissimoEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") - deletePrestissimoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - deletePrestissimoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeletePrestissimoEngineCatalogsOptions model with no property values - deletePrestissimoEngineCatalogsOptionsModelNew := new(watsonxdatav2.DeletePrestissimoEngineCatalogsOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeletePrestissimoEngineCatalogs(deletePrestissimoEngineCatalogsOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptions *GetPrestissimoEngineCatalogOptions) - Operation response error`, func() { - getPrestissimoEngineCatalogPath := "/prestissimo_engines/testString/catalogs/testString" + Describe(`ResumePrestissimoEngine(resumePrestissimoEngineOptions *ResumePrestissimoEngineOptions) - Operation response error`, func() { + resumePrestissimoEnginePath := "/v3/prestissimo_engines/testString/resume" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEngineCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(resumePrestissimoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -11987,29 +12482,28 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetPrestissimoEngineCatalog with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumePrestissimoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestissimoEngineCatalogOptions model - getPrestissimoEngineCatalogOptionsModel := new(watsonxdatav2.GetPrestissimoEngineCatalogOptions) - getPrestissimoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumePrestissimoEngineOptions model + resumePrestissimoEngineOptionsModel := new(watsonxdatav3.ResumePrestissimoEngineOptions) + resumePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + resumePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) + result, response, operationErr = watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -12019,16 +12513,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptions *GetPrestissimoEngineCatalogOptions)`, func() { - getPrestissimoEngineCatalogPath := "/prestissimo_engines/testString/catalogs/testString" + Describe(`ResumePrestissimoEngine(resumePrestissimoEngineOptions *ResumePrestissimoEngineOptions)`, func() { + resumePrestissimoEnginePath := "/v3/prestissimo_engines/testString/resume" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEngineCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(resumePrestissimoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -12038,11 +12532,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke GetPrestissimoEngineCatalog successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumePrestissimoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -12050,23 +12544,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetPrestissimoEngineCatalogOptions model - getPrestissimoEngineCatalogOptionsModel := new(watsonxdatav2.GetPrestissimoEngineCatalogOptions) - getPrestissimoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumePrestissimoEngineOptions model + resumePrestissimoEngineOptionsModel := new(watsonxdatav3.ResumePrestissimoEngineOptions) + resumePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + resumePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetPrestissimoEngineCatalogWithContext(ctx, getPrestissimoEngineCatalogOptionsModel) + _, _, operationErr := watsonxDataService.ResumePrestissimoEngineWithContext(ctx, resumePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -12074,7 +12567,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetPrestissimoEngineCatalogWithContext(ctx, getPrestissimoEngineCatalogOptionsModel) + _, _, operationErr = watsonxDataService.ResumePrestissimoEngineWithContext(ctx, resumePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -12088,19 +12581,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestissimoEngineCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(resumePrestissimoEnginePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke GetPrestissimoEngineCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumePrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -12108,51 +12601,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetPrestissimoEngineCatalog(nil) + result, response, operationErr := watsonxDataService.ResumePrestissimoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetPrestissimoEngineCatalogOptions model - getPrestissimoEngineCatalogOptionsModel := new(watsonxdatav2.GetPrestissimoEngineCatalogOptions) - getPrestissimoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumePrestissimoEngineOptions model + resumePrestissimoEngineOptionsModel := new(watsonxdatav3.ResumePrestissimoEngineOptions) + resumePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + resumePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) + result, response, operationErr = watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetPrestissimoEngineCatalog with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumePrestissimoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestissimoEngineCatalogOptions model - getPrestissimoEngineCatalogOptionsModel := new(watsonxdatav2.GetPrestissimoEngineCatalogOptions) - getPrestissimoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumePrestissimoEngineOptions model + resumePrestissimoEngineOptionsModel := new(watsonxdatav3.ResumePrestissimoEngineOptions) + resumePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + resumePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetPrestissimoEngineCatalogOptions model with no property values - getPrestissimoEngineCatalogOptionsModelNew := new(watsonxdatav2.GetPrestissimoEngineCatalogOptions) + // Construct a second instance of the ResumePrestissimoEngineOptions model with no property values + resumePrestissimoEngineOptionsModelNew := new(watsonxdatav3.ResumePrestissimoEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModelNew) + result, response, operationErr = watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -12170,23 +12661,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetPrestissimoEngineCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumePrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestissimoEngineCatalogOptions model - getPrestissimoEngineCatalogOptionsModel := new(watsonxdatav2.GetPrestissimoEngineCatalogOptions) - getPrestissimoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestissimoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumePrestissimoEngineOptions model + resumePrestissimoEngineOptionsModel := new(watsonxdatav3.ResumePrestissimoEngineOptions) + resumePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + resumePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetPrestissimoEngineCatalog(getPrestissimoEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -12198,45 +12688,52 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`PausePrestissimoEngine(pausePrestissimoEngineOptions *PausePrestissimoEngineOptions) - Operation response error`, func() { - pausePrestissimoEnginePath := "/prestissimo_engines/testString/pause" + Describe(`ScalePrestissimoEngine(scalePrestissimoEngineOptions *ScalePrestissimoEngineOptions) - Operation response error`, func() { + scalePrestissimoEnginePath := "/v3/prestissimo_engines/testString/scale" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(pausePrestissimoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(scalePrestissimoEnginePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke PausePrestissimoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScalePrestissimoEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PausePrestissimoEngineOptions model - pausePrestissimoEngineOptionsModel := new(watsonxdatav2.PausePrestissimoEngineOptions) - pausePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - pausePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pausePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the ScalePrestissimoEngineOptions model + scalePrestissimoEngineOptionsModel := new(watsonxdatav3.ScalePrestissimoEngineOptions) + scalePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + scalePrestissimoEngineOptionsModel.Coordinator = nodeDescriptionModel + scalePrestissimoEngineOptionsModel.Worker = nodeDescriptionModel + scalePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scalePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -12246,17 +12743,33 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`PausePrestissimoEngine(pausePrestissimoEngineOptions *PausePrestissimoEngineOptions)`, func() { - pausePrestissimoEnginePath := "/prestissimo_engines/testString/pause" + Describe(`ScalePrestissimoEngine(scalePrestissimoEngineOptions *ScalePrestissimoEngineOptions)`, func() { + scalePrestissimoEnginePath := "/v3/prestissimo_engines/testString/scale" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(pausePrestissimoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(scalePrestissimoEnginePath)) Expect(req.Method).To(Equal("POST")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Sleep a short time to support a timeout test @@ -12264,12 +12777,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke PausePrestissimoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScalePrestissimoEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -12277,22 +12790,29 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the PausePrestissimoEngineOptions model - pausePrestissimoEngineOptionsModel := new(watsonxdatav2.PausePrestissimoEngineOptions) - pausePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - pausePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pausePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the ScalePrestissimoEngineOptions model + scalePrestissimoEngineOptionsModel := new(watsonxdatav3.ScalePrestissimoEngineOptions) + scalePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + scalePrestissimoEngineOptionsModel.Coordinator = nodeDescriptionModel + scalePrestissimoEngineOptionsModel.Worker = nodeDescriptionModel + scalePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scalePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.PausePrestissimoEngineWithContext(ctx, pausePrestissimoEngineOptionsModel) + _, _, operationErr := watsonxDataService.ScalePrestissimoEngineWithContext(ctx, scalePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -12300,7 +12820,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.PausePrestissimoEngineWithContext(ctx, pausePrestissimoEngineOptionsModel) + _, _, operationErr = watsonxDataService.ScalePrestissimoEngineWithContext(ctx, scalePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -12314,19 +12834,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(pausePrestissimoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(scalePrestissimoEnginePath)) Expect(req.Method).To(Equal("POST")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke PausePrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScalePrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -12334,49 +12870,63 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.PausePrestissimoEngine(nil) + result, response, operationErr := watsonxDataService.ScalePrestissimoEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the PausePrestissimoEngineOptions model - pausePrestissimoEngineOptionsModel := new(watsonxdatav2.PausePrestissimoEngineOptions) - pausePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - pausePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pausePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the ScalePrestissimoEngineOptions model + scalePrestissimoEngineOptionsModel := new(watsonxdatav3.ScalePrestissimoEngineOptions) + scalePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + scalePrestissimoEngineOptionsModel.Coordinator = nodeDescriptionModel + scalePrestissimoEngineOptionsModel.Worker = nodeDescriptionModel + scalePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scalePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke PausePrestissimoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScalePrestissimoEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PausePrestissimoEngineOptions model - pausePrestissimoEngineOptionsModel := new(watsonxdatav2.PausePrestissimoEngineOptions) - pausePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - pausePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pausePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the ScalePrestissimoEngineOptions model + scalePrestissimoEngineOptionsModel := new(watsonxdatav3.ScalePrestissimoEngineOptions) + scalePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + scalePrestissimoEngineOptionsModel.Coordinator = nodeDescriptionModel + scalePrestissimoEngineOptionsModel.Worker = nodeDescriptionModel + scalePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scalePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the PausePrestissimoEngineOptions model with no property values - pausePrestissimoEngineOptionsModelNew := new(watsonxdatav2.PausePrestissimoEngineOptions) + // Construct a second instance of the ScalePrestissimoEngineOptions model with no property values + scalePrestissimoEngineOptionsModelNew := new(watsonxdatav3.ScalePrestissimoEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -12391,25 +12941,32 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke PausePrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScalePrestissimoEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PausePrestissimoEngineOptions model - pausePrestissimoEngineOptionsModel := new(watsonxdatav2.PausePrestissimoEngineOptions) - pausePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - pausePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pausePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + + // Construct an instance of the ScalePrestissimoEngineOptions model + scalePrestissimoEngineOptionsModel := new(watsonxdatav3.ScalePrestissimoEngineOptions) + scalePrestissimoEngineOptionsModel.ID = core.StringPtr("testString") + scalePrestissimoEngineOptionsModel.Coordinator = nodeDescriptionModel + scalePrestissimoEngineOptionsModel.Worker = nodeDescriptionModel + scalePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scalePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.PausePrestissimoEngine(pausePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -12421,16 +12978,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptions *RunPrestissimoExplainStatementOptions) - Operation response error`, func() { - runPrestissimoExplainStatementPath := "/prestissimo_engines/testString/query_explain" + Describe(`ListDb2Engines(listDb2EnginesOptions *ListDb2EnginesOptions) - Operation response error`, func() { + listDb2EnginesPath := "/v3/db2_engines" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainStatementPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listDb2EnginesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -12438,31 +12995,27 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke RunPrestissimoExplainStatement with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDb2Engines with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunPrestissimoExplainStatementOptions model - runPrestissimoExplainStatementOptionsModel := new(watsonxdatav2.RunPrestissimoExplainStatementOptions) - runPrestissimoExplainStatementOptionsModel.EngineID = core.StringPtr("testString") - runPrestissimoExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runPrestissimoExplainStatementOptionsModel.Format = core.StringPtr("json") - runPrestissimoExplainStatementOptionsModel.Type = core.StringPtr("io") - runPrestissimoExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runPrestissimoExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDb2EnginesOptions model + listDb2EnginesOptionsModel := new(watsonxdatav3.ListDb2EnginesOptions) + listDb2EnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDb2EnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) + result, response, operationErr := watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) + result, response, operationErr = watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -12472,32 +13025,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptions *RunPrestissimoExplainStatementOptions)`, func() { - runPrestissimoExplainStatementPath := "/prestissimo_engines/testString/query_explain" + Describe(`ListDb2Engines(listDb2EnginesOptions *ListDb2EnginesOptions)`, func() { + listDb2EnginesPath := "/v3/db2_engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainStatementPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listDb2EnginesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -12507,11 +13044,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"result": "Result"}`) + fmt.Fprintf(res, "%s", `{"db2_engines": [{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 1, "created_by": "@.com", "description": "db2 engine to run sql queries", "display_name": "sample-engine", "host_name": "xyz-db2-01-db2-svc", "id": "sampleEngine123", "origin": "ibm", "port": 1, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}]}`) })) }) - It(`Invoke RunPrestissimoExplainStatement successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDb2Engines successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -12519,25 +13056,21 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the RunPrestissimoExplainStatementOptions model - runPrestissimoExplainStatementOptionsModel := new(watsonxdatav2.RunPrestissimoExplainStatementOptions) - runPrestissimoExplainStatementOptionsModel.EngineID = core.StringPtr("testString") - runPrestissimoExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runPrestissimoExplainStatementOptionsModel.Format = core.StringPtr("json") - runPrestissimoExplainStatementOptionsModel.Type = core.StringPtr("io") - runPrestissimoExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runPrestissimoExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDb2EnginesOptions model + listDb2EnginesOptionsModel := new(watsonxdatav3.ListDb2EnginesOptions) + listDb2EnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDb2EnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.RunPrestissimoExplainStatementWithContext(ctx, runPrestissimoExplainStatementOptionsModel) + _, _, operationErr := watsonxDataService.ListDb2EnginesWithContext(ctx, listDb2EnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) + result, response, operationErr := watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -12545,7 +13078,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.RunPrestissimoExplainStatementWithContext(ctx, runPrestissimoExplainStatementOptionsModel) + _, _, operationErr = watsonxDataService.ListDb2EnginesWithContext(ctx, listDb2EnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -12559,35 +13092,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainStatementPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listDb2EnginesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"result": "Result"}`) + fmt.Fprintf(res, "%s", `{"db2_engines": [{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 1, "created_by": "@.com", "description": "db2 engine to run sql queries", "display_name": "sample-engine", "host_name": "xyz-db2-01-db2-svc", "id": "sampleEngine123", "origin": "ibm", "port": 1, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}]}`) })) }) - It(`Invoke RunPrestissimoExplainStatement successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDb2Engines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -12595,58 +13112,43 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.RunPrestissimoExplainStatement(nil) + result, response, operationErr := watsonxDataService.ListDb2Engines(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the RunPrestissimoExplainStatementOptions model - runPrestissimoExplainStatementOptionsModel := new(watsonxdatav2.RunPrestissimoExplainStatementOptions) - runPrestissimoExplainStatementOptionsModel.EngineID = core.StringPtr("testString") - runPrestissimoExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runPrestissimoExplainStatementOptionsModel.Format = core.StringPtr("json") - runPrestissimoExplainStatementOptionsModel.Type = core.StringPtr("io") - runPrestissimoExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runPrestissimoExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDb2EnginesOptions model + listDb2EnginesOptionsModel := new(watsonxdatav3.ListDb2EnginesOptions) + listDb2EnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDb2EnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) + result, response, operationErr = watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke RunPrestissimoExplainStatement with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDb2Engines with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunPrestissimoExplainStatementOptions model - runPrestissimoExplainStatementOptionsModel := new(watsonxdatav2.RunPrestissimoExplainStatementOptions) - runPrestissimoExplainStatementOptionsModel.EngineID = core.StringPtr("testString") - runPrestissimoExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runPrestissimoExplainStatementOptionsModel.Format = core.StringPtr("json") - runPrestissimoExplainStatementOptionsModel.Type = core.StringPtr("io") - runPrestissimoExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runPrestissimoExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDb2EnginesOptions model + listDb2EnginesOptionsModel := new(watsonxdatav3.ListDb2EnginesOptions) + listDb2EnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDb2EnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) + result, response, operationErr := watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the RunPrestissimoExplainStatementOptions model with no property values - runPrestissimoExplainStatementOptionsModelNew := new(watsonxdatav2.RunPrestissimoExplainStatementOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -12661,25 +13163,21 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke RunPrestissimoExplainStatement successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDb2Engines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunPrestissimoExplainStatementOptions model - runPrestissimoExplainStatementOptionsModel := new(watsonxdatav2.RunPrestissimoExplainStatementOptions) - runPrestissimoExplainStatementOptionsModel.EngineID = core.StringPtr("testString") - runPrestissimoExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runPrestissimoExplainStatementOptionsModel.Format = core.StringPtr("json") - runPrestissimoExplainStatementOptionsModel.Type = core.StringPtr("io") - runPrestissimoExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runPrestissimoExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDb2EnginesOptions model + listDb2EnginesOptionsModel := new(watsonxdatav3.ListDb2EnginesOptions) + listDb2EnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDb2EnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.RunPrestissimoExplainStatement(runPrestissimoExplainStatementOptionsModel) + result, response, operationErr := watsonxDataService.ListDb2Engines(listDb2EnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -12691,47 +13189,53 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptions *RunPrestissimoExplainAnalyzeStatementOptions) - Operation response error`, func() { - runPrestissimoExplainAnalyzeStatementPath := "/prestissimo_engines/testString/query_explain_analyze" + Describe(`CreateDb2Engine(createDb2EngineOptions *CreateDb2EngineOptions) - Operation response error`, func() { + createDb2EnginePath := "/v3/db2_engines" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainAnalyzeStatementPath)) + Expect(req.URL.EscapedPath()).To(Equal(createDb2EnginePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke RunPrestissimoExplainAnalyzeStatement with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateDb2Engine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunPrestissimoExplainAnalyzeStatementOptions model - runPrestissimoExplainAnalyzeStatementOptionsModel := new(watsonxdatav2.RunPrestissimoExplainAnalyzeStatementOptions) - runPrestissimoExplainAnalyzeStatementOptionsModel.EngineID = core.StringPtr("testString") - runPrestissimoExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runPrestissimoExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) - runPrestissimoExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runPrestissimoExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Db2EngineDetailsBody model + db2EngineDetailsBodyModel := new(watsonxdatav3.Db2EngineDetailsBody) + db2EngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + + // Construct an instance of the CreateDb2EngineOptions model + createDb2EngineOptionsModel := new(watsonxdatav3.CreateDb2EngineOptions) + createDb2EngineOptionsModel.Configuration = db2EngineDetailsBodyModel + createDb2EngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createDb2EngineOptionsModel.Origin = core.StringPtr("external") + createDb2EngineOptionsModel.Description = core.StringPtr("db2 engine description") + createDb2EngineOptionsModel.Tags = []string{"tag1", "tag2"} + createDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) + result, response, operationErr := watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) + result, response, operationErr = watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -12741,15 +13245,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptions *RunPrestissimoExplainAnalyzeStatementOptions)`, func() { - runPrestissimoExplainAnalyzeStatementPath := "/prestissimo_engines/testString/query_explain_analyze" + Describe(`CreateDb2Engine(createDb2EngineOptions *CreateDb2EngineOptions)`, func() { + createDb2EnginePath := "/v3/db2_engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainAnalyzeStatementPath)) + Expect(req.URL.EscapedPath()).To(Equal(createDb2EnginePath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -12775,12 +13279,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"result": "Result"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 1, "created_by": "@.com", "description": "db2 engine to run sql queries", "display_name": "sample-engine", "host_name": "xyz-db2-01-db2-svc", "id": "sampleEngine123", "origin": "ibm", "port": 1, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}`) })) }) - It(`Invoke RunPrestissimoExplainAnalyzeStatement successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateDb2Engine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -12788,24 +13292,30 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the RunPrestissimoExplainAnalyzeStatementOptions model - runPrestissimoExplainAnalyzeStatementOptionsModel := new(watsonxdatav2.RunPrestissimoExplainAnalyzeStatementOptions) - runPrestissimoExplainAnalyzeStatementOptionsModel.EngineID = core.StringPtr("testString") - runPrestissimoExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runPrestissimoExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) - runPrestissimoExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runPrestissimoExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Db2EngineDetailsBody model + db2EngineDetailsBodyModel := new(watsonxdatav3.Db2EngineDetailsBody) + db2EngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + + // Construct an instance of the CreateDb2EngineOptions model + createDb2EngineOptionsModel := new(watsonxdatav3.CreateDb2EngineOptions) + createDb2EngineOptionsModel.Configuration = db2EngineDetailsBodyModel + createDb2EngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createDb2EngineOptionsModel.Origin = core.StringPtr("external") + createDb2EngineOptionsModel.Description = core.StringPtr("db2 engine description") + createDb2EngineOptionsModel.Tags = []string{"tag1", "tag2"} + createDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatementWithContext(ctx, runPrestissimoExplainAnalyzeStatementOptionsModel) + _, _, operationErr := watsonxDataService.CreateDb2EngineWithContext(ctx, createDb2EngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) + result, response, operationErr := watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -12813,7 +13323,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.RunPrestissimoExplainAnalyzeStatementWithContext(ctx, runPrestissimoExplainAnalyzeStatementOptionsModel) + _, _, operationErr = watsonxDataService.CreateDb2EngineWithContext(ctx, createDb2EngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -12827,7 +13337,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runPrestissimoExplainAnalyzeStatementPath)) + Expect(req.URL.EscapedPath()).To(Equal(createDb2EnginePath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -12850,12 +13360,12 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"result": "Result"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 1, "created_by": "@.com", "description": "db2 engine to run sql queries", "display_name": "sample-engine", "host_name": "xyz-db2-01-db2-svc", "id": "sampleEngine123", "origin": "ibm", "port": 1, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}`) })) }) - It(`Invoke RunPrestissimoExplainAnalyzeStatement successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateDb2Engine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -12863,53 +13373,65 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatement(nil) + result, response, operationErr := watsonxDataService.CreateDb2Engine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the RunPrestissimoExplainAnalyzeStatementOptions model - runPrestissimoExplainAnalyzeStatementOptionsModel := new(watsonxdatav2.RunPrestissimoExplainAnalyzeStatementOptions) - runPrestissimoExplainAnalyzeStatementOptionsModel.EngineID = core.StringPtr("testString") - runPrestissimoExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runPrestissimoExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) - runPrestissimoExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runPrestissimoExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Db2EngineDetailsBody model + db2EngineDetailsBodyModel := new(watsonxdatav3.Db2EngineDetailsBody) + db2EngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + + // Construct an instance of the CreateDb2EngineOptions model + createDb2EngineOptionsModel := new(watsonxdatav3.CreateDb2EngineOptions) + createDb2EngineOptionsModel.Configuration = db2EngineDetailsBodyModel + createDb2EngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createDb2EngineOptionsModel.Origin = core.StringPtr("external") + createDb2EngineOptionsModel.Description = core.StringPtr("db2 engine description") + createDb2EngineOptionsModel.Tags = []string{"tag1", "tag2"} + createDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) + result, response, operationErr = watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke RunPrestissimoExplainAnalyzeStatement with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateDb2Engine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunPrestissimoExplainAnalyzeStatementOptions model - runPrestissimoExplainAnalyzeStatementOptionsModel := new(watsonxdatav2.RunPrestissimoExplainAnalyzeStatementOptions) - runPrestissimoExplainAnalyzeStatementOptionsModel.EngineID = core.StringPtr("testString") - runPrestissimoExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runPrestissimoExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) - runPrestissimoExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runPrestissimoExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Db2EngineDetailsBody model + db2EngineDetailsBodyModel := new(watsonxdatav3.Db2EngineDetailsBody) + db2EngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + + // Construct an instance of the CreateDb2EngineOptions model + createDb2EngineOptionsModel := new(watsonxdatav3.CreateDb2EngineOptions) + createDb2EngineOptionsModel.Configuration = db2EngineDetailsBodyModel + createDb2EngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createDb2EngineOptionsModel.Origin = core.StringPtr("external") + createDb2EngineOptionsModel.Description = core.StringPtr("db2 engine description") + createDb2EngineOptionsModel.Tags = []string{"tag1", "tag2"} + createDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) + result, response, operationErr := watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the RunPrestissimoExplainAnalyzeStatementOptions model with no property values - runPrestissimoExplainAnalyzeStatementOptionsModelNew := new(watsonxdatav2.RunPrestissimoExplainAnalyzeStatementOptions) + // Construct a second instance of the CreateDb2EngineOptions model with no property values + createDb2EngineOptionsModelNew := new(watsonxdatav3.CreateDb2EngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -12924,27 +13446,33 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke RunPrestissimoExplainAnalyzeStatement successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateDb2Engine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunPrestissimoExplainAnalyzeStatementOptions model - runPrestissimoExplainAnalyzeStatementOptionsModel := new(watsonxdatav2.RunPrestissimoExplainAnalyzeStatementOptions) - runPrestissimoExplainAnalyzeStatementOptionsModel.EngineID = core.StringPtr("testString") - runPrestissimoExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runPrestissimoExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) - runPrestissimoExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runPrestissimoExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Db2EngineDetailsBody model + db2EngineDetailsBodyModel := new(watsonxdatav3.Db2EngineDetailsBody) + db2EngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + + // Construct an instance of the CreateDb2EngineOptions model + createDb2EngineOptionsModel := new(watsonxdatav3.CreateDb2EngineOptions) + createDb2EngineOptionsModel.Configuration = db2EngineDetailsBodyModel + createDb2EngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createDb2EngineOptionsModel.Origin = core.StringPtr("external") + createDb2EngineOptionsModel.Description = core.StringPtr("db2 engine description") + createDb2EngineOptionsModel.Tags = []string{"tag1", "tag2"} + createDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.RunPrestissimoExplainAnalyzeStatement(runPrestissimoExplainAnalyzeStatementOptionsModel) + result, response, operationErr := watsonxDataService.CreateDb2Engine(createDb2EngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -12956,16 +13484,88 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RestartPrestissimoEngine(restartPrestissimoEngineOptions *RestartPrestissimoEngineOptions) - Operation response error`, func() { - restartPrestissimoEnginePath := "/prestissimo_engines/testString/restart" + Describe(`DeleteDb2Engine(deleteDb2EngineOptions *DeleteDb2EngineOptions)`, func() { + deleteDb2EnginePath := "/v3/db2_engines/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteDb2EnginePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteDb2Engine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteDb2Engine(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteDb2EngineOptions model + deleteDb2EngineOptionsModel := new(watsonxdatav3.DeleteDb2EngineOptions) + deleteDb2EngineOptionsModel.ID = core.StringPtr("testString") + deleteDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteDb2Engine(deleteDb2EngineOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteDb2Engine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DeleteDb2EngineOptions model + deleteDb2EngineOptionsModel := new(watsonxdatav3.DeleteDb2EngineOptions) + deleteDb2EngineOptionsModel.ID = core.StringPtr("testString") + deleteDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteDb2Engine(deleteDb2EngineOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteDb2EngineOptions model with no property values + deleteDb2EngineOptionsModelNew := new(watsonxdatav3.DeleteDb2EngineOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteDb2Engine(deleteDb2EngineOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateDb2Engine(updateDb2EngineOptions *UpdateDb2EngineOptions) - Operation response error`, func() { + updateDb2EnginePath := "/v3/db2_engines/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(restartPrestissimoEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateDb2EnginePath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -12973,28 +13573,37 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke RestartPrestissimoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateDb2Engine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RestartPrestissimoEngineOptions model - restartPrestissimoEngineOptionsModel := new(watsonxdatav2.RestartPrestissimoEngineOptions) - restartPrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - restartPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - restartPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Db2EnginePatch model + db2EnginePatchModel := new(watsonxdatav3.Db2EnginePatch) + db2EnginePatchModel.Description = core.StringPtr("db2 engine updated description") + db2EnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + db2EnginePatchModel.Tags = []string{"tag1", "tag2"} + db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDb2EngineOptions model + updateDb2EngineOptionsModel := new(watsonxdatav3.UpdateDb2EngineOptions) + updateDb2EngineOptionsModel.ID = core.StringPtr("testString") + updateDb2EngineOptionsModel.Body = db2EnginePatchModelAsPatch + updateDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -13004,16 +13613,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RestartPrestissimoEngine(restartPrestissimoEngineOptions *RestartPrestissimoEngineOptions)`, func() { - restartPrestissimoEnginePath := "/prestissimo_engines/testString/restart" + Describe(`UpdateDb2Engine(updateDb2EngineOptions *UpdateDb2EngineOptions)`, func() { + updateDb2EnginePath := "/v3/db2_engines/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(restartPrestissimoEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateDb2EnginePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -13023,11 +13648,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 1, "created_by": "@.com", "description": "db2 engine to run sql queries", "display_name": "sample-engine", "host_name": "xyz-db2-01-db2-svc", "id": "sampleEngine123", "origin": "ibm", "port": 1, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}`) })) }) - It(`Invoke RestartPrestissimoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateDb2Engine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -13035,22 +13660,31 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the RestartPrestissimoEngineOptions model - restartPrestissimoEngineOptionsModel := new(watsonxdatav2.RestartPrestissimoEngineOptions) - restartPrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - restartPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - restartPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Db2EnginePatch model + db2EnginePatchModel := new(watsonxdatav3.Db2EnginePatch) + db2EnginePatchModel.Description = core.StringPtr("db2 engine updated description") + db2EnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + db2EnginePatchModel.Tags = []string{"tag1", "tag2"} + db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDb2EngineOptions model + updateDb2EngineOptionsModel := new(watsonxdatav3.UpdateDb2EngineOptions) + updateDb2EngineOptionsModel.ID = core.StringPtr("testString") + updateDb2EngineOptionsModel.Body = db2EnginePatchModelAsPatch + updateDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.RestartPrestissimoEngineWithContext(ctx, restartPrestissimoEngineOptionsModel) + _, _, operationErr := watsonxDataService.UpdateDb2EngineWithContext(ctx, updateDb2EngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -13058,7 +13692,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.RestartPrestissimoEngineWithContext(ctx, restartPrestissimoEngineOptionsModel) + _, _, operationErr = watsonxDataService.UpdateDb2EngineWithContext(ctx, updateDb2EngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -13072,19 +13706,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(restartPrestissimoEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateDb2EnginePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 1, "created_by": "@.com", "description": "db2 engine to run sql queries", "display_name": "sample-engine", "host_name": "xyz-db2-01-db2-svc", "id": "sampleEngine123", "origin": "ibm", "port": 1, "status": "REGISTERED", "tags": ["Tags"], "type": "db2"}`) })) }) - It(`Invoke RestartPrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateDb2Engine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -13092,49 +13742,67 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.RestartPrestissimoEngine(nil) + result, response, operationErr := watsonxDataService.UpdateDb2Engine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the RestartPrestissimoEngineOptions model - restartPrestissimoEngineOptionsModel := new(watsonxdatav2.RestartPrestissimoEngineOptions) - restartPrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - restartPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - restartPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Db2EnginePatch model + db2EnginePatchModel := new(watsonxdatav3.Db2EnginePatch) + db2EnginePatchModel.Description = core.StringPtr("db2 engine updated description") + db2EnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + db2EnginePatchModel.Tags = []string{"tag1", "tag2"} + db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDb2EngineOptions model + updateDb2EngineOptionsModel := new(watsonxdatav3.UpdateDb2EngineOptions) + updateDb2EngineOptionsModel.ID = core.StringPtr("testString") + updateDb2EngineOptionsModel.Body = db2EnginePatchModelAsPatch + updateDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke RestartPrestissimoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateDb2Engine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RestartPrestissimoEngineOptions model - restartPrestissimoEngineOptionsModel := new(watsonxdatav2.RestartPrestissimoEngineOptions) - restartPrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - restartPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - restartPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Db2EnginePatch model + db2EnginePatchModel := new(watsonxdatav3.Db2EnginePatch) + db2EnginePatchModel.Description = core.StringPtr("db2 engine updated description") + db2EnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + db2EnginePatchModel.Tags = []string{"tag1", "tag2"} + db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDb2EngineOptions model + updateDb2EngineOptionsModel := new(watsonxdatav3.UpdateDb2EngineOptions) + updateDb2EngineOptionsModel.ID = core.StringPtr("testString") + updateDb2EngineOptionsModel.Body = db2EnginePatchModelAsPatch + updateDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the RestartPrestissimoEngineOptions model with no property values - restartPrestissimoEngineOptionsModelNew := new(watsonxdatav2.RestartPrestissimoEngineOptions) + // Construct a second instance of the UpdateDb2EngineOptions model with no property values + updateDb2EngineOptionsModelNew := new(watsonxdatav3.UpdateDb2EngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -13152,22 +13820,31 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke RestartPrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateDb2Engine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RestartPrestissimoEngineOptions model - restartPrestissimoEngineOptionsModel := new(watsonxdatav2.RestartPrestissimoEngineOptions) - restartPrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - restartPrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - restartPrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Db2EnginePatch model + db2EnginePatchModel := new(watsonxdatav3.Db2EnginePatch) + db2EnginePatchModel.Description = core.StringPtr("db2 engine updated description") + db2EnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + db2EnginePatchModel.Tags = []string{"tag1", "tag2"} + db2EnginePatchModelAsPatch, asPatchErr := db2EnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateDb2EngineOptions model + updateDb2EngineOptionsModel := new(watsonxdatav3.UpdateDb2EngineOptions) + updateDb2EngineOptionsModel.ID = core.StringPtr("testString") + updateDb2EngineOptionsModel.Body = db2EnginePatchModelAsPatch + updateDb2EngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateDb2EngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.RestartPrestissimoEngine(restartPrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateDb2Engine(updateDb2EngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -13179,16 +13856,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ResumePrestissimoEngine(resumePrestissimoEngineOptions *ResumePrestissimoEngineOptions) - Operation response error`, func() { - resumePrestissimoEnginePath := "/prestissimo_engines/testString/resume" + Describe(`ListOtherEngines(listOtherEnginesOptions *ListOtherEnginesOptions) - Operation response error`, func() { + listOtherEnginesPath := "/v3/other_engines" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(resumePrestissimoEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listOtherEnginesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -13196,28 +13873,27 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ResumePrestissimoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListOtherEngines with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ResumePrestissimoEngineOptions model - resumePrestissimoEngineOptionsModel := new(watsonxdatav2.ResumePrestissimoEngineOptions) - resumePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - resumePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOtherEnginesOptions model + listOtherEnginesOptionsModel := new(watsonxdatav3.ListOtherEnginesOptions) + listOtherEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listOtherEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -13227,16 +13903,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ResumePrestissimoEngine(resumePrestissimoEngineOptions *ResumePrestissimoEngineOptions)`, func() { - resumePrestissimoEnginePath := "/prestissimo_engines/testString/resume" + Describe(`ListOtherEngines(listOtherEnginesOptions *ListOtherEnginesOptions)`, func() { + listOtherEnginesPath := "/v3/other_engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(resumePrestissimoEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listOtherEnginesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -13246,11 +13922,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + fmt.Fprintf(res, "%s", `{"other_engines": [{"actions": ["Actions"], "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4", "type": "netezza"}, "created_at": 0, "created_by": "@.com", "description": "engine for running sql queries", "display_name": "sampleEngine", "host_name": "xyz-netezza-01-netezza-svc", "id": "sampleEngine123", "origin": "ibm", "port": 0, "status": "registered", "tags": ["Tags"], "type": "external"}]}`) })) }) - It(`Invoke ResumePrestissimoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListOtherEngines successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -13258,22 +13934,21 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ResumePrestissimoEngineOptions model - resumePrestissimoEngineOptionsModel := new(watsonxdatav2.ResumePrestissimoEngineOptions) - resumePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - resumePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOtherEnginesOptions model + listOtherEnginesOptionsModel := new(watsonxdatav3.ListOtherEnginesOptions) + listOtherEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listOtherEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ResumePrestissimoEngineWithContext(ctx, resumePrestissimoEngineOptionsModel) + _, _, operationErr := watsonxDataService.ListOtherEnginesWithContext(ctx, listOtherEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -13281,7 +13956,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ResumePrestissimoEngineWithContext(ctx, resumePrestissimoEngineOptionsModel) + _, _, operationErr = watsonxDataService.ListOtherEnginesWithContext(ctx, listOtherEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -13295,19 +13970,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(resumePrestissimoEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listOtherEnginesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + fmt.Fprintf(res, "%s", `{"other_engines": [{"actions": ["Actions"], "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4", "type": "netezza"}, "created_at": 0, "created_by": "@.com", "description": "engine for running sql queries", "display_name": "sampleEngine", "host_name": "xyz-netezza-01-netezza-svc", "id": "sampleEngine123", "origin": "ibm", "port": 0, "status": "registered", "tags": ["Tags"], "type": "external"}]}`) })) }) - It(`Invoke ResumePrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListOtherEngines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -13315,52 +13990,43 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ResumePrestissimoEngine(nil) + result, response, operationErr := watsonxDataService.ListOtherEngines(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ResumePrestissimoEngineOptions model - resumePrestissimoEngineOptionsModel := new(watsonxdatav2.ResumePrestissimoEngineOptions) - resumePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - resumePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOtherEnginesOptions model + listOtherEnginesOptionsModel := new(watsonxdatav3.ListOtherEnginesOptions) + listOtherEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listOtherEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ResumePrestissimoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListOtherEngines with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ResumePrestissimoEngineOptions model - resumePrestissimoEngineOptionsModel := new(watsonxdatav2.ResumePrestissimoEngineOptions) - resumePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - resumePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOtherEnginesOptions model + listOtherEnginesOptionsModel := new(watsonxdatav3.ListOtherEnginesOptions) + listOtherEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listOtherEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ResumePrestissimoEngineOptions model with no property values - resumePrestissimoEngineOptionsModelNew := new(watsonxdatav2.ResumePrestissimoEngineOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -13375,22 +14041,21 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ResumePrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListOtherEngines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ResumePrestissimoEngineOptions model - resumePrestissimoEngineOptionsModel := new(watsonxdatav2.ResumePrestissimoEngineOptions) - resumePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - resumePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListOtherEnginesOptions model + listOtherEnginesOptionsModel := new(watsonxdatav3.ListOtherEnginesOptions) + listOtherEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listOtherEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ResumePrestissimoEngine(resumePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListOtherEngines(listOtherEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -13402,52 +14067,54 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ScalePrestissimoEngine(scalePrestissimoEngineOptions *ScalePrestissimoEngineOptions) - Operation response error`, func() { - scalePrestissimoEnginePath := "/prestissimo_engines/testString/scale" + Describe(`CreateOtherEngine(createOtherEngineOptions *CreateOtherEngineOptions) - Operation response error`, func() { + createOtherEnginePath := "/v3/other_engines" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(scalePrestissimoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createOtherEnginePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ScalePrestissimoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateOtherEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) + // Construct an instance of the OtherEngineConfigurationBody model + otherEngineConfigurationBodyModel := new(watsonxdatav3.OtherEngineConfigurationBody) + otherEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + otherEngineConfigurationBodyModel.Type = core.StringPtr("netezza") - // Construct an instance of the ScalePrestissimoEngineOptions model - scalePrestissimoEngineOptionsModel := new(watsonxdatav2.ScalePrestissimoEngineOptions) - scalePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - scalePrestissimoEngineOptionsModel.Coordinator = prestissimoNodeDescriptionBodyModel - scalePrestissimoEngineOptionsModel.Worker = prestissimoNodeDescriptionBodyModel - scalePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scalePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateOtherEngineOptions model + createOtherEngineOptionsModel := new(watsonxdatav3.CreateOtherEngineOptions) + createOtherEngineOptionsModel.Configuration = otherEngineConfigurationBodyModel + createOtherEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine01") + createOtherEngineOptionsModel.Origin = core.StringPtr("external") + createOtherEngineOptionsModel.Description = core.StringPtr("external engine description") + createOtherEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -13457,15 +14124,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ScalePrestissimoEngine(scalePrestissimoEngineOptions *ScalePrestissimoEngineOptions)`, func() { - scalePrestissimoEnginePath := "/prestissimo_engines/testString/scale" + Describe(`CreateOtherEngine(createOtherEngineOptions *CreateOtherEngineOptions)`, func() { + createOtherEnginePath := "/v3/other_engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(scalePrestissimoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createOtherEnginePath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -13491,12 +14158,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4", "type": "netezza"}, "created_at": 0, "created_by": "@.com", "description": "engine for running sql queries", "display_name": "sampleEngine", "host_name": "xyz-netezza-01-netezza-svc", "id": "sampleEngine123", "origin": "ibm", "port": 0, "status": "registered", "tags": ["Tags"], "type": "external"}`) })) }) - It(`Invoke ScalePrestissimoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateOtherEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -13504,29 +14171,31 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) + // Construct an instance of the OtherEngineConfigurationBody model + otherEngineConfigurationBodyModel := new(watsonxdatav3.OtherEngineConfigurationBody) + otherEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + otherEngineConfigurationBodyModel.Type = core.StringPtr("netezza") - // Construct an instance of the ScalePrestissimoEngineOptions model - scalePrestissimoEngineOptionsModel := new(watsonxdatav2.ScalePrestissimoEngineOptions) - scalePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - scalePrestissimoEngineOptionsModel.Coordinator = prestissimoNodeDescriptionBodyModel - scalePrestissimoEngineOptionsModel.Worker = prestissimoNodeDescriptionBodyModel - scalePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scalePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateOtherEngineOptions model + createOtherEngineOptionsModel := new(watsonxdatav3.CreateOtherEngineOptions) + createOtherEngineOptionsModel.Configuration = otherEngineConfigurationBodyModel + createOtherEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine01") + createOtherEngineOptionsModel.Origin = core.StringPtr("external") + createOtherEngineOptionsModel.Description = core.StringPtr("external engine description") + createOtherEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ScalePrestissimoEngineWithContext(ctx, scalePrestissimoEngineOptionsModel) + _, _, operationErr := watsonxDataService.CreateOtherEngineWithContext(ctx, createOtherEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -13534,7 +14203,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ScalePrestissimoEngineWithContext(ctx, scalePrestissimoEngineOptionsModel) + _, _, operationErr = watsonxDataService.CreateOtherEngineWithContext(ctx, createOtherEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -13548,7 +14217,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(scalePrestissimoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createOtherEnginePath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -13571,12 +14240,12 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4", "type": "netezza"}, "created_at": 0, "created_by": "@.com", "description": "engine for running sql queries", "display_name": "sampleEngine", "host_name": "xyz-netezza-01-netezza-svc", "id": "sampleEngine123", "origin": "ibm", "port": 0, "status": "registered", "tags": ["Tags"], "type": "external"}`) })) }) - It(`Invoke ScalePrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateOtherEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -13584,63 +14253,67 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ScalePrestissimoEngine(nil) + result, response, operationErr := watsonxDataService.CreateOtherEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) + // Construct an instance of the OtherEngineConfigurationBody model + otherEngineConfigurationBodyModel := new(watsonxdatav3.OtherEngineConfigurationBody) + otherEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + otherEngineConfigurationBodyModel.Type = core.StringPtr("netezza") - // Construct an instance of the ScalePrestissimoEngineOptions model - scalePrestissimoEngineOptionsModel := new(watsonxdatav2.ScalePrestissimoEngineOptions) - scalePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - scalePrestissimoEngineOptionsModel.Coordinator = prestissimoNodeDescriptionBodyModel - scalePrestissimoEngineOptionsModel.Worker = prestissimoNodeDescriptionBodyModel - scalePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scalePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateOtherEngineOptions model + createOtherEngineOptionsModel := new(watsonxdatav3.CreateOtherEngineOptions) + createOtherEngineOptionsModel.Configuration = otherEngineConfigurationBodyModel + createOtherEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine01") + createOtherEngineOptionsModel.Origin = core.StringPtr("external") + createOtherEngineOptionsModel.Description = core.StringPtr("external engine description") + createOtherEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ScalePrestissimoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateOtherEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) + // Construct an instance of the OtherEngineConfigurationBody model + otherEngineConfigurationBodyModel := new(watsonxdatav3.OtherEngineConfigurationBody) + otherEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + otherEngineConfigurationBodyModel.Type = core.StringPtr("netezza") - // Construct an instance of the ScalePrestissimoEngineOptions model - scalePrestissimoEngineOptionsModel := new(watsonxdatav2.ScalePrestissimoEngineOptions) - scalePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - scalePrestissimoEngineOptionsModel.Coordinator = prestissimoNodeDescriptionBodyModel - scalePrestissimoEngineOptionsModel.Worker = prestissimoNodeDescriptionBodyModel - scalePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scalePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateOtherEngineOptions model + createOtherEngineOptionsModel := new(watsonxdatav3.CreateOtherEngineOptions) + createOtherEngineOptionsModel.Configuration = otherEngineConfigurationBodyModel + createOtherEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine01") + createOtherEngineOptionsModel.Origin = core.StringPtr("external") + createOtherEngineOptionsModel.Description = core.StringPtr("external engine description") + createOtherEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ScalePrestissimoEngineOptions model with no property values - scalePrestissimoEngineOptionsModelNew := new(watsonxdatav2.ScalePrestissimoEngineOptions) + // Construct a second instance of the CreateOtherEngineOptions model with no property values + createOtherEngineOptionsModelNew := new(watsonxdatav3.CreateOtherEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -13655,32 +14328,34 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(201) })) }) - It(`Invoke ScalePrestissimoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateOtherEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) + // Construct an instance of the OtherEngineConfigurationBody model + otherEngineConfigurationBodyModel := new(watsonxdatav3.OtherEngineConfigurationBody) + otherEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + otherEngineConfigurationBodyModel.Type = core.StringPtr("netezza") - // Construct an instance of the ScalePrestissimoEngineOptions model - scalePrestissimoEngineOptionsModel := new(watsonxdatav2.ScalePrestissimoEngineOptions) - scalePrestissimoEngineOptionsModel.EngineID = core.StringPtr("testString") - scalePrestissimoEngineOptionsModel.Coordinator = prestissimoNodeDescriptionBodyModel - scalePrestissimoEngineOptionsModel.Worker = prestissimoNodeDescriptionBodyModel - scalePrestissimoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scalePrestissimoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateOtherEngineOptions model + createOtherEngineOptionsModel := new(watsonxdatav3.CreateOtherEngineOptions) + createOtherEngineOptionsModel.Configuration = otherEngineConfigurationBodyModel + createOtherEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine01") + createOtherEngineOptionsModel.Origin = core.StringPtr("external") + createOtherEngineOptionsModel.Description = core.StringPtr("external engine description") + createOtherEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ScalePrestissimoEngine(scalePrestissimoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateOtherEngine(createOtherEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -13692,15 +14367,87 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListPrestoEngines(listPrestoEnginesOptions *ListPrestoEnginesOptions) - Operation response error`, func() { - listPrestoEnginesPath := "/presto_engines" + Describe(`DeleteOtherEngine(deleteOtherEngineOptions *DeleteOtherEngineOptions)`, func() { + deleteOtherEnginePath := "/v3/other_engines/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteOtherEnginePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteOtherEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteOtherEngine(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteOtherEngineOptions model + deleteOtherEngineOptionsModel := new(watsonxdatav3.DeleteOtherEngineOptions) + deleteOtherEngineOptionsModel.ID = core.StringPtr("testString") + deleteOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteOtherEngine(deleteOtherEngineOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteOtherEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DeleteOtherEngineOptions model + deleteOtherEngineOptionsModel := new(watsonxdatav3.DeleteOtherEngineOptions) + deleteOtherEngineOptionsModel.ID = core.StringPtr("testString") + deleteOtherEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteOtherEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteOtherEngine(deleteOtherEngineOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteOtherEngineOptions model with no property values + deleteOtherEngineOptionsModelNew := new(watsonxdatav3.DeleteOtherEngineOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteOtherEngine(deleteOtherEngineOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListNetezzaEngines(listNetezzaEnginesOptions *ListNetezzaEnginesOptions) - Operation response error`, func() { + listNetezzaEnginesPath := "/v3/netezza_engines" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestoEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listNetezzaEnginesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -13709,27 +14456,27 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListPrestoEngines with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListNetezzaEngines with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestoEnginesOptions model - listPrestoEnginesOptionsModel := new(watsonxdatav2.ListPrestoEnginesOptions) - listPrestoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetezzaEnginesOptions model + listNetezzaEnginesOptionsModel := new(watsonxdatav3.ListNetezzaEnginesOptions) + listNetezzaEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listNetezzaEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) + result, response, operationErr = watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -13739,15 +14486,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListPrestoEngines(listPrestoEnginesOptions *ListPrestoEnginesOptions)`, func() { - listPrestoEnginesPath := "/presto_engines" + Describe(`ListNetezzaEngines(listNetezzaEnginesOptions *ListNetezzaEnginesOptions)`, func() { + listNetezzaEnginesPath := "/v3/netezza_engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestoEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listNetezzaEnginesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -13758,11 +14505,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"presto_engines": [{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "starter", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "presto engine for running sql queries", "drivers": [{"connection_type": "saphana", "driver_id": "saphanadriver123", "driver_name": "saphanadriver-1.2.3", "driver_version": "1.2.3"}], "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "instance_id": "instance_id", "managed_by": "fully/self", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "event_listener": {"event_listener_property": "EventListenerProperty"}, "global": {"global_property": "enable-mixed-case-support:true"}, "jvm": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "jmx_exporter_config": {"global_property": "watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes"}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "event_listener": ["EventListener"], "global": ["Global"], "jmx_exporter_config": ["JmxExporterConfig"], "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "starter", "quantity": 8}}]}`) + fmt.Fprintf(res, "%s", `{"netezza_engines": [{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 0, "created_by": "@.com", "description": "netezza engine description", "display_name": "sampleEngine", "host_name": "xyz-netezza-01-netezza-svc", "id": "sampleEngine123", "origin": "ibm", "port": 0, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}]}`) })) }) - It(`Invoke ListPrestoEngines successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListNetezzaEngines successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -13770,21 +14517,21 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListPrestoEnginesOptions model - listPrestoEnginesOptionsModel := new(watsonxdatav2.ListPrestoEnginesOptions) - listPrestoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetezzaEnginesOptions model + listNetezzaEnginesOptionsModel := new(watsonxdatav3.ListNetezzaEnginesOptions) + listNetezzaEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listNetezzaEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListPrestoEnginesWithContext(ctx, listPrestoEnginesOptionsModel) + _, _, operationErr := watsonxDataService.ListNetezzaEnginesWithContext(ctx, listNetezzaEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -13792,7 +14539,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListPrestoEnginesWithContext(ctx, listPrestoEnginesOptionsModel) + _, _, operationErr = watsonxDataService.ListNetezzaEnginesWithContext(ctx, listNetezzaEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -13806,7 +14553,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestoEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listNetezzaEnginesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -13814,11 +14561,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"presto_engines": [{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "starter", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "presto engine for running sql queries", "drivers": [{"connection_type": "saphana", "driver_id": "saphanadriver123", "driver_name": "saphanadriver-1.2.3", "driver_version": "1.2.3"}], "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "instance_id": "instance_id", "managed_by": "fully/self", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "event_listener": {"event_listener_property": "EventListenerProperty"}, "global": {"global_property": "enable-mixed-case-support:true"}, "jvm": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "jmx_exporter_config": {"global_property": "watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes"}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "event_listener": ["EventListener"], "global": ["Global"], "jmx_exporter_config": ["JmxExporterConfig"], "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "starter", "quantity": 8}}]}`) + fmt.Fprintf(res, "%s", `{"netezza_engines": [{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 0, "created_by": "@.com", "description": "netezza engine description", "display_name": "sampleEngine", "host_name": "xyz-netezza-01-netezza-svc", "id": "sampleEngine123", "origin": "ibm", "port": 0, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}]}`) })) }) - It(`Invoke ListPrestoEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListNetezzaEngines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -13826,39 +14573,39 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListPrestoEngines(nil) + result, response, operationErr := watsonxDataService.ListNetezzaEngines(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListPrestoEnginesOptions model - listPrestoEnginesOptionsModel := new(watsonxdatav2.ListPrestoEnginesOptions) - listPrestoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetezzaEnginesOptions model + listNetezzaEnginesOptionsModel := new(watsonxdatav3.ListNetezzaEnginesOptions) + listNetezzaEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listNetezzaEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) + result, response, operationErr = watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListPrestoEngines with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListNetezzaEngines with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestoEnginesOptions model - listPrestoEnginesOptionsModel := new(watsonxdatav2.ListPrestoEnginesOptions) - listPrestoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetezzaEnginesOptions model + listNetezzaEnginesOptionsModel := new(watsonxdatav3.ListNetezzaEnginesOptions) + listNetezzaEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listNetezzaEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -13877,21 +14624,21 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListPrestoEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListNetezzaEngines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestoEnginesOptions model - listPrestoEnginesOptionsModel := new(watsonxdatav2.ListPrestoEnginesOptions) - listPrestoEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestoEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListNetezzaEnginesOptions model + listNetezzaEnginesOptionsModel := new(watsonxdatav3.ListNetezzaEnginesOptions) + listNetezzaEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listNetezzaEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListPrestoEngines(listPrestoEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListNetezzaEngines(listNetezzaEnginesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -13903,15 +14650,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreatePrestoEngine(createPrestoEngineOptions *CreatePrestoEngineOptions) - Operation response error`, func() { - createPrestoEnginePath := "/presto_engines" + Describe(`CreateNetezzaEngine(createNetezzaEngineOptions *CreateNetezzaEngineOptions) - Operation response error`, func() { + createNetezzaEnginePath := "/v3/netezza_engines" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createNetezzaEnginePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -13920,50 +14667,36 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreatePrestoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateNetezzaEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NodeDescriptionBody model - nodeDescriptionBodyModel := new(watsonxdatav2.NodeDescriptionBody) - nodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - nodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the EngineDetailsBody model - engineDetailsBodyModel := new(watsonxdatav2.EngineDetailsBody) - engineDetailsBodyModel.ApiKey = core.StringPtr("") - engineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - engineDetailsBodyModel.Coordinator = nodeDescriptionBodyModel - engineDetailsBodyModel.InstanceID = core.StringPtr("instance_id") - engineDetailsBodyModel.ManagedBy = core.StringPtr("fully/self") - engineDetailsBodyModel.SizeConfig = core.StringPtr("starter") - engineDetailsBodyModel.Worker = nodeDescriptionBodyModel + // Construct an instance of the NetezzaEngineConfigurationBody model + netezzaEngineConfigurationBodyModel := new(watsonxdatav3.NetezzaEngineConfigurationBody) + netezzaEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - // Construct an instance of the CreatePrestoEngineOptions model - createPrestoEngineOptionsModel := new(watsonxdatav2.CreatePrestoEngineOptions) - createPrestoEngineOptionsModel.Origin = core.StringPtr("native") - createPrestoEngineOptionsModel.AssociatedCatalogs = []string{"iceberg-data", "hive-data"} - createPrestoEngineOptionsModel.Description = core.StringPtr("presto engine for running sql queries") - createPrestoEngineOptionsModel.EngineDetails = engineDetailsBodyModel - createPrestoEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createPrestoEngineOptionsModel.Region = core.StringPtr("us-south") - createPrestoEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createPrestoEngineOptionsModel.Version = core.StringPtr("1.2.3") - createPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateNetezzaEngineOptions model + createNetezzaEngineOptionsModel := new(watsonxdatav3.CreateNetezzaEngineOptions) + createNetezzaEngineOptionsModel.Configuration = netezzaEngineConfigurationBodyModel + createNetezzaEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createNetezzaEngineOptionsModel.Origin = core.StringPtr("external") + createNetezzaEngineOptionsModel.Description = core.StringPtr("netezza engine description") + createNetezzaEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -13973,15 +14706,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreatePrestoEngine(createPrestoEngineOptions *CreatePrestoEngineOptions)`, func() { - createPrestoEnginePath := "/presto_engines" + Describe(`CreateNetezzaEngine(createNetezzaEngineOptions *CreateNetezzaEngineOptions)`, func() { + createNetezzaEnginePath := "/v3/netezza_engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createNetezzaEnginePath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -14008,11 +14741,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "starter", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "presto engine for running sql queries", "drivers": [{"connection_type": "saphana", "driver_id": "saphanadriver123", "driver_name": "saphanadriver-1.2.3", "driver_version": "1.2.3"}], "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "instance_id": "instance_id", "managed_by": "fully/self", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "event_listener": {"event_listener_property": "EventListenerProperty"}, "global": {"global_property": "enable-mixed-case-support:true"}, "jvm": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "jmx_exporter_config": {"global_property": "watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes"}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "event_listener": ["EventListener"], "global": ["Global"], "jmx_exporter_config": ["JmxExporterConfig"], "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "starter", "quantity": 8}}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 0, "created_by": "@.com", "description": "netezza engine description", "display_name": "sampleEngine", "host_name": "xyz-netezza-01-netezza-svc", "id": "sampleEngine123", "origin": "ibm", "port": 0, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}`) })) }) - It(`Invoke CreatePrestoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateNetezzaEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -14020,44 +14753,30 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the NodeDescriptionBody model - nodeDescriptionBodyModel := new(watsonxdatav2.NodeDescriptionBody) - nodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - nodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the EngineDetailsBody model - engineDetailsBodyModel := new(watsonxdatav2.EngineDetailsBody) - engineDetailsBodyModel.ApiKey = core.StringPtr("") - engineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - engineDetailsBodyModel.Coordinator = nodeDescriptionBodyModel - engineDetailsBodyModel.InstanceID = core.StringPtr("instance_id") - engineDetailsBodyModel.ManagedBy = core.StringPtr("fully/self") - engineDetailsBodyModel.SizeConfig = core.StringPtr("starter") - engineDetailsBodyModel.Worker = nodeDescriptionBodyModel + // Construct an instance of the NetezzaEngineConfigurationBody model + netezzaEngineConfigurationBodyModel := new(watsonxdatav3.NetezzaEngineConfigurationBody) + netezzaEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - // Construct an instance of the CreatePrestoEngineOptions model - createPrestoEngineOptionsModel := new(watsonxdatav2.CreatePrestoEngineOptions) - createPrestoEngineOptionsModel.Origin = core.StringPtr("native") - createPrestoEngineOptionsModel.AssociatedCatalogs = []string{"iceberg-data", "hive-data"} - createPrestoEngineOptionsModel.Description = core.StringPtr("presto engine for running sql queries") - createPrestoEngineOptionsModel.EngineDetails = engineDetailsBodyModel - createPrestoEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createPrestoEngineOptionsModel.Region = core.StringPtr("us-south") - createPrestoEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createPrestoEngineOptionsModel.Version = core.StringPtr("1.2.3") - createPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateNetezzaEngineOptions model + createNetezzaEngineOptionsModel := new(watsonxdatav3.CreateNetezzaEngineOptions) + createNetezzaEngineOptionsModel.Configuration = netezzaEngineConfigurationBodyModel + createNetezzaEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createNetezzaEngineOptionsModel.Origin = core.StringPtr("external") + createNetezzaEngineOptionsModel.Description = core.StringPtr("netezza engine description") + createNetezzaEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreatePrestoEngineWithContext(ctx, createPrestoEngineOptionsModel) + _, _, operationErr := watsonxDataService.CreateNetezzaEngineWithContext(ctx, createNetezzaEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -14065,7 +14784,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreatePrestoEngineWithContext(ctx, createPrestoEngineOptionsModel) + _, _, operationErr = watsonxDataService.CreateNetezzaEngineWithContext(ctx, createNetezzaEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -14079,7 +14798,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createNetezzaEnginePath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -14103,11 +14822,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "starter", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "presto engine for running sql queries", "drivers": [{"connection_type": "saphana", "driver_id": "saphanadriver123", "driver_name": "saphanadriver-1.2.3", "driver_version": "1.2.3"}], "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "instance_id": "instance_id", "managed_by": "fully/self", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "event_listener": {"event_listener_property": "EventListenerProperty"}, "global": {"global_property": "enable-mixed-case-support:true"}, "jvm": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "jmx_exporter_config": {"global_property": "watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes"}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "event_listener": ["EventListener"], "global": ["Global"], "jmx_exporter_config": ["JmxExporterConfig"], "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "starter", "quantity": 8}}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 0, "created_by": "@.com", "description": "netezza engine description", "display_name": "sampleEngine", "host_name": "xyz-netezza-01-netezza-svc", "id": "sampleEngine123", "origin": "ibm", "port": 0, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}`) })) }) - It(`Invoke CreatePrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateNetezzaEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -14115,93 +14834,65 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreatePrestoEngine(nil) + result, response, operationErr := watsonxDataService.CreateNetezzaEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the NodeDescriptionBody model - nodeDescriptionBodyModel := new(watsonxdatav2.NodeDescriptionBody) - nodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - nodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) + // Construct an instance of the NetezzaEngineConfigurationBody model + netezzaEngineConfigurationBodyModel := new(watsonxdatav3.NetezzaEngineConfigurationBody) + netezzaEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - // Construct an instance of the EngineDetailsBody model - engineDetailsBodyModel := new(watsonxdatav2.EngineDetailsBody) - engineDetailsBodyModel.ApiKey = core.StringPtr("") - engineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - engineDetailsBodyModel.Coordinator = nodeDescriptionBodyModel - engineDetailsBodyModel.InstanceID = core.StringPtr("instance_id") - engineDetailsBodyModel.ManagedBy = core.StringPtr("fully/self") - engineDetailsBodyModel.SizeConfig = core.StringPtr("starter") - engineDetailsBodyModel.Worker = nodeDescriptionBodyModel - - // Construct an instance of the CreatePrestoEngineOptions model - createPrestoEngineOptionsModel := new(watsonxdatav2.CreatePrestoEngineOptions) - createPrestoEngineOptionsModel.Origin = core.StringPtr("native") - createPrestoEngineOptionsModel.AssociatedCatalogs = []string{"iceberg-data", "hive-data"} - createPrestoEngineOptionsModel.Description = core.StringPtr("presto engine for running sql queries") - createPrestoEngineOptionsModel.EngineDetails = engineDetailsBodyModel - createPrestoEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createPrestoEngineOptionsModel.Region = core.StringPtr("us-south") - createPrestoEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createPrestoEngineOptionsModel.Version = core.StringPtr("1.2.3") - createPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateNetezzaEngineOptions model + createNetezzaEngineOptionsModel := new(watsonxdatav3.CreateNetezzaEngineOptions) + createNetezzaEngineOptionsModel.Configuration = netezzaEngineConfigurationBodyModel + createNetezzaEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createNetezzaEngineOptionsModel.Origin = core.StringPtr("external") + createNetezzaEngineOptionsModel.Description = core.StringPtr("netezza engine description") + createNetezzaEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreatePrestoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateNetezzaEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NodeDescriptionBody model - nodeDescriptionBodyModel := new(watsonxdatav2.NodeDescriptionBody) - nodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - nodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the EngineDetailsBody model - engineDetailsBodyModel := new(watsonxdatav2.EngineDetailsBody) - engineDetailsBodyModel.ApiKey = core.StringPtr("") - engineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - engineDetailsBodyModel.Coordinator = nodeDescriptionBodyModel - engineDetailsBodyModel.InstanceID = core.StringPtr("instance_id") - engineDetailsBodyModel.ManagedBy = core.StringPtr("fully/self") - engineDetailsBodyModel.SizeConfig = core.StringPtr("starter") - engineDetailsBodyModel.Worker = nodeDescriptionBodyModel + // Construct an instance of the NetezzaEngineConfigurationBody model + netezzaEngineConfigurationBodyModel := new(watsonxdatav3.NetezzaEngineConfigurationBody) + netezzaEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - // Construct an instance of the CreatePrestoEngineOptions model - createPrestoEngineOptionsModel := new(watsonxdatav2.CreatePrestoEngineOptions) - createPrestoEngineOptionsModel.Origin = core.StringPtr("native") - createPrestoEngineOptionsModel.AssociatedCatalogs = []string{"iceberg-data", "hive-data"} - createPrestoEngineOptionsModel.Description = core.StringPtr("presto engine for running sql queries") - createPrestoEngineOptionsModel.EngineDetails = engineDetailsBodyModel - createPrestoEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createPrestoEngineOptionsModel.Region = core.StringPtr("us-south") - createPrestoEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createPrestoEngineOptionsModel.Version = core.StringPtr("1.2.3") - createPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateNetezzaEngineOptions model + createNetezzaEngineOptionsModel := new(watsonxdatav3.CreateNetezzaEngineOptions) + createNetezzaEngineOptionsModel.Configuration = netezzaEngineConfigurationBodyModel + createNetezzaEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createNetezzaEngineOptionsModel.Origin = core.StringPtr("external") + createNetezzaEngineOptionsModel.Description = core.StringPtr("netezza engine description") + createNetezzaEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreatePrestoEngineOptions model with no property values - createPrestoEngineOptionsModelNew := new(watsonxdatav2.CreatePrestoEngineOptions) + // Construct a second instance of the CreateNetezzaEngineOptions model with no property values + createNetezzaEngineOptionsModelNew := new(watsonxdatav3.CreateNetezzaEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -14219,44 +14910,30 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreatePrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateNetezzaEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NodeDescriptionBody model - nodeDescriptionBodyModel := new(watsonxdatav2.NodeDescriptionBody) - nodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - nodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) + // Construct an instance of the NetezzaEngineConfigurationBody model + netezzaEngineConfigurationBodyModel := new(watsonxdatav3.NetezzaEngineConfigurationBody) + netezzaEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - // Construct an instance of the EngineDetailsBody model - engineDetailsBodyModel := new(watsonxdatav2.EngineDetailsBody) - engineDetailsBodyModel.ApiKey = core.StringPtr("") - engineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - engineDetailsBodyModel.Coordinator = nodeDescriptionBodyModel - engineDetailsBodyModel.InstanceID = core.StringPtr("instance_id") - engineDetailsBodyModel.ManagedBy = core.StringPtr("fully/self") - engineDetailsBodyModel.SizeConfig = core.StringPtr("starter") - engineDetailsBodyModel.Worker = nodeDescriptionBodyModel - - // Construct an instance of the CreatePrestoEngineOptions model - createPrestoEngineOptionsModel := new(watsonxdatav2.CreatePrestoEngineOptions) - createPrestoEngineOptionsModel.Origin = core.StringPtr("native") - createPrestoEngineOptionsModel.AssociatedCatalogs = []string{"iceberg-data", "hive-data"} - createPrestoEngineOptionsModel.Description = core.StringPtr("presto engine for running sql queries") - createPrestoEngineOptionsModel.EngineDetails = engineDetailsBodyModel - createPrestoEngineOptionsModel.EngineDisplayName = core.StringPtr("sampleEngine") - createPrestoEngineOptionsModel.Region = core.StringPtr("us-south") - createPrestoEngineOptionsModel.Tags = []string{"tag1", "tag2"} - createPrestoEngineOptionsModel.Version = core.StringPtr("1.2.3") - createPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateNetezzaEngineOptions model + createNetezzaEngineOptionsModel := new(watsonxdatav3.CreateNetezzaEngineOptions) + createNetezzaEngineOptionsModel.Configuration = netezzaEngineConfigurationBodyModel + createNetezzaEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createNetezzaEngineOptionsModel.Origin = core.StringPtr("external") + createNetezzaEngineOptionsModel.Description = core.StringPtr("netezza engine description") + createNetezzaEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreatePrestoEngine(createPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateNetezzaEngine(createNetezzaEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -14268,16 +14945,88 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetPrestoEngine(getPrestoEngineOptions *GetPrestoEngineOptions) - Operation response error`, func() { - getPrestoEnginePath := "/presto_engines/testString" + Describe(`DeleteNetezzaEngine(deleteNetezzaEngineOptions *DeleteNetezzaEngineOptions)`, func() { + deleteNetezzaEnginePath := "/v3/netezza_engines/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteNetezzaEnginePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteNetezzaEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteNetezzaEngine(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteNetezzaEngineOptions model + deleteNetezzaEngineOptionsModel := new(watsonxdatav3.DeleteNetezzaEngineOptions) + deleteNetezzaEngineOptionsModel.ID = core.StringPtr("testString") + deleteNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteNetezzaEngine(deleteNetezzaEngineOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteNetezzaEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DeleteNetezzaEngineOptions model + deleteNetezzaEngineOptionsModel := new(watsonxdatav3.DeleteNetezzaEngineOptions) + deleteNetezzaEngineOptionsModel.ID = core.StringPtr("testString") + deleteNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteNetezzaEngine(deleteNetezzaEngineOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteNetezzaEngineOptions model with no property values + deleteNetezzaEngineOptionsModelNew := new(watsonxdatav3.DeleteNetezzaEngineOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteNetezzaEngine(deleteNetezzaEngineOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateNetezzaEngine(updateNetezzaEngineOptions *UpdateNetezzaEngineOptions) - Operation response error`, func() { + updateNetezzaEnginePath := "/v3/netezza_engines/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestoEnginePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateNetezzaEnginePath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -14285,28 +15034,37 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetPrestoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateNetezzaEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestoEngineOptions model - getPrestoEngineOptionsModel := new(watsonxdatav2.GetPrestoEngineOptions) - getPrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - getPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetezzaEnginePatch model + netezzaEnginePatchModel := new(watsonxdatav3.NetezzaEnginePatch) + netezzaEnginePatchModel.Description = core.StringPtr("netezza engine updated description") + netezzaEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + netezzaEnginePatchModel.Tags = []string{"tag1", "tag2"} + netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetezzaEngineOptions model + updateNetezzaEngineOptionsModel := new(watsonxdatav3.UpdateNetezzaEngineOptions) + updateNetezzaEngineOptionsModel.ID = core.StringPtr("testString") + updateNetezzaEngineOptionsModel.Body = netezzaEnginePatchModelAsPatch + updateNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -14316,16 +15074,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetPrestoEngine(getPrestoEngineOptions *GetPrestoEngineOptions)`, func() { - getPrestoEnginePath := "/presto_engines/testString" + Describe(`UpdateNetezzaEngine(updateNetezzaEngineOptions *UpdateNetezzaEngineOptions)`, func() { + updateNetezzaEnginePath := "/v3/netezza_engines/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestoEnginePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateNetezzaEnginePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -14335,11 +15109,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "starter", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "presto engine for running sql queries", "drivers": [{"connection_type": "saphana", "driver_id": "saphanadriver123", "driver_name": "saphanadriver-1.2.3", "driver_version": "1.2.3"}], "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "instance_id": "instance_id", "managed_by": "fully/self", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "event_listener": {"event_listener_property": "EventListenerProperty"}, "global": {"global_property": "enable-mixed-case-support:true"}, "jvm": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "jmx_exporter_config": {"global_property": "watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes"}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "event_listener": ["EventListener"], "global": ["Global"], "jmx_exporter_config": ["JmxExporterConfig"], "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "starter", "quantity": 8}}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 0, "created_by": "@.com", "description": "netezza engine description", "display_name": "sampleEngine", "host_name": "xyz-netezza-01-netezza-svc", "id": "sampleEngine123", "origin": "ibm", "port": 0, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}`) })) }) - It(`Invoke GetPrestoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateNetezzaEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -14347,22 +15121,31 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetPrestoEngineOptions model - getPrestoEngineOptionsModel := new(watsonxdatav2.GetPrestoEngineOptions) - getPrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - getPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetezzaEnginePatch model + netezzaEnginePatchModel := new(watsonxdatav3.NetezzaEnginePatch) + netezzaEnginePatchModel.Description = core.StringPtr("netezza engine updated description") + netezzaEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + netezzaEnginePatchModel.Tags = []string{"tag1", "tag2"} + netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetezzaEngineOptions model + updateNetezzaEngineOptionsModel := new(watsonxdatav3.UpdateNetezzaEngineOptions) + updateNetezzaEngineOptionsModel.ID = core.StringPtr("testString") + updateNetezzaEngineOptionsModel.Body = netezzaEnginePatchModelAsPatch + updateNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetPrestoEngineWithContext(ctx, getPrestoEngineOptionsModel) + _, _, operationErr := watsonxDataService.UpdateNetezzaEngineWithContext(ctx, updateNetezzaEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -14370,7 +15153,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetPrestoEngineWithContext(ctx, getPrestoEngineOptionsModel) + _, _, operationErr = watsonxDataService.UpdateNetezzaEngineWithContext(ctx, updateNetezzaEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -14384,19 +15167,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestoEnginePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateNetezzaEnginePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "starter", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "presto engine for running sql queries", "drivers": [{"connection_type": "saphana", "driver_id": "saphanadriver123", "driver_name": "saphanadriver-1.2.3", "driver_version": "1.2.3"}], "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "instance_id": "instance_id", "managed_by": "fully/self", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "event_listener": {"event_listener_property": "EventListenerProperty"}, "global": {"global_property": "enable-mixed-case-support:true"}, "jvm": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "jmx_exporter_config": {"global_property": "watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes"}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "event_listener": ["EventListener"], "global": ["Global"], "jmx_exporter_config": ["JmxExporterConfig"], "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "starter", "quantity": 8}}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "build_version": "1.0.3.0.0", "configuration": {"connection_string": "1.2.3.4", "metastore_host": "1.2.3.4"}, "created_at": 0, "created_by": "@.com", "description": "netezza engine description", "display_name": "sampleEngine", "host_name": "xyz-netezza-01-netezza-svc", "id": "sampleEngine123", "origin": "ibm", "port": 0, "status": "REGISTERED", "tags": ["Tags"], "type": "netezza"}`) })) }) - It(`Invoke GetPrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateNetezzaEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -14404,49 +15203,67 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetPrestoEngine(nil) + result, response, operationErr := watsonxDataService.UpdateNetezzaEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetPrestoEngineOptions model - getPrestoEngineOptionsModel := new(watsonxdatav2.GetPrestoEngineOptions) - getPrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - getPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetezzaEnginePatch model + netezzaEnginePatchModel := new(watsonxdatav3.NetezzaEnginePatch) + netezzaEnginePatchModel.Description = core.StringPtr("netezza engine updated description") + netezzaEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + netezzaEnginePatchModel.Tags = []string{"tag1", "tag2"} + netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetezzaEngineOptions model + updateNetezzaEngineOptionsModel := new(watsonxdatav3.UpdateNetezzaEngineOptions) + updateNetezzaEngineOptionsModel.ID = core.StringPtr("testString") + updateNetezzaEngineOptionsModel.Body = netezzaEnginePatchModelAsPatch + updateNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetPrestoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateNetezzaEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestoEngineOptions model - getPrestoEngineOptionsModel := new(watsonxdatav2.GetPrestoEngineOptions) - getPrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - getPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetezzaEnginePatch model + netezzaEnginePatchModel := new(watsonxdatav3.NetezzaEnginePatch) + netezzaEnginePatchModel.Description = core.StringPtr("netezza engine updated description") + netezzaEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + netezzaEnginePatchModel.Tags = []string{"tag1", "tag2"} + netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetezzaEngineOptions model + updateNetezzaEngineOptionsModel := new(watsonxdatav3.UpdateNetezzaEngineOptions) + updateNetezzaEngineOptionsModel.ID = core.StringPtr("testString") + updateNetezzaEngineOptionsModel.Body = netezzaEnginePatchModelAsPatch + updateNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetPrestoEngineOptions model with no property values - getPrestoEngineOptionsModelNew := new(watsonxdatav2.GetPrestoEngineOptions) + // Construct a second instance of the UpdateNetezzaEngineOptions model with no property values + updateNetezzaEngineOptionsModelNew := new(watsonxdatav3.UpdateNetezzaEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -14464,22 +15281,31 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetPrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateNetezzaEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestoEngineOptions model - getPrestoEngineOptionsModel := new(watsonxdatav2.GetPrestoEngineOptions) - getPrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - getPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the NetezzaEnginePatch model + netezzaEnginePatchModel := new(watsonxdatav3.NetezzaEnginePatch) + netezzaEnginePatchModel.Description = core.StringPtr("netezza engine updated description") + netezzaEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + netezzaEnginePatchModel.Tags = []string{"tag1", "tag2"} + netezzaEnginePatchModelAsPatch, asPatchErr := netezzaEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateNetezzaEngineOptions model + updateNetezzaEngineOptionsModel := new(watsonxdatav3.UpdateNetezzaEngineOptions) + updateNetezzaEngineOptionsModel.ID = core.StringPtr("testString") + updateNetezzaEngineOptionsModel.Body = netezzaEnginePatchModelAsPatch + updateNetezzaEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateNetezzaEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetPrestoEngine(getPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateNetezzaEngine(updateNetezzaEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -14491,200 +15317,328 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteEngine(deleteEngineOptions *DeleteEngineOptions)`, func() { - deleteEnginePath := "/presto_engines/testString" - Context(`Using mock server endpoint`, func() { + Describe(`ListSparkEngines(listSparkEnginesOptions *ListSparkEnginesOptions) - Operation response error`, func() { + listSparkEnginesPath := "/v3/spark_engines" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteEnginePath)) - Expect(req.Method).To(Equal("DELETE")) - + Expect(req.URL.EscapedPath()).To(Equal(listSparkEnginesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(204) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngines with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteEngine(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteEngineOptions model - deleteEngineOptionsModel := new(watsonxdatav2.DeleteEngineOptions) - deleteEngineOptionsModel.EngineID = core.StringPtr("testString") - deleteEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSparkEnginesOptions model + listSparkEnginesOptionsModel := new(watsonxdatav3.ListSparkEnginesOptions) + listSparkEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteEngine(deleteEngineOptionsModel) - Expect(operationErr).To(BeNil()) + // Enable retries and test again + watsonxDataService.EnableRetries(0, 0) + result, response, operationErr = watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) - It(`Invoke DeleteEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeleteEngineOptions model - deleteEngineOptionsModel := new(watsonxdatav2.DeleteEngineOptions) - deleteEngineOptionsModel.EngineID = core.StringPtr("testString") - deleteEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteEngine(deleteEngineOptionsModel) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSparkEngines(listSparkEnginesOptions *ListSparkEnginesOptions)`, func() { + listSparkEnginesPath := "/v3/spark_engines" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listSparkEnginesPath)) + Expect(req.Method).To(Equal("GET")) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"spark_engines": [{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"api_key": "apikey", "connection_string": "https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id", "default_config": {"mapKey": "configuration"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-instance_id", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home": {"path": "spark/spark1234", "storage_name": "test-spark-storage", "volume": "test-spark-volume", "volume_id": "1704979825978585", "volume_name": "my-volume"}, "engine_sub_type": "java", "instance_id": "spark-id", "managed_by": "fully", "resource_limit_enabled": true, "resource_limits": {"cores": "1", "memory": "4G"}, "resource_utilisation": {"cores": "1m", "memory": "4Gi"}, "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}, "vscode_config": {"crn": "crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2", "environment_type": "SaaS", "host": "us-south.lakehouse.dev.cloud.ibm.com", "user_name": "user@example.com"}}, "created_at": 1, "created_by": "@.com", "description": "spark engine description", "display_name": "sampleEngine", "id": "spark123", "mode": "serverless", "origin": "external", "status": "provisioning", "tags": ["Tags"], "type": "spark"}]}`) + })) + }) + It(`Invoke ListSparkEngines successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + watsonxDataService.EnableRetries(0, 0) + + // Construct an instance of the ListSparkEnginesOptions model + listSparkEnginesOptionsModel := new(watsonxdatav3.ListSparkEnginesOptions) + listSparkEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := watsonxDataService.ListSparkEnginesWithContext(ctx, listSparkEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteEngineOptions model with no property values - deleteEngineOptionsModelNew := new(watsonxdatav2.DeleteEngineOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteEngine(deleteEngineOptionsModelNew) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + watsonxDataService.DisableRetries() + result, response, operationErr := watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) + + // Re-test the timeout error with retries disabled + ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc2() + _, _, operationErr = watsonxDataService.ListSparkEnginesWithContext(ctx, listSparkEnginesOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) AfterEach(func() { testServer.Close() }) }) - }) - Describe(`UpdatePrestoEngine(updatePrestoEngineOptions *UpdatePrestoEngineOptions) - Operation response error`, func() { - updatePrestoEnginePath := "/presto_engines/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updatePrestoEnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(listSparkEnginesPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + fmt.Fprintf(res, "%s", `{"spark_engines": [{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"api_key": "apikey", "connection_string": "https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id", "default_config": {"mapKey": "configuration"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-instance_id", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home": {"path": "spark/spark1234", "storage_name": "test-spark-storage", "volume": "test-spark-volume", "volume_id": "1704979825978585", "volume_name": "my-volume"}, "engine_sub_type": "java", "instance_id": "spark-id", "managed_by": "fully", "resource_limit_enabled": true, "resource_limits": {"cores": "1", "memory": "4G"}, "resource_utilisation": {"cores": "1m", "memory": "4Gi"}, "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}, "vscode_config": {"crn": "crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2", "environment_type": "SaaS", "host": "us-south.lakehouse.dev.cloud.ibm.com", "user_name": "user@example.com"}}, "created_at": 1, "created_by": "@.com", "description": "spark engine description", "display_name": "sampleEngine", "id": "spark123", "mode": "serverless", "origin": "external", "status": "provisioning", "tags": ["Tags"], "type": "spark"}]}`) })) }) - It(`Invoke UpdatePrestoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the EnginePropertiesCatalog model - enginePropertiesCatalogModel := new(watsonxdatav2.EnginePropertiesCatalog) - enginePropertiesCatalogModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesCatalogModel.Worker = map[string]string{"key1": "testString"} + // Invoke operation with nil options model (negative test) + result, response, operationErr := watsonxDataService.ListSparkEngines(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + + // Construct an instance of the ListSparkEnginesOptions model + listSparkEnginesOptionsModel := new(watsonxdatav3.ListSparkEnginesOptions) + listSparkEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + result, response, operationErr = watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).ToNot(BeNil()) - // Construct an instance of the PrestoEnginePropertiesCatalog model - prestoEnginePropertiesCatalogModel := new(watsonxdatav2.PrestoEnginePropertiesCatalog) - prestoEnginePropertiesCatalogModel.CatalogName = enginePropertiesCatalogModel + }) + It(`Invoke ListSparkEngines with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the EnginePropertiesOaiGen1Configuration model - enginePropertiesOaiGen1ConfigurationModel := new(watsonxdatav2.EnginePropertiesOaiGen1Configuration) - enginePropertiesOaiGen1ConfigurationModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesOaiGen1ConfigurationModel.Worker = map[string]string{"key1": "testString"} + // Construct an instance of the ListSparkEnginesOptions model + listSparkEnginesOptionsModel := new(watsonxdatav3.ListSparkEnginesOptions) + listSparkEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + result, response, operationErr := watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + Context(`Using mock server endpoint with missing response body`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the PrestoEnginePropertiesEventListener model - prestoEnginePropertiesEventListenerModel := new(watsonxdatav2.PrestoEnginePropertiesEventListener) - prestoEnginePropertiesEventListenerModel.EventListenerProperty = core.StringPtr("testString") + // Set success status code with no respoonse body + res.WriteHeader(200) + })) + }) + It(`Invoke ListSparkEngines successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PrestoEnginePropertiesGlobal model - prestoEnginePropertiesGlobalModel := new(watsonxdatav2.PrestoEnginePropertiesGlobal) - prestoEnginePropertiesGlobalModel.GlobalProperty = core.StringPtr("enable-mixed-case-support:true") + // Construct an instance of the ListSparkEnginesOptions model + listSparkEnginesOptionsModel := new(watsonxdatav3.ListSparkEnginesOptions) + listSparkEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the EnginePropertiesOaiGen1Jvm model - enginePropertiesOaiGen1JvmModel := new(watsonxdatav2.EnginePropertiesOaiGen1Jvm) - enginePropertiesOaiGen1JvmModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesOaiGen1JvmModel.Worker = map[string]string{"key1": "testString"} + // Invoke operation + result, response, operationErr := watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) - // Construct an instance of the PrestoEnginePropertiesJMX model - prestoEnginePropertiesJmxModel := new(watsonxdatav2.PrestoEnginePropertiesJMX) - prestoEnginePropertiesJmxModel.GlobalProperty = core.StringPtr("watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes") + // Verify a nil result + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`CreateSparkEngine(createSparkEngineOptions *CreateSparkEngineOptions) - Operation response error`, func() { + createSparkEnginePath := "/v3/spark_engines" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() - // Construct an instance of the EnginePropertiesLogConfiguration model - enginePropertiesLogConfigurationModel := new(watsonxdatav2.EnginePropertiesLogConfiguration) - enginePropertiesLogConfigurationModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesLogConfigurationModel.Worker = map[string]string{"key1": "testString"} + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createSparkEnginePath)) + Expect(req.Method).To(Equal("POST")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(202) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke CreateSparkEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PrestoEngineEngineProperties model - prestoEngineEnginePropertiesModel := new(watsonxdatav2.PrestoEngineEngineProperties) - prestoEngineEnginePropertiesModel.Catalog = prestoEnginePropertiesCatalogModel - prestoEngineEnginePropertiesModel.Configuration = enginePropertiesOaiGen1ConfigurationModel - prestoEngineEnginePropertiesModel.EventListener = prestoEnginePropertiesEventListenerModel - prestoEngineEnginePropertiesModel.Global = prestoEnginePropertiesGlobalModel - prestoEngineEnginePropertiesModel.Jvm = enginePropertiesOaiGen1JvmModel - prestoEngineEnginePropertiesModel.JmxExporterConfig = prestoEnginePropertiesJmxModel - prestoEngineEnginePropertiesModel.LogConfig = enginePropertiesLogConfigurationModel + // Construct an instance of the SparkEndpoints model + sparkEndpointsModel := new(watsonxdatav3.SparkEndpoints) + sparkEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id") + sparkEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") + sparkEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-instance_id") + sparkEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") + sparkEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") + sparkEndpointsModel.ViewHistoryServer = core.StringPtr("testString") + sparkEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") + sparkEndpointsModel.WxdEngineEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817") + sparkEndpointsModel.WxdHistoryServerEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server") + sparkEndpointsModel.WxdHistoryServerUiEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server/ui") - // Construct an instance of the RemoveEnginePropertiesOaiGenConfiguration model - removeEnginePropertiesOaiGenConfigurationModel := new(watsonxdatav2.RemoveEnginePropertiesOaiGenConfiguration) - removeEnginePropertiesOaiGenConfigurationModel.Coordinator = []string{"testString"} - removeEnginePropertiesOaiGenConfigurationModel.Worker = []string{"testString"} + // Construct an instance of the SparkEngineHome model + sparkEngineHomeModel := new(watsonxdatav3.SparkEngineHome) + sparkEngineHomeModel.Path = core.StringPtr("spark/spark1234") + sparkEngineHomeModel.StorageName = core.StringPtr("test-spark-storage") + sparkEngineHomeModel.Volume = core.StringPtr("test-spark-volume") + sparkEngineHomeModel.VolumeID = core.StringPtr("1704979825978585") + sparkEngineHomeModel.VolumeName = core.StringPtr("my-volume") - // Construct an instance of the RemoveEnginePropertiesOaiGenJvm model - removeEnginePropertiesOaiGenJvmModel := new(watsonxdatav2.RemoveEnginePropertiesOaiGenJvm) - removeEnginePropertiesOaiGenJvmModel.Coordinator = []string{"testString"} - removeEnginePropertiesOaiGenJvmModel.Worker = []string{"testString"} + // Construct an instance of the SparkEngineResourceLimit model + sparkEngineResourceLimitModel := new(watsonxdatav3.SparkEngineResourceLimit) + sparkEngineResourceLimitModel.Cores = core.StringPtr("1") + sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") - // Construct an instance of the RemoveEnginePropertiesLogConfig model - removeEnginePropertiesLogConfigModel := new(watsonxdatav2.RemoveEnginePropertiesLogConfig) - removeEnginePropertiesLogConfigModel.Coordinator = []string{"testString"} - removeEnginePropertiesLogConfigModel.Worker = []string{"testString"} - - // Construct an instance of the PrestoEnginePatchRemoveEngineProperties model - prestoEnginePatchRemoveEnginePropertiesModel := new(watsonxdatav2.PrestoEnginePatchRemoveEngineProperties) - prestoEnginePatchRemoveEnginePropertiesModel.Catalog = prestoEnginePropertiesCatalogModel - prestoEnginePatchRemoveEnginePropertiesModel.Configuration = removeEnginePropertiesOaiGenConfigurationModel - prestoEnginePatchRemoveEnginePropertiesModel.Jvm = removeEnginePropertiesOaiGenJvmModel - prestoEnginePatchRemoveEnginePropertiesModel.EventListener = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.Global = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.JmxExporterConfig = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.LogConfig = removeEnginePropertiesLogConfigModel + // Construct an instance of the SparkEngineResourceUtilisation model + sparkEngineResourceUtilisationModel := new(watsonxdatav3.SparkEngineResourceUtilisation) + sparkEngineResourceUtilisationModel.Cores = core.StringPtr("1m") + sparkEngineResourceUtilisationModel.Memory = core.StringPtr("4Gi") - // Construct an instance of the PrestoEnginePatch model - prestoEnginePatchModel := new(watsonxdatav2.PrestoEnginePatch) - prestoEnginePatchModel.Description = core.StringPtr("updated description for presto engine") - prestoEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - prestoEnginePatchModel.EngineProperties = prestoEngineEnginePropertiesModel - prestoEnginePatchModel.EngineRestart = core.StringPtr("force") - prestoEnginePatchModel.RemoveEngineProperties = prestoEnginePatchRemoveEnginePropertiesModel - prestoEnginePatchModel.Tags = []string{"tag1", "tag2"} - prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the SparkScaleConfig model + sparkScaleConfigModel := new(watsonxdatav3.SparkScaleConfig) + sparkScaleConfigModel.AutoScaleEnabled = core.BoolPtr(true) + sparkScaleConfigModel.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) + sparkScaleConfigModel.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) + sparkScaleConfigModel.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) + sparkScaleConfigModel.NodeType = core.StringPtr("medium") + sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(2)) + + // Construct an instance of the SparkVscodeConfig model + sparkVscodeConfigModel := new(watsonxdatav3.SparkVscodeConfig) + sparkVscodeConfigModel.Crn = core.StringPtr("crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2") + sparkVscodeConfigModel.EnvironmentType = core.StringPtr("SaaS") + sparkVscodeConfigModel.Host = core.StringPtr("us-south.lakehouse.dev.cloud.ibm.com") + sparkVscodeConfigModel.UserName = core.StringPtr("user@example.com") + + // Construct an instance of the SparkEngineDetails model + sparkEngineDetailsModel := new(watsonxdatav3.SparkEngineDetails) + sparkEngineDetailsModel.ApiKey = core.StringPtr("apikey") + sparkEngineDetailsModel.ConnectionString = core.StringPtr("https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id") + sparkEngineDetailsModel.DefaultConfig = map[string]string{"key1": "configuration"} + sparkEngineDetailsModel.DefaultVersion = core.StringPtr("4.8.3") + sparkEngineDetailsModel.Endpoints = sparkEndpointsModel + sparkEngineDetailsModel.EngineHome = sparkEngineHomeModel + sparkEngineDetailsModel.EngineSubType = core.StringPtr("java") + sparkEngineDetailsModel.InstanceID = core.StringPtr("spark-id") + sparkEngineDetailsModel.ManagedBy = core.StringPtr("fully") + sparkEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) + sparkEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel + sparkEngineDetailsModel.ResourceUtilisation = sparkEngineResourceUtilisationModel + sparkEngineDetailsModel.ScaleConfig = sparkScaleConfigModel + sparkEngineDetailsModel.VscodeConfig = sparkVscodeConfigModel - // Construct an instance of the UpdatePrestoEngineOptions model - updatePrestoEngineOptionsModel := new(watsonxdatav2.UpdatePrestoEngineOptions) - updatePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - updatePrestoEngineOptionsModel.Body = prestoEnginePatchModelAsPatch - updatePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updatePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSparkEngineOptions model + createSparkEngineOptionsModel := new(watsonxdatav3.CreateSparkEngineOptions) + createSparkEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createSparkEngineOptionsModel.Origin = core.StringPtr("external") + createSparkEngineOptionsModel.AssociatedCatalogs = []string{"iceberg_data", "hive_data"} + createSparkEngineOptionsModel.Configuration = sparkEngineDetailsModel + createSparkEngineOptionsModel.Description = core.StringPtr("spark engine description") + createSparkEngineOptionsModel.ID = core.StringPtr("spark123") + createSparkEngineOptionsModel.Status = core.StringPtr("provisioning") + createSparkEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createSparkEngineOptionsModel.Type = core.StringPtr("spark") + createSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -14694,16 +15648,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdatePrestoEngine(updatePrestoEngineOptions *UpdatePrestoEngineOptions)`, func() { - updatePrestoEnginePath := "/presto_engines/testString" + Describe(`CreateSparkEngine(createSparkEngineOptions *CreateSparkEngineOptions)`, func() { + createSparkEnginePath := "/v3/spark_engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updatePrestoEnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createSparkEnginePath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -14728,12 +15682,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "starter", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "presto engine for running sql queries", "drivers": [{"connection_type": "saphana", "driver_id": "saphanadriver123", "driver_name": "saphanadriver-1.2.3", "driver_version": "1.2.3"}], "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "instance_id": "instance_id", "managed_by": "fully/self", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "event_listener": {"event_listener_property": "EventListenerProperty"}, "global": {"global_property": "enable-mixed-case-support:true"}, "jvm": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "jmx_exporter_config": {"global_property": "watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes"}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "event_listener": ["EventListener"], "global": ["Global"], "jmx_exporter_config": ["JmxExporterConfig"], "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "starter", "quantity": 8}}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"api_key": "apikey", "connection_string": "https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id", "default_config": {"mapKey": "configuration"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-instance_id", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home": {"path": "spark/spark1234", "storage_name": "test-spark-storage", "volume": "test-spark-volume", "volume_id": "1704979825978585", "volume_name": "my-volume"}, "engine_sub_type": "java", "instance_id": "spark-id", "managed_by": "fully", "resource_limit_enabled": true, "resource_limits": {"cores": "1", "memory": "4G"}, "resource_utilisation": {"cores": "1m", "memory": "4Gi"}, "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}, "vscode_config": {"crn": "crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2", "environment_type": "SaaS", "host": "us-south.lakehouse.dev.cloud.ibm.com", "user_name": "user@example.com"}}, "created_at": 1, "created_by": "@.com", "description": "spark engine description", "display_name": "sampleEngine", "id": "spark123", "mode": "serverless", "origin": "external", "status": "provisioning", "tags": ["Tags"], "type": "spark"}`) })) }) - It(`Invoke UpdatePrestoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -14741,105 +15695,94 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the EnginePropertiesCatalog model - enginePropertiesCatalogModel := new(watsonxdatav2.EnginePropertiesCatalog) - enginePropertiesCatalogModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesCatalogModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEnginePropertiesCatalog model - prestoEnginePropertiesCatalogModel := new(watsonxdatav2.PrestoEnginePropertiesCatalog) - prestoEnginePropertiesCatalogModel.CatalogName = enginePropertiesCatalogModel - - // Construct an instance of the EnginePropertiesOaiGen1Configuration model - enginePropertiesOaiGen1ConfigurationModel := new(watsonxdatav2.EnginePropertiesOaiGen1Configuration) - enginePropertiesOaiGen1ConfigurationModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesOaiGen1ConfigurationModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEnginePropertiesEventListener model - prestoEnginePropertiesEventListenerModel := new(watsonxdatav2.PrestoEnginePropertiesEventListener) - prestoEnginePropertiesEventListenerModel.EventListenerProperty = core.StringPtr("testString") - - // Construct an instance of the PrestoEnginePropertiesGlobal model - prestoEnginePropertiesGlobalModel := new(watsonxdatav2.PrestoEnginePropertiesGlobal) - prestoEnginePropertiesGlobalModel.GlobalProperty = core.StringPtr("enable-mixed-case-support:true") - - // Construct an instance of the EnginePropertiesOaiGen1Jvm model - enginePropertiesOaiGen1JvmModel := new(watsonxdatav2.EnginePropertiesOaiGen1Jvm) - enginePropertiesOaiGen1JvmModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesOaiGen1JvmModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEnginePropertiesJMX model - prestoEnginePropertiesJmxModel := new(watsonxdatav2.PrestoEnginePropertiesJMX) - prestoEnginePropertiesJmxModel.GlobalProperty = core.StringPtr("watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes") - - // Construct an instance of the EnginePropertiesLogConfiguration model - enginePropertiesLogConfigurationModel := new(watsonxdatav2.EnginePropertiesLogConfiguration) - enginePropertiesLogConfigurationModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesLogConfigurationModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEngineEngineProperties model - prestoEngineEnginePropertiesModel := new(watsonxdatav2.PrestoEngineEngineProperties) - prestoEngineEnginePropertiesModel.Catalog = prestoEnginePropertiesCatalogModel - prestoEngineEnginePropertiesModel.Configuration = enginePropertiesOaiGen1ConfigurationModel - prestoEngineEnginePropertiesModel.EventListener = prestoEnginePropertiesEventListenerModel - prestoEngineEnginePropertiesModel.Global = prestoEnginePropertiesGlobalModel - prestoEngineEnginePropertiesModel.Jvm = enginePropertiesOaiGen1JvmModel - prestoEngineEnginePropertiesModel.JmxExporterConfig = prestoEnginePropertiesJmxModel - prestoEngineEnginePropertiesModel.LogConfig = enginePropertiesLogConfigurationModel - - // Construct an instance of the RemoveEnginePropertiesOaiGenConfiguration model - removeEnginePropertiesOaiGenConfigurationModel := new(watsonxdatav2.RemoveEnginePropertiesOaiGenConfiguration) - removeEnginePropertiesOaiGenConfigurationModel.Coordinator = []string{"testString"} - removeEnginePropertiesOaiGenConfigurationModel.Worker = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesOaiGenJvm model - removeEnginePropertiesOaiGenJvmModel := new(watsonxdatav2.RemoveEnginePropertiesOaiGenJvm) - removeEnginePropertiesOaiGenJvmModel.Coordinator = []string{"testString"} - removeEnginePropertiesOaiGenJvmModel.Worker = []string{"testString"} + // Construct an instance of the SparkEndpoints model + sparkEndpointsModel := new(watsonxdatav3.SparkEndpoints) + sparkEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id") + sparkEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") + sparkEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-instance_id") + sparkEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") + sparkEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") + sparkEndpointsModel.ViewHistoryServer = core.StringPtr("testString") + sparkEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") + sparkEndpointsModel.WxdEngineEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817") + sparkEndpointsModel.WxdHistoryServerEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server") + sparkEndpointsModel.WxdHistoryServerUiEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server/ui") + + // Construct an instance of the SparkEngineHome model + sparkEngineHomeModel := new(watsonxdatav3.SparkEngineHome) + sparkEngineHomeModel.Path = core.StringPtr("spark/spark1234") + sparkEngineHomeModel.StorageName = core.StringPtr("test-spark-storage") + sparkEngineHomeModel.Volume = core.StringPtr("test-spark-volume") + sparkEngineHomeModel.VolumeID = core.StringPtr("1704979825978585") + sparkEngineHomeModel.VolumeName = core.StringPtr("my-volume") - // Construct an instance of the RemoveEnginePropertiesLogConfig model - removeEnginePropertiesLogConfigModel := new(watsonxdatav2.RemoveEnginePropertiesLogConfig) - removeEnginePropertiesLogConfigModel.Coordinator = []string{"testString"} - removeEnginePropertiesLogConfigModel.Worker = []string{"testString"} - - // Construct an instance of the PrestoEnginePatchRemoveEngineProperties model - prestoEnginePatchRemoveEnginePropertiesModel := new(watsonxdatav2.PrestoEnginePatchRemoveEngineProperties) - prestoEnginePatchRemoveEnginePropertiesModel.Catalog = prestoEnginePropertiesCatalogModel - prestoEnginePatchRemoveEnginePropertiesModel.Configuration = removeEnginePropertiesOaiGenConfigurationModel - prestoEnginePatchRemoveEnginePropertiesModel.Jvm = removeEnginePropertiesOaiGenJvmModel - prestoEnginePatchRemoveEnginePropertiesModel.EventListener = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.Global = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.JmxExporterConfig = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.LogConfig = removeEnginePropertiesLogConfigModel + // Construct an instance of the SparkEngineResourceLimit model + sparkEngineResourceLimitModel := new(watsonxdatav3.SparkEngineResourceLimit) + sparkEngineResourceLimitModel.Cores = core.StringPtr("1") + sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") - // Construct an instance of the PrestoEnginePatch model - prestoEnginePatchModel := new(watsonxdatav2.PrestoEnginePatch) - prestoEnginePatchModel.Description = core.StringPtr("updated description for presto engine") - prestoEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - prestoEnginePatchModel.EngineProperties = prestoEngineEnginePropertiesModel - prestoEnginePatchModel.EngineRestart = core.StringPtr("force") - prestoEnginePatchModel.RemoveEngineProperties = prestoEnginePatchRemoveEnginePropertiesModel - prestoEnginePatchModel.Tags = []string{"tag1", "tag2"} - prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the SparkEngineResourceUtilisation model + sparkEngineResourceUtilisationModel := new(watsonxdatav3.SparkEngineResourceUtilisation) + sparkEngineResourceUtilisationModel.Cores = core.StringPtr("1m") + sparkEngineResourceUtilisationModel.Memory = core.StringPtr("4Gi") - // Construct an instance of the UpdatePrestoEngineOptions model - updatePrestoEngineOptionsModel := new(watsonxdatav2.UpdatePrestoEngineOptions) - updatePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - updatePrestoEngineOptionsModel.Body = prestoEnginePatchModelAsPatch - updatePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updatePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SparkScaleConfig model + sparkScaleConfigModel := new(watsonxdatav3.SparkScaleConfig) + sparkScaleConfigModel.AutoScaleEnabled = core.BoolPtr(true) + sparkScaleConfigModel.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) + sparkScaleConfigModel.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) + sparkScaleConfigModel.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) + sparkScaleConfigModel.NodeType = core.StringPtr("medium") + sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(2)) + + // Construct an instance of the SparkVscodeConfig model + sparkVscodeConfigModel := new(watsonxdatav3.SparkVscodeConfig) + sparkVscodeConfigModel.Crn = core.StringPtr("crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2") + sparkVscodeConfigModel.EnvironmentType = core.StringPtr("SaaS") + sparkVscodeConfigModel.Host = core.StringPtr("us-south.lakehouse.dev.cloud.ibm.com") + sparkVscodeConfigModel.UserName = core.StringPtr("user@example.com") + + // Construct an instance of the SparkEngineDetails model + sparkEngineDetailsModel := new(watsonxdatav3.SparkEngineDetails) + sparkEngineDetailsModel.ApiKey = core.StringPtr("apikey") + sparkEngineDetailsModel.ConnectionString = core.StringPtr("https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id") + sparkEngineDetailsModel.DefaultConfig = map[string]string{"key1": "configuration"} + sparkEngineDetailsModel.DefaultVersion = core.StringPtr("4.8.3") + sparkEngineDetailsModel.Endpoints = sparkEndpointsModel + sparkEngineDetailsModel.EngineHome = sparkEngineHomeModel + sparkEngineDetailsModel.EngineSubType = core.StringPtr("java") + sparkEngineDetailsModel.InstanceID = core.StringPtr("spark-id") + sparkEngineDetailsModel.ManagedBy = core.StringPtr("fully") + sparkEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) + sparkEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel + sparkEngineDetailsModel.ResourceUtilisation = sparkEngineResourceUtilisationModel + sparkEngineDetailsModel.ScaleConfig = sparkScaleConfigModel + sparkEngineDetailsModel.VscodeConfig = sparkVscodeConfigModel + + // Construct an instance of the CreateSparkEngineOptions model + createSparkEngineOptionsModel := new(watsonxdatav3.CreateSparkEngineOptions) + createSparkEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createSparkEngineOptionsModel.Origin = core.StringPtr("external") + createSparkEngineOptionsModel.AssociatedCatalogs = []string{"iceberg_data", "hive_data"} + createSparkEngineOptionsModel.Configuration = sparkEngineDetailsModel + createSparkEngineOptionsModel.Description = core.StringPtr("spark engine description") + createSparkEngineOptionsModel.ID = core.StringPtr("spark123") + createSparkEngineOptionsModel.Status = core.StringPtr("provisioning") + createSparkEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createSparkEngineOptionsModel.Type = core.StringPtr("spark") + createSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdatePrestoEngineWithContext(ctx, updatePrestoEngineOptionsModel) + _, _, operationErr := watsonxDataService.CreateSparkEngineWithContext(ctx, createSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -14847,7 +15790,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdatePrestoEngineWithContext(ctx, updatePrestoEngineOptionsModel) + _, _, operationErr = watsonxDataService.CreateSparkEngineWithContext(ctx, createSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -14861,8 +15804,8 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updatePrestoEnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createSparkEnginePath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -14884,12 +15827,12 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "coordinator": {"node_type": "starter", "quantity": 8}, "created_by": "@.com", "created_on": 9, "description": "presto engine for running sql queries", "drivers": [{"connection_type": "saphana", "driver_id": "saphanadriver123", "driver_name": "saphanadriver-1.2.3", "driver_version": "1.2.3"}], "engine_details": {"api_key": "", "connection_string": "1.2.3.4", "coordinator": {"node_type": "worker", "quantity": 8}, "instance_id": "instance_id", "managed_by": "fully/self", "size_config": "starter", "worker": {"node_type": "worker", "quantity": 8}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "event_listener": {"event_listener_property": "EventListenerProperty"}, "global": {"global_property": "enable-mixed-case-support:true"}, "jvm": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}, "jmx_exporter_config": {"global_property": "watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes"}, "log_config": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "engine_restart": "force", "external_host_name": "your-hostname.apps.your-domain.com", "group_id": "new_group_id", "host_name": "ibm-lh-lakehouse-presto-01-presto-svc", "origin": "native", "port": 4, "region": "us-south", "remove_engine_properties": {"catalog": {"catalog_name": {"coordinator": {"mapKey": "Inner"}, "worker": {"mapKey": "Inner"}}}, "configuration": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "jvm": {"coordinator": ["Coordinator"], "worker": ["Worker"]}, "event_listener": ["EventListener"], "global": ["Global"], "jmx_exporter_config": ["JmxExporterConfig"], "log_config": {"coordinator": ["Coordinator"], "worker": ["Worker"]}}, "size_config": "starter", "status": "running", "status_code": 10, "tags": ["Tags"], "type": "presto", "version": "1.2.0", "worker": {"node_type": "starter", "quantity": 8}}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"api_key": "apikey", "connection_string": "https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id", "default_config": {"mapKey": "configuration"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-instance_id", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home": {"path": "spark/spark1234", "storage_name": "test-spark-storage", "volume": "test-spark-volume", "volume_id": "1704979825978585", "volume_name": "my-volume"}, "engine_sub_type": "java", "instance_id": "spark-id", "managed_by": "fully", "resource_limit_enabled": true, "resource_limits": {"cores": "1", "memory": "4G"}, "resource_utilisation": {"cores": "1m", "memory": "4Gi"}, "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}, "vscode_config": {"crn": "crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2", "environment_type": "SaaS", "host": "us-south.lakehouse.dev.cloud.ibm.com", "user_name": "user@example.com"}}, "created_at": 1, "created_by": "@.com", "description": "spark engine description", "display_name": "sampleEngine", "id": "spark123", "mode": "serverless", "origin": "external", "status": "provisioning", "tags": ["Tags"], "type": "spark"}`) })) }) - It(`Invoke UpdatePrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -14897,215 +15840,193 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdatePrestoEngine(nil) + result, response, operationErr := watsonxDataService.CreateSparkEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the EnginePropertiesCatalog model - enginePropertiesCatalogModel := new(watsonxdatav2.EnginePropertiesCatalog) - enginePropertiesCatalogModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesCatalogModel.Worker = map[string]string{"key1": "testString"} + // Construct an instance of the SparkEndpoints model + sparkEndpointsModel := new(watsonxdatav3.SparkEndpoints) + sparkEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id") + sparkEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") + sparkEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-instance_id") + sparkEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") + sparkEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") + sparkEndpointsModel.ViewHistoryServer = core.StringPtr("testString") + sparkEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") + sparkEndpointsModel.WxdEngineEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817") + sparkEndpointsModel.WxdHistoryServerEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server") + sparkEndpointsModel.WxdHistoryServerUiEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server/ui") + + // Construct an instance of the SparkEngineHome model + sparkEngineHomeModel := new(watsonxdatav3.SparkEngineHome) + sparkEngineHomeModel.Path = core.StringPtr("spark/spark1234") + sparkEngineHomeModel.StorageName = core.StringPtr("test-spark-storage") + sparkEngineHomeModel.Volume = core.StringPtr("test-spark-volume") + sparkEngineHomeModel.VolumeID = core.StringPtr("1704979825978585") + sparkEngineHomeModel.VolumeName = core.StringPtr("my-volume") - // Construct an instance of the PrestoEnginePropertiesCatalog model - prestoEnginePropertiesCatalogModel := new(watsonxdatav2.PrestoEnginePropertiesCatalog) - prestoEnginePropertiesCatalogModel.CatalogName = enginePropertiesCatalogModel + // Construct an instance of the SparkEngineResourceLimit model + sparkEngineResourceLimitModel := new(watsonxdatav3.SparkEngineResourceLimit) + sparkEngineResourceLimitModel.Cores = core.StringPtr("1") + sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") - // Construct an instance of the EnginePropertiesOaiGen1Configuration model - enginePropertiesOaiGen1ConfigurationModel := new(watsonxdatav2.EnginePropertiesOaiGen1Configuration) - enginePropertiesOaiGen1ConfigurationModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesOaiGen1ConfigurationModel.Worker = map[string]string{"key1": "testString"} + // Construct an instance of the SparkEngineResourceUtilisation model + sparkEngineResourceUtilisationModel := new(watsonxdatav3.SparkEngineResourceUtilisation) + sparkEngineResourceUtilisationModel.Cores = core.StringPtr("1m") + sparkEngineResourceUtilisationModel.Memory = core.StringPtr("4Gi") - // Construct an instance of the PrestoEnginePropertiesEventListener model - prestoEnginePropertiesEventListenerModel := new(watsonxdatav2.PrestoEnginePropertiesEventListener) - prestoEnginePropertiesEventListenerModel.EventListenerProperty = core.StringPtr("testString") + // Construct an instance of the SparkScaleConfig model + sparkScaleConfigModel := new(watsonxdatav3.SparkScaleConfig) + sparkScaleConfigModel.AutoScaleEnabled = core.BoolPtr(true) + sparkScaleConfigModel.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) + sparkScaleConfigModel.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) + sparkScaleConfigModel.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) + sparkScaleConfigModel.NodeType = core.StringPtr("medium") + sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(2)) + + // Construct an instance of the SparkVscodeConfig model + sparkVscodeConfigModel := new(watsonxdatav3.SparkVscodeConfig) + sparkVscodeConfigModel.Crn = core.StringPtr("crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2") + sparkVscodeConfigModel.EnvironmentType = core.StringPtr("SaaS") + sparkVscodeConfigModel.Host = core.StringPtr("us-south.lakehouse.dev.cloud.ibm.com") + sparkVscodeConfigModel.UserName = core.StringPtr("user@example.com") + + // Construct an instance of the SparkEngineDetails model + sparkEngineDetailsModel := new(watsonxdatav3.SparkEngineDetails) + sparkEngineDetailsModel.ApiKey = core.StringPtr("apikey") + sparkEngineDetailsModel.ConnectionString = core.StringPtr("https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id") + sparkEngineDetailsModel.DefaultConfig = map[string]string{"key1": "configuration"} + sparkEngineDetailsModel.DefaultVersion = core.StringPtr("4.8.3") + sparkEngineDetailsModel.Endpoints = sparkEndpointsModel + sparkEngineDetailsModel.EngineHome = sparkEngineHomeModel + sparkEngineDetailsModel.EngineSubType = core.StringPtr("java") + sparkEngineDetailsModel.InstanceID = core.StringPtr("spark-id") + sparkEngineDetailsModel.ManagedBy = core.StringPtr("fully") + sparkEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) + sparkEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel + sparkEngineDetailsModel.ResourceUtilisation = sparkEngineResourceUtilisationModel + sparkEngineDetailsModel.ScaleConfig = sparkScaleConfigModel + sparkEngineDetailsModel.VscodeConfig = sparkVscodeConfigModel - // Construct an instance of the PrestoEnginePropertiesGlobal model - prestoEnginePropertiesGlobalModel := new(watsonxdatav2.PrestoEnginePropertiesGlobal) - prestoEnginePropertiesGlobalModel.GlobalProperty = core.StringPtr("enable-mixed-case-support:true") - - // Construct an instance of the EnginePropertiesOaiGen1Jvm model - enginePropertiesOaiGen1JvmModel := new(watsonxdatav2.EnginePropertiesOaiGen1Jvm) - enginePropertiesOaiGen1JvmModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesOaiGen1JvmModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEnginePropertiesJMX model - prestoEnginePropertiesJmxModel := new(watsonxdatav2.PrestoEnginePropertiesJMX) - prestoEnginePropertiesJmxModel.GlobalProperty = core.StringPtr("watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes") - - // Construct an instance of the EnginePropertiesLogConfiguration model - enginePropertiesLogConfigurationModel := new(watsonxdatav2.EnginePropertiesLogConfiguration) - enginePropertiesLogConfigurationModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesLogConfigurationModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEngineEngineProperties model - prestoEngineEnginePropertiesModel := new(watsonxdatav2.PrestoEngineEngineProperties) - prestoEngineEnginePropertiesModel.Catalog = prestoEnginePropertiesCatalogModel - prestoEngineEnginePropertiesModel.Configuration = enginePropertiesOaiGen1ConfigurationModel - prestoEngineEnginePropertiesModel.EventListener = prestoEnginePropertiesEventListenerModel - prestoEngineEnginePropertiesModel.Global = prestoEnginePropertiesGlobalModel - prestoEngineEnginePropertiesModel.Jvm = enginePropertiesOaiGen1JvmModel - prestoEngineEnginePropertiesModel.JmxExporterConfig = prestoEnginePropertiesJmxModel - prestoEngineEnginePropertiesModel.LogConfig = enginePropertiesLogConfigurationModel - - // Construct an instance of the RemoveEnginePropertiesOaiGenConfiguration model - removeEnginePropertiesOaiGenConfigurationModel := new(watsonxdatav2.RemoveEnginePropertiesOaiGenConfiguration) - removeEnginePropertiesOaiGenConfigurationModel.Coordinator = []string{"testString"} - removeEnginePropertiesOaiGenConfigurationModel.Worker = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesOaiGenJvm model - removeEnginePropertiesOaiGenJvmModel := new(watsonxdatav2.RemoveEnginePropertiesOaiGenJvm) - removeEnginePropertiesOaiGenJvmModel.Coordinator = []string{"testString"} - removeEnginePropertiesOaiGenJvmModel.Worker = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesLogConfig model - removeEnginePropertiesLogConfigModel := new(watsonxdatav2.RemoveEnginePropertiesLogConfig) - removeEnginePropertiesLogConfigModel.Coordinator = []string{"testString"} - removeEnginePropertiesLogConfigModel.Worker = []string{"testString"} - - // Construct an instance of the PrestoEnginePatchRemoveEngineProperties model - prestoEnginePatchRemoveEnginePropertiesModel := new(watsonxdatav2.PrestoEnginePatchRemoveEngineProperties) - prestoEnginePatchRemoveEnginePropertiesModel.Catalog = prestoEnginePropertiesCatalogModel - prestoEnginePatchRemoveEnginePropertiesModel.Configuration = removeEnginePropertiesOaiGenConfigurationModel - prestoEnginePatchRemoveEnginePropertiesModel.Jvm = removeEnginePropertiesOaiGenJvmModel - prestoEnginePatchRemoveEnginePropertiesModel.EventListener = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.Global = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.JmxExporterConfig = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.LogConfig = removeEnginePropertiesLogConfigModel - - // Construct an instance of the PrestoEnginePatch model - prestoEnginePatchModel := new(watsonxdatav2.PrestoEnginePatch) - prestoEnginePatchModel.Description = core.StringPtr("updated description for presto engine") - prestoEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - prestoEnginePatchModel.EngineProperties = prestoEngineEnginePropertiesModel - prestoEnginePatchModel.EngineRestart = core.StringPtr("force") - prestoEnginePatchModel.RemoveEngineProperties = prestoEnginePatchRemoveEnginePropertiesModel - prestoEnginePatchModel.Tags = []string{"tag1", "tag2"} - prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdatePrestoEngineOptions model - updatePrestoEngineOptionsModel := new(watsonxdatav2.UpdatePrestoEngineOptions) - updatePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - updatePrestoEngineOptionsModel.Body = prestoEnginePatchModelAsPatch - updatePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updatePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSparkEngineOptions model + createSparkEngineOptionsModel := new(watsonxdatav3.CreateSparkEngineOptions) + createSparkEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createSparkEngineOptionsModel.Origin = core.StringPtr("external") + createSparkEngineOptionsModel.AssociatedCatalogs = []string{"iceberg_data", "hive_data"} + createSparkEngineOptionsModel.Configuration = sparkEngineDetailsModel + createSparkEngineOptionsModel.Description = core.StringPtr("spark engine description") + createSparkEngineOptionsModel.ID = core.StringPtr("spark123") + createSparkEngineOptionsModel.Status = core.StringPtr("provisioning") + createSparkEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createSparkEngineOptionsModel.Type = core.StringPtr("spark") + createSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdatePrestoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the EnginePropertiesCatalog model - enginePropertiesCatalogModel := new(watsonxdatav2.EnginePropertiesCatalog) - enginePropertiesCatalogModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesCatalogModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEnginePropertiesCatalog model - prestoEnginePropertiesCatalogModel := new(watsonxdatav2.PrestoEnginePropertiesCatalog) - prestoEnginePropertiesCatalogModel.CatalogName = enginePropertiesCatalogModel + // Construct an instance of the SparkEndpoints model + sparkEndpointsModel := new(watsonxdatav3.SparkEndpoints) + sparkEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id") + sparkEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") + sparkEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-instance_id") + sparkEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") + sparkEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") + sparkEndpointsModel.ViewHistoryServer = core.StringPtr("testString") + sparkEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") + sparkEndpointsModel.WxdEngineEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817") + sparkEndpointsModel.WxdHistoryServerEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server") + sparkEndpointsModel.WxdHistoryServerUiEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server/ui") - // Construct an instance of the EnginePropertiesOaiGen1Configuration model - enginePropertiesOaiGen1ConfigurationModel := new(watsonxdatav2.EnginePropertiesOaiGen1Configuration) - enginePropertiesOaiGen1ConfigurationModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesOaiGen1ConfigurationModel.Worker = map[string]string{"key1": "testString"} + // Construct an instance of the SparkEngineHome model + sparkEngineHomeModel := new(watsonxdatav3.SparkEngineHome) + sparkEngineHomeModel.Path = core.StringPtr("spark/spark1234") + sparkEngineHomeModel.StorageName = core.StringPtr("test-spark-storage") + sparkEngineHomeModel.Volume = core.StringPtr("test-spark-volume") + sparkEngineHomeModel.VolumeID = core.StringPtr("1704979825978585") + sparkEngineHomeModel.VolumeName = core.StringPtr("my-volume") - // Construct an instance of the PrestoEnginePropertiesEventListener model - prestoEnginePropertiesEventListenerModel := new(watsonxdatav2.PrestoEnginePropertiesEventListener) - prestoEnginePropertiesEventListenerModel.EventListenerProperty = core.StringPtr("testString") - - // Construct an instance of the PrestoEnginePropertiesGlobal model - prestoEnginePropertiesGlobalModel := new(watsonxdatav2.PrestoEnginePropertiesGlobal) - prestoEnginePropertiesGlobalModel.GlobalProperty = core.StringPtr("enable-mixed-case-support:true") - - // Construct an instance of the EnginePropertiesOaiGen1Jvm model - enginePropertiesOaiGen1JvmModel := new(watsonxdatav2.EnginePropertiesOaiGen1Jvm) - enginePropertiesOaiGen1JvmModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesOaiGen1JvmModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEnginePropertiesJMX model - prestoEnginePropertiesJmxModel := new(watsonxdatav2.PrestoEnginePropertiesJMX) - prestoEnginePropertiesJmxModel.GlobalProperty = core.StringPtr("watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes") - - // Construct an instance of the EnginePropertiesLogConfiguration model - enginePropertiesLogConfigurationModel := new(watsonxdatav2.EnginePropertiesLogConfiguration) - enginePropertiesLogConfigurationModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesLogConfigurationModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEngineEngineProperties model - prestoEngineEnginePropertiesModel := new(watsonxdatav2.PrestoEngineEngineProperties) - prestoEngineEnginePropertiesModel.Catalog = prestoEnginePropertiesCatalogModel - prestoEngineEnginePropertiesModel.Configuration = enginePropertiesOaiGen1ConfigurationModel - prestoEngineEnginePropertiesModel.EventListener = prestoEnginePropertiesEventListenerModel - prestoEngineEnginePropertiesModel.Global = prestoEnginePropertiesGlobalModel - prestoEngineEnginePropertiesModel.Jvm = enginePropertiesOaiGen1JvmModel - prestoEngineEnginePropertiesModel.JmxExporterConfig = prestoEnginePropertiesJmxModel - prestoEngineEnginePropertiesModel.LogConfig = enginePropertiesLogConfigurationModel - - // Construct an instance of the RemoveEnginePropertiesOaiGenConfiguration model - removeEnginePropertiesOaiGenConfigurationModel := new(watsonxdatav2.RemoveEnginePropertiesOaiGenConfiguration) - removeEnginePropertiesOaiGenConfigurationModel.Coordinator = []string{"testString"} - removeEnginePropertiesOaiGenConfigurationModel.Worker = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesOaiGenJvm model - removeEnginePropertiesOaiGenJvmModel := new(watsonxdatav2.RemoveEnginePropertiesOaiGenJvm) - removeEnginePropertiesOaiGenJvmModel.Coordinator = []string{"testString"} - removeEnginePropertiesOaiGenJvmModel.Worker = []string{"testString"} + // Construct an instance of the SparkEngineResourceLimit model + sparkEngineResourceLimitModel := new(watsonxdatav3.SparkEngineResourceLimit) + sparkEngineResourceLimitModel.Cores = core.StringPtr("1") + sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") - // Construct an instance of the RemoveEnginePropertiesLogConfig model - removeEnginePropertiesLogConfigModel := new(watsonxdatav2.RemoveEnginePropertiesLogConfig) - removeEnginePropertiesLogConfigModel.Coordinator = []string{"testString"} - removeEnginePropertiesLogConfigModel.Worker = []string{"testString"} - - // Construct an instance of the PrestoEnginePatchRemoveEngineProperties model - prestoEnginePatchRemoveEnginePropertiesModel := new(watsonxdatav2.PrestoEnginePatchRemoveEngineProperties) - prestoEnginePatchRemoveEnginePropertiesModel.Catalog = prestoEnginePropertiesCatalogModel - prestoEnginePatchRemoveEnginePropertiesModel.Configuration = removeEnginePropertiesOaiGenConfigurationModel - prestoEnginePatchRemoveEnginePropertiesModel.Jvm = removeEnginePropertiesOaiGenJvmModel - prestoEnginePatchRemoveEnginePropertiesModel.EventListener = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.Global = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.JmxExporterConfig = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.LogConfig = removeEnginePropertiesLogConfigModel + // Construct an instance of the SparkEngineResourceUtilisation model + sparkEngineResourceUtilisationModel := new(watsonxdatav3.SparkEngineResourceUtilisation) + sparkEngineResourceUtilisationModel.Cores = core.StringPtr("1m") + sparkEngineResourceUtilisationModel.Memory = core.StringPtr("4Gi") - // Construct an instance of the PrestoEnginePatch model - prestoEnginePatchModel := new(watsonxdatav2.PrestoEnginePatch) - prestoEnginePatchModel.Description = core.StringPtr("updated description for presto engine") - prestoEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - prestoEnginePatchModel.EngineProperties = prestoEngineEnginePropertiesModel - prestoEnginePatchModel.EngineRestart = core.StringPtr("force") - prestoEnginePatchModel.RemoveEngineProperties = prestoEnginePatchRemoveEnginePropertiesModel - prestoEnginePatchModel.Tags = []string{"tag1", "tag2"} - prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the SparkScaleConfig model + sparkScaleConfigModel := new(watsonxdatav3.SparkScaleConfig) + sparkScaleConfigModel.AutoScaleEnabled = core.BoolPtr(true) + sparkScaleConfigModel.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) + sparkScaleConfigModel.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) + sparkScaleConfigModel.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) + sparkScaleConfigModel.NodeType = core.StringPtr("medium") + sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(2)) + + // Construct an instance of the SparkVscodeConfig model + sparkVscodeConfigModel := new(watsonxdatav3.SparkVscodeConfig) + sparkVscodeConfigModel.Crn = core.StringPtr("crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2") + sparkVscodeConfigModel.EnvironmentType = core.StringPtr("SaaS") + sparkVscodeConfigModel.Host = core.StringPtr("us-south.lakehouse.dev.cloud.ibm.com") + sparkVscodeConfigModel.UserName = core.StringPtr("user@example.com") + + // Construct an instance of the SparkEngineDetails model + sparkEngineDetailsModel := new(watsonxdatav3.SparkEngineDetails) + sparkEngineDetailsModel.ApiKey = core.StringPtr("apikey") + sparkEngineDetailsModel.ConnectionString = core.StringPtr("https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id") + sparkEngineDetailsModel.DefaultConfig = map[string]string{"key1": "configuration"} + sparkEngineDetailsModel.DefaultVersion = core.StringPtr("4.8.3") + sparkEngineDetailsModel.Endpoints = sparkEndpointsModel + sparkEngineDetailsModel.EngineHome = sparkEngineHomeModel + sparkEngineDetailsModel.EngineSubType = core.StringPtr("java") + sparkEngineDetailsModel.InstanceID = core.StringPtr("spark-id") + sparkEngineDetailsModel.ManagedBy = core.StringPtr("fully") + sparkEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) + sparkEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel + sparkEngineDetailsModel.ResourceUtilisation = sparkEngineResourceUtilisationModel + sparkEngineDetailsModel.ScaleConfig = sparkScaleConfigModel + sparkEngineDetailsModel.VscodeConfig = sparkVscodeConfigModel - // Construct an instance of the UpdatePrestoEngineOptions model - updatePrestoEngineOptionsModel := new(watsonxdatav2.UpdatePrestoEngineOptions) - updatePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - updatePrestoEngineOptionsModel.Body = prestoEnginePatchModelAsPatch - updatePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updatePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSparkEngineOptions model + createSparkEngineOptionsModel := new(watsonxdatav3.CreateSparkEngineOptions) + createSparkEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createSparkEngineOptionsModel.Origin = core.StringPtr("external") + createSparkEngineOptionsModel.AssociatedCatalogs = []string{"iceberg_data", "hive_data"} + createSparkEngineOptionsModel.Configuration = sparkEngineDetailsModel + createSparkEngineOptionsModel.Description = core.StringPtr("spark engine description") + createSparkEngineOptionsModel.ID = core.StringPtr("spark123") + createSparkEngineOptionsModel.Status = core.StringPtr("provisioning") + createSparkEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createSparkEngineOptionsModel.Type = core.StringPtr("spark") + createSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdatePrestoEngineOptions model with no property values - updatePrestoEngineOptionsModelNew := new(watsonxdatav2.UpdatePrestoEngineOptions) + // Construct a second instance of the CreateSparkEngineOptions model with no property values + createSparkEngineOptionsModelNew := new(watsonxdatav3.CreateSparkEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -15120,108 +16041,97 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke UpdatePrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the EnginePropertiesCatalog model - enginePropertiesCatalogModel := new(watsonxdatav2.EnginePropertiesCatalog) - enginePropertiesCatalogModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesCatalogModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEnginePropertiesCatalog model - prestoEnginePropertiesCatalogModel := new(watsonxdatav2.PrestoEnginePropertiesCatalog) - prestoEnginePropertiesCatalogModel.CatalogName = enginePropertiesCatalogModel + // Construct an instance of the SparkEndpoints model + sparkEndpointsModel := new(watsonxdatav3.SparkEndpoints) + sparkEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id") + sparkEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") + sparkEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-instance_id") + sparkEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") + sparkEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") + sparkEndpointsModel.ViewHistoryServer = core.StringPtr("testString") + sparkEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") + sparkEndpointsModel.WxdEngineEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817") + sparkEndpointsModel.WxdHistoryServerEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server") + sparkEndpointsModel.WxdHistoryServerUiEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server/ui") - // Construct an instance of the EnginePropertiesOaiGen1Configuration model - enginePropertiesOaiGen1ConfigurationModel := new(watsonxdatav2.EnginePropertiesOaiGen1Configuration) - enginePropertiesOaiGen1ConfigurationModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesOaiGen1ConfigurationModel.Worker = map[string]string{"key1": "testString"} + // Construct an instance of the SparkEngineHome model + sparkEngineHomeModel := new(watsonxdatav3.SparkEngineHome) + sparkEngineHomeModel.Path = core.StringPtr("spark/spark1234") + sparkEngineHomeModel.StorageName = core.StringPtr("test-spark-storage") + sparkEngineHomeModel.Volume = core.StringPtr("test-spark-volume") + sparkEngineHomeModel.VolumeID = core.StringPtr("1704979825978585") + sparkEngineHomeModel.VolumeName = core.StringPtr("my-volume") - // Construct an instance of the PrestoEnginePropertiesEventListener model - prestoEnginePropertiesEventListenerModel := new(watsonxdatav2.PrestoEnginePropertiesEventListener) - prestoEnginePropertiesEventListenerModel.EventListenerProperty = core.StringPtr("testString") - - // Construct an instance of the PrestoEnginePropertiesGlobal model - prestoEnginePropertiesGlobalModel := new(watsonxdatav2.PrestoEnginePropertiesGlobal) - prestoEnginePropertiesGlobalModel.GlobalProperty = core.StringPtr("enable-mixed-case-support:true") - - // Construct an instance of the EnginePropertiesOaiGen1Jvm model - enginePropertiesOaiGen1JvmModel := new(watsonxdatav2.EnginePropertiesOaiGen1Jvm) - enginePropertiesOaiGen1JvmModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesOaiGen1JvmModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEnginePropertiesJMX model - prestoEnginePropertiesJmxModel := new(watsonxdatav2.PrestoEnginePropertiesJMX) - prestoEnginePropertiesJmxModel.GlobalProperty = core.StringPtr("watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes") - - // Construct an instance of the EnginePropertiesLogConfiguration model - enginePropertiesLogConfigurationModel := new(watsonxdatav2.EnginePropertiesLogConfiguration) - enginePropertiesLogConfigurationModel.Coordinator = map[string]string{"key1": "testString"} - enginePropertiesLogConfigurationModel.Worker = map[string]string{"key1": "testString"} - - // Construct an instance of the PrestoEngineEngineProperties model - prestoEngineEnginePropertiesModel := new(watsonxdatav2.PrestoEngineEngineProperties) - prestoEngineEnginePropertiesModel.Catalog = prestoEnginePropertiesCatalogModel - prestoEngineEnginePropertiesModel.Configuration = enginePropertiesOaiGen1ConfigurationModel - prestoEngineEnginePropertiesModel.EventListener = prestoEnginePropertiesEventListenerModel - prestoEngineEnginePropertiesModel.Global = prestoEnginePropertiesGlobalModel - prestoEngineEnginePropertiesModel.Jvm = enginePropertiesOaiGen1JvmModel - prestoEngineEnginePropertiesModel.JmxExporterConfig = prestoEnginePropertiesJmxModel - prestoEngineEnginePropertiesModel.LogConfig = enginePropertiesLogConfigurationModel - - // Construct an instance of the RemoveEnginePropertiesOaiGenConfiguration model - removeEnginePropertiesOaiGenConfigurationModel := new(watsonxdatav2.RemoveEnginePropertiesOaiGenConfiguration) - removeEnginePropertiesOaiGenConfigurationModel.Coordinator = []string{"testString"} - removeEnginePropertiesOaiGenConfigurationModel.Worker = []string{"testString"} - - // Construct an instance of the RemoveEnginePropertiesOaiGenJvm model - removeEnginePropertiesOaiGenJvmModel := new(watsonxdatav2.RemoveEnginePropertiesOaiGenJvm) - removeEnginePropertiesOaiGenJvmModel.Coordinator = []string{"testString"} - removeEnginePropertiesOaiGenJvmModel.Worker = []string{"testString"} + // Construct an instance of the SparkEngineResourceLimit model + sparkEngineResourceLimitModel := new(watsonxdatav3.SparkEngineResourceLimit) + sparkEngineResourceLimitModel.Cores = core.StringPtr("1") + sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") - // Construct an instance of the RemoveEnginePropertiesLogConfig model - removeEnginePropertiesLogConfigModel := new(watsonxdatav2.RemoveEnginePropertiesLogConfig) - removeEnginePropertiesLogConfigModel.Coordinator = []string{"testString"} - removeEnginePropertiesLogConfigModel.Worker = []string{"testString"} - - // Construct an instance of the PrestoEnginePatchRemoveEngineProperties model - prestoEnginePatchRemoveEnginePropertiesModel := new(watsonxdatav2.PrestoEnginePatchRemoveEngineProperties) - prestoEnginePatchRemoveEnginePropertiesModel.Catalog = prestoEnginePropertiesCatalogModel - prestoEnginePatchRemoveEnginePropertiesModel.Configuration = removeEnginePropertiesOaiGenConfigurationModel - prestoEnginePatchRemoveEnginePropertiesModel.Jvm = removeEnginePropertiesOaiGenJvmModel - prestoEnginePatchRemoveEnginePropertiesModel.EventListener = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.Global = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.JmxExporterConfig = []string{"testString"} - prestoEnginePatchRemoveEnginePropertiesModel.LogConfig = removeEnginePropertiesLogConfigModel + // Construct an instance of the SparkEngineResourceUtilisation model + sparkEngineResourceUtilisationModel := new(watsonxdatav3.SparkEngineResourceUtilisation) + sparkEngineResourceUtilisationModel.Cores = core.StringPtr("1m") + sparkEngineResourceUtilisationModel.Memory = core.StringPtr("4Gi") - // Construct an instance of the PrestoEnginePatch model - prestoEnginePatchModel := new(watsonxdatav2.PrestoEnginePatch) - prestoEnginePatchModel.Description = core.StringPtr("updated description for presto engine") - prestoEnginePatchModel.EngineDisplayName = core.StringPtr("sampleEngine") - prestoEnginePatchModel.EngineProperties = prestoEngineEnginePropertiesModel - prestoEnginePatchModel.EngineRestart = core.StringPtr("force") - prestoEnginePatchModel.RemoveEngineProperties = prestoEnginePatchRemoveEnginePropertiesModel - prestoEnginePatchModel.Tags = []string{"tag1", "tag2"} - prestoEnginePatchModelAsPatch, asPatchErr := prestoEnginePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the SparkScaleConfig model + sparkScaleConfigModel := new(watsonxdatav3.SparkScaleConfig) + sparkScaleConfigModel.AutoScaleEnabled = core.BoolPtr(true) + sparkScaleConfigModel.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) + sparkScaleConfigModel.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) + sparkScaleConfigModel.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) + sparkScaleConfigModel.NodeType = core.StringPtr("medium") + sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(2)) + + // Construct an instance of the SparkVscodeConfig model + sparkVscodeConfigModel := new(watsonxdatav3.SparkVscodeConfig) + sparkVscodeConfigModel.Crn = core.StringPtr("crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2") + sparkVscodeConfigModel.EnvironmentType = core.StringPtr("SaaS") + sparkVscodeConfigModel.Host = core.StringPtr("us-south.lakehouse.dev.cloud.ibm.com") + sparkVscodeConfigModel.UserName = core.StringPtr("user@example.com") + + // Construct an instance of the SparkEngineDetails model + sparkEngineDetailsModel := new(watsonxdatav3.SparkEngineDetails) + sparkEngineDetailsModel.ApiKey = core.StringPtr("apikey") + sparkEngineDetailsModel.ConnectionString = core.StringPtr("https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id") + sparkEngineDetailsModel.DefaultConfig = map[string]string{"key1": "configuration"} + sparkEngineDetailsModel.DefaultVersion = core.StringPtr("4.8.3") + sparkEngineDetailsModel.Endpoints = sparkEndpointsModel + sparkEngineDetailsModel.EngineHome = sparkEngineHomeModel + sparkEngineDetailsModel.EngineSubType = core.StringPtr("java") + sparkEngineDetailsModel.InstanceID = core.StringPtr("spark-id") + sparkEngineDetailsModel.ManagedBy = core.StringPtr("fully") + sparkEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) + sparkEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel + sparkEngineDetailsModel.ResourceUtilisation = sparkEngineResourceUtilisationModel + sparkEngineDetailsModel.ScaleConfig = sparkScaleConfigModel + sparkEngineDetailsModel.VscodeConfig = sparkVscodeConfigModel - // Construct an instance of the UpdatePrestoEngineOptions model - updatePrestoEngineOptionsModel := new(watsonxdatav2.UpdatePrestoEngineOptions) - updatePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - updatePrestoEngineOptionsModel.Body = prestoEnginePatchModelAsPatch - updatePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updatePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSparkEngineOptions model + createSparkEngineOptionsModel := new(watsonxdatav3.CreateSparkEngineOptions) + createSparkEngineOptionsModel.DisplayName = core.StringPtr("sampleEngine") + createSparkEngineOptionsModel.Origin = core.StringPtr("external") + createSparkEngineOptionsModel.AssociatedCatalogs = []string{"iceberg_data", "hive_data"} + createSparkEngineOptionsModel.Configuration = sparkEngineDetailsModel + createSparkEngineOptionsModel.Description = core.StringPtr("spark engine description") + createSparkEngineOptionsModel.ID = core.StringPtr("spark123") + createSparkEngineOptionsModel.Status = core.StringPtr("provisioning") + createSparkEngineOptionsModel.Tags = []string{"tag1", "tag2"} + createSparkEngineOptionsModel.Type = core.StringPtr("spark") + createSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdatePrestoEngine(updatePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -15233,15 +16143,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptions *ListPrestoEngineCatalogsOptions) - Operation response error`, func() { - listPrestoEngineCatalogsPath := "/presto_engines/testString/catalogs" + Describe(`GetSparkEngineCatalog(getSparkEngineCatalogOptions *GetSparkEngineCatalogOptions) - Operation response error`, func() { + getSparkEngineCatalogPath := "/v3/spark_engines/testString/catalogs/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestoEngineCatalogsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineCatalogPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -15250,28 +16160,29 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListPrestoEngineCatalogs with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineCatalog with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestoEngineCatalogsOptions model - listPrestoEngineCatalogsOptionsModel := new(watsonxdatav2.ListPrestoEngineCatalogsOptions) - listPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineCatalogOptions model + getSparkEngineCatalogOptionsModel := new(watsonxdatav3.GetSparkEngineCatalogOptions) + getSparkEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -15281,15 +16192,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptions *ListPrestoEngineCatalogsOptions)`, func() { - listPrestoEngineCatalogsPath := "/presto_engines/testString/catalogs" + Describe(`GetSparkEngineCatalog(getSparkEngineCatalogOptions *GetSparkEngineCatalogOptions)`, func() { + getSparkEngineCatalogPath := "/v3/spark_engines/testString/catalogs/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestoEngineCatalogsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineCatalogPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -15300,11 +16211,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}`) })) }) - It(`Invoke ListPrestoEngineCatalogs successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineCatalog successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -15312,22 +16223,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListPrestoEngineCatalogsOptions model - listPrestoEngineCatalogsOptionsModel := new(watsonxdatav2.ListPrestoEngineCatalogsOptions) - listPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineCatalogOptions model + getSparkEngineCatalogOptionsModel := new(watsonxdatav3.GetSparkEngineCatalogOptions) + getSparkEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListPrestoEngineCatalogsWithContext(ctx, listPrestoEngineCatalogsOptionsModel) + _, _, operationErr := watsonxDataService.GetSparkEngineCatalogWithContext(ctx, getSparkEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -15335,7 +16247,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListPrestoEngineCatalogsWithContext(ctx, listPrestoEngineCatalogsOptionsModel) + _, _, operationErr = watsonxDataService.GetSparkEngineCatalogWithContext(ctx, getSparkEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -15349,7 +16261,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listPrestoEngineCatalogsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineCatalogPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -15357,11 +16269,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}]}`) + fmt.Fprintf(res, "%s", `{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}`) })) }) - It(`Invoke ListPrestoEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -15369,49 +16281,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListPrestoEngineCatalogs(nil) + result, response, operationErr := watsonxDataService.GetSparkEngineCatalog(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListPrestoEngineCatalogsOptions model - listPrestoEngineCatalogsOptionsModel := new(watsonxdatav2.ListPrestoEngineCatalogsOptions) - listPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineCatalogOptions model + getSparkEngineCatalogOptionsModel := new(watsonxdatav3.GetSparkEngineCatalogOptions) + getSparkEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListPrestoEngineCatalogs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineCatalog with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestoEngineCatalogsOptions model - listPrestoEngineCatalogsOptionsModel := new(watsonxdatav2.ListPrestoEngineCatalogsOptions) - listPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineCatalogOptions model + getSparkEngineCatalogOptionsModel := new(watsonxdatav3.GetSparkEngineCatalogOptions) + getSparkEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListPrestoEngineCatalogsOptions model with no property values - listPrestoEngineCatalogsOptionsModelNew := new(watsonxdatav2.ListPrestoEngineCatalogsOptions) + // Construct a second instance of the GetSparkEngineCatalogOptions model with no property values + getSparkEngineCatalogOptionsModelNew := new(watsonxdatav3.GetSparkEngineCatalogOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModelNew) + result, response, operationErr = watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -15429,22 +16343,23 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListPrestoEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListPrestoEngineCatalogsOptions model - listPrestoEngineCatalogsOptionsModel := new(watsonxdatav2.ListPrestoEngineCatalogsOptions) - listPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineCatalogOptions model + getSparkEngineCatalogOptionsModel := new(watsonxdatav3.GetSparkEngineCatalogOptions) + getSparkEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.ID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListPrestoEngineCatalogs(listPrestoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -15456,46 +16371,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptions *CreatePrestoEngineCatalogsOptions) - Operation response error`, func() { - createPrestoEngineCatalogsPath := "/presto_engines/testString/catalogs" + Describe(`GetSparkEngine(getSparkEngineOptions *GetSparkEngineOptions) - Operation response error`, func() { + getSparkEnginePath := "/v3/spark_engines/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestoEngineCatalogsPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEnginePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreatePrestoEngineCatalogs with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreatePrestoEngineCatalogsOptions model - createPrestoEngineCatalogsOptionsModel := new(watsonxdatav2.CreatePrestoEngineCatalogsOptions) - createPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineOptions model + getSparkEngineOptionsModel := new(watsonxdatav3.GetSparkEngineOptions) + getSparkEngineOptionsModel.ID = core.StringPtr("testString") + getSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -15505,32 +16419,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptions *CreatePrestoEngineCatalogsOptions)`, func() { - createPrestoEngineCatalogsPath := "/presto_engines/testString/catalogs" + Describe(`GetSparkEngine(getSparkEngineOptions *GetSparkEngineOptions)`, func() { + getSparkEnginePath := "/v3/spark_engines/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestoEngineCatalogsPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEnginePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -15539,12 +16437,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"api_key": "apikey", "connection_string": "https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id", "default_config": {"mapKey": "configuration"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-instance_id", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home": {"path": "spark/spark1234", "storage_name": "test-spark-storage", "volume": "test-spark-volume", "volume_id": "1704979825978585", "volume_name": "my-volume"}, "engine_sub_type": "java", "instance_id": "spark-id", "managed_by": "fully", "resource_limit_enabled": true, "resource_limits": {"cores": "1", "memory": "4G"}, "resource_utilisation": {"cores": "1m", "memory": "4Gi"}, "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}, "vscode_config": {"crn": "crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2", "environment_type": "SaaS", "host": "us-south.lakehouse.dev.cloud.ibm.com", "user_name": "user@example.com"}}, "created_at": 1, "created_by": "@.com", "description": "spark engine description", "display_name": "sampleEngine", "id": "spark123", "mode": "serverless", "origin": "external", "status": "provisioning", "tags": ["Tags"], "type": "spark"}`) })) }) - It(`Invoke CreatePrestoEngineCatalogs successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -15552,23 +16450,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreatePrestoEngineCatalogsOptions model - createPrestoEngineCatalogsOptionsModel := new(watsonxdatav2.CreatePrestoEngineCatalogsOptions) - createPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineOptions model + getSparkEngineOptionsModel := new(watsonxdatav3.GetSparkEngineOptions) + getSparkEngineOptionsModel.ID = core.StringPtr("testString") + getSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreatePrestoEngineCatalogsWithContext(ctx, createPrestoEngineCatalogsOptionsModel) + _, _, operationErr := watsonxDataService.GetSparkEngineWithContext(ctx, getSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -15576,7 +16473,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreatePrestoEngineCatalogsWithContext(ctx, createPrestoEngineCatalogsOptionsModel) + _, _, operationErr = watsonxDataService.GetSparkEngineWithContext(ctx, getSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -15590,87 +16487,69 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPrestoEngineCatalogsPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEnginePath)) + Expect(req.Method).To(Equal("GET")) - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) - })) - }) - It(`Invoke CreatePrestoEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"api_key": "apikey", "connection_string": "https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id", "default_config": {"mapKey": "configuration"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-instance_id", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home": {"path": "spark/spark1234", "storage_name": "test-spark-storage", "volume": "test-spark-volume", "volume_id": "1704979825978585", "volume_name": "my-volume"}, "engine_sub_type": "java", "instance_id": "spark-id", "managed_by": "fully", "resource_limit_enabled": true, "resource_limits": {"cores": "1", "memory": "4G"}, "resource_utilisation": {"cores": "1m", "memory": "4Gi"}, "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}, "vscode_config": {"crn": "crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2", "environment_type": "SaaS", "host": "us-south.lakehouse.dev.cloud.ibm.com", "user_name": "user@example.com"}}, "created_at": 1, "created_by": "@.com", "description": "spark engine description", "display_name": "sampleEngine", "id": "spark123", "mode": "serverless", "origin": "external", "status": "provisioning", "tags": ["Tags"], "type": "spark"}`) + })) + }) + It(`Invoke GetSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreatePrestoEngineCatalogs(nil) + result, response, operationErr := watsonxDataService.GetSparkEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreatePrestoEngineCatalogsOptions model - createPrestoEngineCatalogsOptionsModel := new(watsonxdatav2.CreatePrestoEngineCatalogsOptions) - createPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineOptions model + getSparkEngineOptionsModel := new(watsonxdatav3.GetSparkEngineOptions) + getSparkEngineOptionsModel.ID = core.StringPtr("testString") + getSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreatePrestoEngineCatalogs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreatePrestoEngineCatalogsOptions model - createPrestoEngineCatalogsOptionsModel := new(watsonxdatav2.CreatePrestoEngineCatalogsOptions) - createPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineOptions model + getSparkEngineOptionsModel := new(watsonxdatav3.GetSparkEngineOptions) + getSparkEngineOptionsModel.ID = core.StringPtr("testString") + getSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreatePrestoEngineCatalogsOptions model with no property values - createPrestoEngineCatalogsOptionsModelNew := new(watsonxdatav2.CreatePrestoEngineCatalogsOptions) + // Construct a second instance of the GetSparkEngineOptions model with no property values + getSparkEngineOptionsModelNew := new(watsonxdatav3.GetSparkEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModelNew) + result, response, operationErr = watsonxDataService.GetSparkEngine(getSparkEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -15685,26 +16564,25 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreatePrestoEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreatePrestoEngineCatalogsOptions model - createPrestoEngineCatalogsOptionsModel := new(watsonxdatav2.CreatePrestoEngineCatalogsOptions) - createPrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineOptions model + getSparkEngineOptionsModel := new(watsonxdatav3.GetSparkEngineOptions) + getSparkEngineOptionsModel.ID = core.StringPtr("testString") + getSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreatePrestoEngineCatalogs(createPrestoEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -15716,25 +16594,24 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptions *DeletePrestoEngineCatalogsOptions)`, func() { - deletePrestoEngineCatalogsPath := "/presto_engines/testString/catalogs" + Describe(`DeleteSparkEngine(deleteSparkEngineOptions *DeleteSparkEngineOptions)`, func() { + deleteSparkEnginePath := "/v3/spark_engines/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deletePrestoEngineCatalogsPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteSparkEnginePath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_names"]).To(Equal([]string{"testString"})) res.WriteHeader(204) })) }) - It(`Invoke DeletePrestoEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -15742,47 +16619,45 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeletePrestoEngineCatalogs(nil) + response, operationErr := watsonxDataService.DeleteSparkEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeletePrestoEngineCatalogsOptions model - deletePrestoEngineCatalogsOptionsModel := new(watsonxdatav2.DeletePrestoEngineCatalogsOptions) - deletePrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - deletePrestoEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") - deletePrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - deletePrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSparkEngineOptions model + deleteSparkEngineOptionsModel := new(watsonxdatav3.DeleteSparkEngineOptions) + deleteSparkEngineOptionsModel.ID = core.StringPtr("testString") + deleteSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptionsModel) + response, operationErr = watsonxDataService.DeleteSparkEngine(deleteSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeletePrestoEngineCatalogs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSparkEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DeletePrestoEngineCatalogsOptions model - deletePrestoEngineCatalogsOptionsModel := new(watsonxdatav2.DeletePrestoEngineCatalogsOptions) - deletePrestoEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - deletePrestoEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") - deletePrestoEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - deletePrestoEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSparkEngineOptions model + deleteSparkEngineOptionsModel := new(watsonxdatav3.DeleteSparkEngineOptions) + deleteSparkEngineOptionsModel.ID = core.StringPtr("testString") + deleteSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptionsModel) + response, operationErr := watsonxDataService.DeleteSparkEngine(deleteSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeletePrestoEngineCatalogsOptions model with no property values - deletePrestoEngineCatalogsOptionsModelNew := new(watsonxdatav2.DeletePrestoEngineCatalogsOptions) + // Construct a second instance of the DeleteSparkEngineOptions model with no property values + deleteSparkEngineOptionsModelNew := new(watsonxdatav3.DeleteSparkEngineOptions) // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeletePrestoEngineCatalogs(deletePrestoEngineCatalogsOptionsModelNew) + response, operationErr = watsonxDataService.DeleteSparkEngine(deleteSparkEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -15791,16 +16666,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetPrestoEngineCatalog(getPrestoEngineCatalogOptions *GetPrestoEngineCatalogOptions) - Operation response error`, func() { - getPrestoEngineCatalogPath := "/presto_engines/testString/catalogs/testString" + Describe(`UpdateSparkEngine(updateSparkEngineOptions *UpdateSparkEngineOptions) - Operation response error`, func() { + updateSparkEnginePath := "/v3/spark_engines/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestoEngineCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSparkEnginePath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -15808,29 +16683,55 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetPrestoEngineCatalog with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSparkEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestoEngineCatalogOptions model - getPrestoEngineCatalogOptionsModel := new(watsonxdatav2.GetPrestoEngineCatalogOptions) - getPrestoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SparkEngineHomePatch model + sparkEngineHomePatchModel := new(watsonxdatav3.SparkEngineHomePatch) + sparkEngineHomePatchModel.StorageName = core.StringPtr("test-spark-storage") + + // Construct an instance of the SparkEngineResourceLimit model + sparkEngineResourceLimitModel := new(watsonxdatav3.SparkEngineResourceLimit) + sparkEngineResourceLimitModel.Cores = core.StringPtr("1") + sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") + + // Construct an instance of the SparkEnginePatchEngineDetails model + sparkEnginePatchEngineDetailsModel := new(watsonxdatav3.SparkEnginePatchEngineDetails) + sparkEnginePatchEngineDetailsModel.DefaultConfig = map[string]string{"key1": "configuration"} + sparkEnginePatchEngineDetailsModel.DefaultVersion = core.StringPtr("4.8.3") + sparkEnginePatchEngineDetailsModel.EngineHome = sparkEngineHomePatchModel + sparkEnginePatchEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) + sparkEnginePatchEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel + + // Construct an instance of the SparkEnginePatch model + sparkEnginePatchModel := new(watsonxdatav3.SparkEnginePatch) + sparkEnginePatchModel.Configuration = sparkEnginePatchEngineDetailsModel + sparkEnginePatchModel.Description = core.StringPtr("updated description for spark engine") + sparkEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + sparkEnginePatchModel.Tags = []string{"tag1", "tag2"} + sparkEnginePatchModelAsPatch, asPatchErr := sparkEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSparkEngineOptions model + updateSparkEngineOptionsModel := new(watsonxdatav3.UpdateSparkEngineOptions) + updateSparkEngineOptionsModel.ID = core.StringPtr("testString") + updateSparkEngineOptionsModel.Body = sparkEnginePatchModelAsPatch + updateSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) + result, response, operationErr = watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -15840,16 +16741,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetPrestoEngineCatalog(getPrestoEngineCatalogOptions *GetPrestoEngineCatalogOptions)`, func() { - getPrestoEngineCatalogPath := "/presto_engines/testString/catalogs/testString" + Describe(`UpdateSparkEngine(updateSparkEngineOptions *UpdateSparkEngineOptions)`, func() { + updateSparkEnginePath := "/v3/spark_engines/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestoEngineCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSparkEnginePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -15859,11 +16776,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"api_key": "apikey", "connection_string": "https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id", "default_config": {"mapKey": "configuration"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-instance_id", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home": {"path": "spark/spark1234", "storage_name": "test-spark-storage", "volume": "test-spark-volume", "volume_id": "1704979825978585", "volume_name": "my-volume"}, "engine_sub_type": "java", "instance_id": "spark-id", "managed_by": "fully", "resource_limit_enabled": true, "resource_limits": {"cores": "1", "memory": "4G"}, "resource_utilisation": {"cores": "1m", "memory": "4Gi"}, "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}, "vscode_config": {"crn": "crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2", "environment_type": "SaaS", "host": "us-south.lakehouse.dev.cloud.ibm.com", "user_name": "user@example.com"}}, "created_at": 1, "created_by": "@.com", "description": "spark engine description", "display_name": "sampleEngine", "id": "spark123", "mode": "serverless", "origin": "external", "status": "provisioning", "tags": ["Tags"], "type": "spark"}`) })) }) - It(`Invoke GetPrestoEngineCatalog successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSparkEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -15871,23 +16788,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetPrestoEngineCatalogOptions model - getPrestoEngineCatalogOptionsModel := new(watsonxdatav2.GetPrestoEngineCatalogOptions) - getPrestoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SparkEngineHomePatch model + sparkEngineHomePatchModel := new(watsonxdatav3.SparkEngineHomePatch) + sparkEngineHomePatchModel.StorageName = core.StringPtr("test-spark-storage") + + // Construct an instance of the SparkEngineResourceLimit model + sparkEngineResourceLimitModel := new(watsonxdatav3.SparkEngineResourceLimit) + sparkEngineResourceLimitModel.Cores = core.StringPtr("1") + sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") + + // Construct an instance of the SparkEnginePatchEngineDetails model + sparkEnginePatchEngineDetailsModel := new(watsonxdatav3.SparkEnginePatchEngineDetails) + sparkEnginePatchEngineDetailsModel.DefaultConfig = map[string]string{"key1": "configuration"} + sparkEnginePatchEngineDetailsModel.DefaultVersion = core.StringPtr("4.8.3") + sparkEnginePatchEngineDetailsModel.EngineHome = sparkEngineHomePatchModel + sparkEnginePatchEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) + sparkEnginePatchEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel + + // Construct an instance of the SparkEnginePatch model + sparkEnginePatchModel := new(watsonxdatav3.SparkEnginePatch) + sparkEnginePatchModel.Configuration = sparkEnginePatchEngineDetailsModel + sparkEnginePatchModel.Description = core.StringPtr("updated description for spark engine") + sparkEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + sparkEnginePatchModel.Tags = []string{"tag1", "tag2"} + sparkEnginePatchModelAsPatch, asPatchErr := sparkEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSparkEngineOptions model + updateSparkEngineOptionsModel := new(watsonxdatav3.UpdateSparkEngineOptions) + updateSparkEngineOptionsModel.ID = core.StringPtr("testString") + updateSparkEngineOptionsModel.Body = sparkEnginePatchModelAsPatch + updateSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetPrestoEngineCatalogWithContext(ctx, getPrestoEngineCatalogOptionsModel) + _, _, operationErr := watsonxDataService.UpdateSparkEngineWithContext(ctx, updateSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -15895,7 +16838,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetPrestoEngineCatalogWithContext(ctx, getPrestoEngineCatalogOptionsModel) + _, _, operationErr = watsonxDataService.UpdateSparkEngineWithContext(ctx, updateSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -15909,19 +16852,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getPrestoEngineCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSparkEnginePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "configuration": {"api_key": "apikey", "connection_string": "https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id", "default_config": {"mapKey": "configuration"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-instance_id", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home": {"path": "spark/spark1234", "storage_name": "test-spark-storage", "volume": "test-spark-volume", "volume_id": "1704979825978585", "volume_name": "my-volume"}, "engine_sub_type": "java", "instance_id": "spark-id", "managed_by": "fully", "resource_limit_enabled": true, "resource_limits": {"cores": "1", "memory": "4G"}, "resource_utilisation": {"cores": "1m", "memory": "4Gi"}, "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}, "vscode_config": {"crn": "crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2", "environment_type": "SaaS", "host": "us-south.lakehouse.dev.cloud.ibm.com", "user_name": "user@example.com"}}, "created_at": 1, "created_by": "@.com", "description": "spark engine description", "display_name": "sampleEngine", "id": "spark123", "mode": "serverless", "origin": "external", "status": "provisioning", "tags": ["Tags"], "type": "spark"}`) })) }) - It(`Invoke GetPrestoEngineCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -15929,51 +16888,103 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetPrestoEngineCatalog(nil) + result, response, operationErr := watsonxDataService.UpdateSparkEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetPrestoEngineCatalogOptions model - getPrestoEngineCatalogOptionsModel := new(watsonxdatav2.GetPrestoEngineCatalogOptions) - getPrestoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SparkEngineHomePatch model + sparkEngineHomePatchModel := new(watsonxdatav3.SparkEngineHomePatch) + sparkEngineHomePatchModel.StorageName = core.StringPtr("test-spark-storage") + + // Construct an instance of the SparkEngineResourceLimit model + sparkEngineResourceLimitModel := new(watsonxdatav3.SparkEngineResourceLimit) + sparkEngineResourceLimitModel.Cores = core.StringPtr("1") + sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") + + // Construct an instance of the SparkEnginePatchEngineDetails model + sparkEnginePatchEngineDetailsModel := new(watsonxdatav3.SparkEnginePatchEngineDetails) + sparkEnginePatchEngineDetailsModel.DefaultConfig = map[string]string{"key1": "configuration"} + sparkEnginePatchEngineDetailsModel.DefaultVersion = core.StringPtr("4.8.3") + sparkEnginePatchEngineDetailsModel.EngineHome = sparkEngineHomePatchModel + sparkEnginePatchEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) + sparkEnginePatchEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel + + // Construct an instance of the SparkEnginePatch model + sparkEnginePatchModel := new(watsonxdatav3.SparkEnginePatch) + sparkEnginePatchModel.Configuration = sparkEnginePatchEngineDetailsModel + sparkEnginePatchModel.Description = core.StringPtr("updated description for spark engine") + sparkEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + sparkEnginePatchModel.Tags = []string{"tag1", "tag2"} + sparkEnginePatchModelAsPatch, asPatchErr := sparkEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSparkEngineOptions model + updateSparkEngineOptionsModel := new(watsonxdatav3.UpdateSparkEngineOptions) + updateSparkEngineOptionsModel.ID = core.StringPtr("testString") + updateSparkEngineOptionsModel.Body = sparkEnginePatchModelAsPatch + updateSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) + result, response, operationErr = watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetPrestoEngineCatalog with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSparkEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestoEngineCatalogOptions model - getPrestoEngineCatalogOptionsModel := new(watsonxdatav2.GetPrestoEngineCatalogOptions) - getPrestoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SparkEngineHomePatch model + sparkEngineHomePatchModel := new(watsonxdatav3.SparkEngineHomePatch) + sparkEngineHomePatchModel.StorageName = core.StringPtr("test-spark-storage") + + // Construct an instance of the SparkEngineResourceLimit model + sparkEngineResourceLimitModel := new(watsonxdatav3.SparkEngineResourceLimit) + sparkEngineResourceLimitModel.Cores = core.StringPtr("1") + sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") + + // Construct an instance of the SparkEnginePatchEngineDetails model + sparkEnginePatchEngineDetailsModel := new(watsonxdatav3.SparkEnginePatchEngineDetails) + sparkEnginePatchEngineDetailsModel.DefaultConfig = map[string]string{"key1": "configuration"} + sparkEnginePatchEngineDetailsModel.DefaultVersion = core.StringPtr("4.8.3") + sparkEnginePatchEngineDetailsModel.EngineHome = sparkEngineHomePatchModel + sparkEnginePatchEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) + sparkEnginePatchEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel + + // Construct an instance of the SparkEnginePatch model + sparkEnginePatchModel := new(watsonxdatav3.SparkEnginePatch) + sparkEnginePatchModel.Configuration = sparkEnginePatchEngineDetailsModel + sparkEnginePatchModel.Description = core.StringPtr("updated description for spark engine") + sparkEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + sparkEnginePatchModel.Tags = []string{"tag1", "tag2"} + sparkEnginePatchModelAsPatch, asPatchErr := sparkEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSparkEngineOptions model + updateSparkEngineOptionsModel := new(watsonxdatav3.UpdateSparkEngineOptions) + updateSparkEngineOptionsModel.ID = core.StringPtr("testString") + updateSparkEngineOptionsModel.Body = sparkEnginePatchModelAsPatch + updateSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetPrestoEngineCatalogOptions model with no property values - getPrestoEngineCatalogOptionsModelNew := new(watsonxdatav2.GetPrestoEngineCatalogOptions) + // Construct a second instance of the UpdateSparkEngineOptions model with no property values + updateSparkEngineOptionsModelNew := new(watsonxdatav3.UpdateSparkEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -15991,23 +17002,49 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetPrestoEngineCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetPrestoEngineCatalogOptions model - getPrestoEngineCatalogOptionsModel := new(watsonxdatav2.GetPrestoEngineCatalogOptions) - getPrestoEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getPrestoEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SparkEngineHomePatch model + sparkEngineHomePatchModel := new(watsonxdatav3.SparkEngineHomePatch) + sparkEngineHomePatchModel.StorageName = core.StringPtr("test-spark-storage") + + // Construct an instance of the SparkEngineResourceLimit model + sparkEngineResourceLimitModel := new(watsonxdatav3.SparkEngineResourceLimit) + sparkEngineResourceLimitModel.Cores = core.StringPtr("1") + sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") + + // Construct an instance of the SparkEnginePatchEngineDetails model + sparkEnginePatchEngineDetailsModel := new(watsonxdatav3.SparkEnginePatchEngineDetails) + sparkEnginePatchEngineDetailsModel.DefaultConfig = map[string]string{"key1": "configuration"} + sparkEnginePatchEngineDetailsModel.DefaultVersion = core.StringPtr("4.8.3") + sparkEnginePatchEngineDetailsModel.EngineHome = sparkEngineHomePatchModel + sparkEnginePatchEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) + sparkEnginePatchEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel + + // Construct an instance of the SparkEnginePatch model + sparkEnginePatchModel := new(watsonxdatav3.SparkEnginePatch) + sparkEnginePatchModel.Configuration = sparkEnginePatchEngineDetailsModel + sparkEnginePatchModel.Description = core.StringPtr("updated description for spark engine") + sparkEnginePatchModel.DisplayName = core.StringPtr("sampleEngine") + sparkEnginePatchModel.Tags = []string{"tag1", "tag2"} + sparkEnginePatchModelAsPatch, asPatchErr := sparkEnginePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateSparkEngineOptions model + updateSparkEngineOptionsModel := new(watsonxdatav3.UpdateSparkEngineOptions) + updateSparkEngineOptionsModel.ID = core.StringPtr("testString") + updateSparkEngineOptionsModel.Body = sparkEnginePatchModelAsPatch + updateSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetPrestoEngineCatalog(getPrestoEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -16019,45 +17056,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`PausePrestoEngine(pausePrestoEngineOptions *PausePrestoEngineOptions) - Operation response error`, func() { - pausePrestoEnginePath := "/presto_engines/testString/pause" + Describe(`ListSparkEngineCatalogs(listSparkEngineCatalogsOptions *ListSparkEngineCatalogsOptions) - Operation response error`, func() { + listSparkEngineCatalogsPath := "/v3/spark_engines/testString/catalogs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(pausePrestoEnginePath)) - Expect(req.Method).To(Equal("POST")) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineCatalogsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke PausePrestoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngineCatalogs with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PausePrestoEngineOptions model - pausePrestoEngineOptionsModel := new(watsonxdatav2.PausePrestoEngineOptions) - pausePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - pausePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pausePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSparkEngineCatalogsOptions model + listSparkEngineCatalogsOptionsModel := new(watsonxdatav3.ListSparkEngineCatalogsOptions) + listSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + listSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -16067,16 +17104,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`PausePrestoEngine(pausePrestoEngineOptions *PausePrestoEngineOptions)`, func() { - pausePrestoEnginePath := "/presto_engines/testString/pause" + Describe(`ListSparkEngineCatalogs(listSparkEngineCatalogsOptions *ListSparkEngineCatalogsOptions)`, func() { + listSparkEngineCatalogsPath := "/v3/spark_engines/testString/catalogs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(pausePrestoEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineCatalogsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -16086,11 +17123,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke PausePrestoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngineCatalogs successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -16098,22 +17135,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the PausePrestoEngineOptions model - pausePrestoEngineOptionsModel := new(watsonxdatav2.PausePrestoEngineOptions) - pausePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - pausePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pausePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSparkEngineCatalogsOptions model + listSparkEngineCatalogsOptionsModel := new(watsonxdatav3.ListSparkEngineCatalogsOptions) + listSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + listSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.PausePrestoEngineWithContext(ctx, pausePrestoEngineOptionsModel) + _, _, operationErr := watsonxDataService.ListSparkEngineCatalogsWithContext(ctx, listSparkEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -16121,7 +17158,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.PausePrestoEngineWithContext(ctx, pausePrestoEngineOptionsModel) + _, _, operationErr = watsonxDataService.ListSparkEngineCatalogsWithContext(ctx, listSparkEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -16135,19 +17172,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(pausePrestoEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineCatalogsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke PausePrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -16155,49 +17192,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.PausePrestoEngine(nil) + result, response, operationErr := watsonxDataService.ListSparkEngineCatalogs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the PausePrestoEngineOptions model - pausePrestoEngineOptionsModel := new(watsonxdatav2.PausePrestoEngineOptions) - pausePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - pausePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pausePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSparkEngineCatalogsOptions model + listSparkEngineCatalogsOptionsModel := new(watsonxdatav3.ListSparkEngineCatalogsOptions) + listSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + listSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke PausePrestoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngineCatalogs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PausePrestoEngineOptions model - pausePrestoEngineOptionsModel := new(watsonxdatav2.PausePrestoEngineOptions) - pausePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - pausePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pausePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSparkEngineCatalogsOptions model + listSparkEngineCatalogsOptionsModel := new(watsonxdatav3.ListSparkEngineCatalogsOptions) + listSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + listSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the PausePrestoEngineOptions model with no property values - pausePrestoEngineOptionsModelNew := new(watsonxdatav2.PausePrestoEngineOptions) + // Construct a second instance of the ListSparkEngineCatalogsOptions model with no property values + listSparkEngineCatalogsOptionsModelNew := new(watsonxdatav3.ListSparkEngineCatalogsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -16215,22 +17252,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke PausePrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PausePrestoEngineOptions model - pausePrestoEngineOptionsModel := new(watsonxdatav2.PausePrestoEngineOptions) - pausePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - pausePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pausePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSparkEngineCatalogsOptions model + listSparkEngineCatalogsOptionsModel := new(watsonxdatav3.ListSparkEngineCatalogsOptions) + listSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + listSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.PausePrestoEngine(pausePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -16242,48 +17279,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RunExplainStatement(runExplainStatementOptions *RunExplainStatementOptions) - Operation response error`, func() { - runExplainStatementPath := "/presto_engines/testString/query_explain" + Describe(`CreateSparkEngineCatalogs(createSparkEngineCatalogsOptions *CreateSparkEngineCatalogsOptions) - Operation response error`, func() { + createSparkEngineCatalogsPath := "/v3/spark_engines/testString/catalogs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runExplainStatementPath)) + Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineCatalogsPath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke RunExplainStatement with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngineCatalogs with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunExplainStatementOptions model - runExplainStatementOptionsModel := new(watsonxdatav2.RunExplainStatementOptions) - runExplainStatementOptionsModel.EngineID = core.StringPtr("testString") - runExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runExplainStatementOptionsModel.Format = core.StringPtr("json") - runExplainStatementOptionsModel.Type = core.StringPtr("io") - runExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSparkEngineCatalogsOptions model + createSparkEngineCatalogsOptionsModel := new(watsonxdatav3.CreateSparkEngineCatalogsOptions) + createSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + createSparkEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) + result, response, operationErr := watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) + result, response, operationErr = watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -16293,15 +17328,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RunExplainStatement(runExplainStatementOptions *RunExplainStatementOptions)`, func() { - runExplainStatementPath := "/presto_engines/testString/query_explain" + Describe(`CreateSparkEngineCatalogs(createSparkEngineCatalogsOptions *CreateSparkEngineCatalogsOptions)`, func() { + createSparkEngineCatalogsPath := "/v3/spark_engines/testString/catalogs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runExplainStatementPath)) + Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineCatalogsPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -16327,12 +17362,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "result": "Result"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke RunExplainStatement successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngineCatalogs successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -16340,25 +17375,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the RunExplainStatementOptions model - runExplainStatementOptionsModel := new(watsonxdatav2.RunExplainStatementOptions) - runExplainStatementOptionsModel.EngineID = core.StringPtr("testString") - runExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runExplainStatementOptionsModel.Format = core.StringPtr("json") - runExplainStatementOptionsModel.Type = core.StringPtr("io") - runExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSparkEngineCatalogsOptions model + createSparkEngineCatalogsOptionsModel := new(watsonxdatav3.CreateSparkEngineCatalogsOptions) + createSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + createSparkEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.RunExplainStatementWithContext(ctx, runExplainStatementOptionsModel) + _, _, operationErr := watsonxDataService.CreateSparkEngineCatalogsWithContext(ctx, createSparkEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) + result, response, operationErr := watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -16366,7 +17399,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.RunExplainStatementWithContext(ctx, runExplainStatementOptionsModel) + _, _, operationErr = watsonxDataService.CreateSparkEngineCatalogsWithContext(ctx, createSparkEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -16380,7 +17413,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runExplainStatementPath)) + Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineCatalogsPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -16403,12 +17436,12 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "result": "Result"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke RunExplainStatement successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -16416,55 +17449,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.RunExplainStatement(nil) + result, response, operationErr := watsonxDataService.CreateSparkEngineCatalogs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the RunExplainStatementOptions model - runExplainStatementOptionsModel := new(watsonxdatav2.RunExplainStatementOptions) - runExplainStatementOptionsModel.EngineID = core.StringPtr("testString") - runExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runExplainStatementOptionsModel.Format = core.StringPtr("json") - runExplainStatementOptionsModel.Type = core.StringPtr("io") - runExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSparkEngineCatalogsOptions model + createSparkEngineCatalogsOptionsModel := new(watsonxdatav3.CreateSparkEngineCatalogsOptions) + createSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + createSparkEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) + result, response, operationErr = watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke RunExplainStatement with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngineCatalogs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunExplainStatementOptions model - runExplainStatementOptionsModel := new(watsonxdatav2.RunExplainStatementOptions) - runExplainStatementOptionsModel.EngineID = core.StringPtr("testString") - runExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runExplainStatementOptionsModel.Format = core.StringPtr("json") - runExplainStatementOptionsModel.Type = core.StringPtr("io") - runExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSparkEngineCatalogsOptions model + createSparkEngineCatalogsOptionsModel := new(watsonxdatav3.CreateSparkEngineCatalogsOptions) + createSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + createSparkEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) + result, response, operationErr := watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the RunExplainStatementOptions model with no property values - runExplainStatementOptionsModelNew := new(watsonxdatav2.RunExplainStatementOptions) + // Construct a second instance of the CreateSparkEngineCatalogsOptions model with no property values + createSparkEngineCatalogsOptionsModelNew := new(watsonxdatav3.CreateSparkEngineCatalogsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.RunExplainStatement(runExplainStatementOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -16479,28 +17508,26 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke RunExplainStatement successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunExplainStatementOptions model - runExplainStatementOptionsModel := new(watsonxdatav2.RunExplainStatementOptions) - runExplainStatementOptionsModel.EngineID = core.StringPtr("testString") - runExplainStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runExplainStatementOptionsModel.Format = core.StringPtr("json") - runExplainStatementOptionsModel.Type = core.StringPtr("io") - runExplainStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runExplainStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSparkEngineCatalogsOptions model + createSparkEngineCatalogsOptionsModel := new(watsonxdatav3.CreateSparkEngineCatalogsOptions) + createSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + createSparkEngineCatalogsOptionsModel.CatalogNames = []string{"iceberg_catalog"} + createSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.RunExplainStatement(runExplainStatementOptionsModel) + result, response, operationErr := watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -16512,77 +17539,151 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptions *RunExplainAnalyzeStatementOptions) - Operation response error`, func() { - runExplainAnalyzeStatementPath := "/presto_engines/testString/query_explain_analyze" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptions *DeleteSparkEngineCatalogsOptions)`, func() { + deleteSparkEngineCatalogsPath := "/v3/spark_engines/testString/catalogs" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runExplainAnalyzeStatementPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSparkEngineCatalogsPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + Expect(req.URL.Query()["catalog_names"]).To(Equal([]string{"testString"})) + res.WriteHeader(204) })) }) - It(`Invoke RunExplainAnalyzeStatement with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSparkEngineCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunExplainAnalyzeStatementOptions model - runExplainAnalyzeStatementOptionsModel := new(watsonxdatav2.RunExplainAnalyzeStatementOptions) - runExplainAnalyzeStatementOptionsModel.EngineID = core.StringPtr("testString") - runExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) - runExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteSparkEngineCatalogs(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSparkEngineCatalogsOptions model + deleteSparkEngineCatalogsOptionsModel := new(watsonxdatav3.DeleteSparkEngineCatalogsOptions) + deleteSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + deleteSparkEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") + deleteSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + }) + It(`Invoke DeleteSparkEngineCatalogs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) - // Enable retries and test again - watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) + // Construct an instance of the DeleteSparkEngineCatalogsOptions model + deleteSparkEngineCatalogsOptionsModel := new(watsonxdatav3.DeleteSparkEngineCatalogsOptions) + deleteSparkEngineCatalogsOptionsModel.ID = core.StringPtr("testString") + deleteSparkEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") + deleteSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSparkEngineCatalogsOptions model with no property values + deleteSparkEngineCatalogsOptionsModelNew := new(watsonxdatav3.DeleteSparkEngineCatalogsOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptions *RunExplainAnalyzeStatementOptions)`, func() { - runExplainAnalyzeStatementPath := "/presto_engines/testString/query_explain_analyze" - Context(`Using mock server endpoint with timeout`, func() { + Describe(`PauseSparkEngine(pauseSparkEngineOptions *PauseSparkEngineOptions) - Operation response error`, func() { + pauseSparkEnginePath := "/v3/spark_engines/testString/pause" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runExplainAnalyzeStatementPath)) + Expect(req.URL.EscapedPath()).To(Equal(pauseSparkEnginePath)) Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke PauseSparkEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the PauseSparkEngineOptions model + pauseSparkEngineOptionsModel := new(watsonxdatav3.PauseSparkEngineOptions) + pauseSparkEngineOptionsModel.ID = core.StringPtr("testString") + pauseSparkEngineOptionsModel.Force = core.BoolPtr(true) + pauseSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pauseSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + watsonxDataService.EnableRetries(0, 0) + result, response, operationErr = watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`PauseSparkEngine(pauseSparkEngineOptions *PauseSparkEngineOptions)`, func() { + pauseSparkEnginePath := "/v3/spark_engines/testString/pause" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(pauseSparkEnginePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) } else { _, err := bodyBuf.ReadFrom(req.Body) Expect(err).To(BeNil()) @@ -16597,11 +17698,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "result": "Result"}`) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke RunExplainAnalyzeStatement successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PauseSparkEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -16609,24 +17710,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the RunExplainAnalyzeStatementOptions model - runExplainAnalyzeStatementOptionsModel := new(watsonxdatav2.RunExplainAnalyzeStatementOptions) - runExplainAnalyzeStatementOptionsModel.EngineID = core.StringPtr("testString") - runExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) - runExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PauseSparkEngineOptions model + pauseSparkEngineOptionsModel := new(watsonxdatav3.PauseSparkEngineOptions) + pauseSparkEngineOptionsModel.ID = core.StringPtr("testString") + pauseSparkEngineOptionsModel.Force = core.BoolPtr(true) + pauseSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pauseSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.RunExplainAnalyzeStatementWithContext(ctx, runExplainAnalyzeStatementOptionsModel) + _, _, operationErr := watsonxDataService.PauseSparkEngineWithContext(ctx, pauseSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) + result, response, operationErr := watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -16634,7 +17734,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.RunExplainAnalyzeStatementWithContext(ctx, runExplainAnalyzeStatementOptionsModel) + _, _, operationErr = watsonxDataService.PauseSparkEngineWithContext(ctx, pauseSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -16648,7 +17748,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(runExplainAnalyzeStatementPath)) + Expect(req.URL.EscapedPath()).To(Equal(pauseSparkEnginePath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -16672,11 +17772,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "result": "Result"}`) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke RunExplainAnalyzeStatement successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PauseSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -16684,53 +17784,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.RunExplainAnalyzeStatement(nil) + result, response, operationErr := watsonxDataService.PauseSparkEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the RunExplainAnalyzeStatementOptions model - runExplainAnalyzeStatementOptionsModel := new(watsonxdatav2.RunExplainAnalyzeStatementOptions) - runExplainAnalyzeStatementOptionsModel.EngineID = core.StringPtr("testString") - runExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) - runExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PauseSparkEngineOptions model + pauseSparkEngineOptionsModel := new(watsonxdatav3.PauseSparkEngineOptions) + pauseSparkEngineOptionsModel.ID = core.StringPtr("testString") + pauseSparkEngineOptionsModel.Force = core.BoolPtr(true) + pauseSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pauseSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) + result, response, operationErr = watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke RunExplainAnalyzeStatement with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PauseSparkEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunExplainAnalyzeStatementOptions model - runExplainAnalyzeStatementOptionsModel := new(watsonxdatav2.RunExplainAnalyzeStatementOptions) - runExplainAnalyzeStatementOptionsModel.EngineID = core.StringPtr("testString") - runExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) - runExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PauseSparkEngineOptions model + pauseSparkEngineOptionsModel := new(watsonxdatav3.PauseSparkEngineOptions) + pauseSparkEngineOptionsModel.ID = core.StringPtr("testString") + pauseSparkEngineOptionsModel.Force = core.BoolPtr(true) + pauseSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pauseSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) + result, response, operationErr := watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the RunExplainAnalyzeStatementOptions model with no property values - runExplainAnalyzeStatementOptionsModelNew := new(watsonxdatav2.RunExplainAnalyzeStatementOptions) + // Construct a second instance of the PauseSparkEngineOptions model with no property values + pauseSparkEngineOptionsModelNew := new(watsonxdatav3.PauseSparkEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModelNew) + result, response, operationErr = watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -16748,24 +17846,23 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke RunExplainAnalyzeStatement successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke PauseSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RunExplainAnalyzeStatementOptions model - runExplainAnalyzeStatementOptionsModel := new(watsonxdatav2.RunExplainAnalyzeStatementOptions) - runExplainAnalyzeStatementOptionsModel.EngineID = core.StringPtr("testString") - runExplainAnalyzeStatementOptionsModel.Statement = core.StringPtr("show schemas in catalog_name") - runExplainAnalyzeStatementOptionsModel.Verbose = core.BoolPtr(true) - runExplainAnalyzeStatementOptionsModel.AuthInstanceID = core.StringPtr("testString") - runExplainAnalyzeStatementOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the PauseSparkEngineOptions model + pauseSparkEngineOptionsModel := new(watsonxdatav3.PauseSparkEngineOptions) + pauseSparkEngineOptionsModel.ID = core.StringPtr("testString") + pauseSparkEngineOptionsModel.Force = core.BoolPtr(true) + pauseSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + pauseSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.RunExplainAnalyzeStatement(runExplainAnalyzeStatementOptionsModel) + result, response, operationErr := watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -16777,15 +17874,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RestartPrestoEngine(restartPrestoEngineOptions *RestartPrestoEngineOptions) - Operation response error`, func() { - restartPrestoEnginePath := "/presto_engines/testString/restart" + Describe(`ResumeSparkEngine(resumeSparkEngineOptions *ResumeSparkEngineOptions) - Operation response error`, func() { + resumeSparkEnginePath := "/v3/spark_engines/testString/resume" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(restartPrestoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(resumeSparkEnginePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -16794,28 +17891,28 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke RestartPrestoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumeSparkEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RestartPrestoEngineOptions model - restartPrestoEngineOptionsModel := new(watsonxdatav2.RestartPrestoEngineOptions) - restartPrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - restartPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - restartPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumeSparkEngineOptions model + resumeSparkEngineOptionsModel := new(watsonxdatav3.ResumeSparkEngineOptions) + resumeSparkEngineOptionsModel.ID = core.StringPtr("testString") + resumeSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumeSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -16825,15 +17922,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RestartPrestoEngine(restartPrestoEngineOptions *RestartPrestoEngineOptions)`, func() { - restartPrestoEnginePath := "/presto_engines/testString/restart" + Describe(`ResumeSparkEngine(resumeSparkEngineOptions *ResumeSparkEngineOptions)`, func() { + resumeSparkEnginePath := "/v3/spark_engines/testString/resume" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(restartPrestoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(resumeSparkEnginePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -16844,11 +17941,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke RestartPrestoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumeSparkEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -16856,22 +17953,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the RestartPrestoEngineOptions model - restartPrestoEngineOptionsModel := new(watsonxdatav2.RestartPrestoEngineOptions) - restartPrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - restartPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - restartPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumeSparkEngineOptions model + resumeSparkEngineOptionsModel := new(watsonxdatav3.ResumeSparkEngineOptions) + resumeSparkEngineOptionsModel.ID = core.StringPtr("testString") + resumeSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumeSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.RestartPrestoEngineWithContext(ctx, restartPrestoEngineOptionsModel) + _, _, operationErr := watsonxDataService.ResumeSparkEngineWithContext(ctx, resumeSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -16879,7 +17976,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.RestartPrestoEngineWithContext(ctx, restartPrestoEngineOptionsModel) + _, _, operationErr = watsonxDataService.ResumeSparkEngineWithContext(ctx, resumeSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -16893,7 +17990,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(restartPrestoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(resumeSparkEnginePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -16901,11 +17998,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke RestartPrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumeSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -16913,49 +18010,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.RestartPrestoEngine(nil) + result, response, operationErr := watsonxDataService.ResumeSparkEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the RestartPrestoEngineOptions model - restartPrestoEngineOptionsModel := new(watsonxdatav2.RestartPrestoEngineOptions) - restartPrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - restartPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - restartPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumeSparkEngineOptions model + resumeSparkEngineOptionsModel := new(watsonxdatav3.ResumeSparkEngineOptions) + resumeSparkEngineOptionsModel.ID = core.StringPtr("testString") + resumeSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumeSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke RestartPrestoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumeSparkEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RestartPrestoEngineOptions model - restartPrestoEngineOptionsModel := new(watsonxdatav2.RestartPrestoEngineOptions) - restartPrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - restartPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - restartPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumeSparkEngineOptions model + resumeSparkEngineOptionsModel := new(watsonxdatav3.ResumeSparkEngineOptions) + resumeSparkEngineOptionsModel.ID = core.StringPtr("testString") + resumeSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumeSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the RestartPrestoEngineOptions model with no property values - restartPrestoEngineOptionsModelNew := new(watsonxdatav2.RestartPrestoEngineOptions) + // Construct a second instance of the ResumeSparkEngineOptions model with no property values + resumeSparkEngineOptionsModelNew := new(watsonxdatav3.ResumeSparkEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -16973,22 +18070,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke RestartPrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ResumeSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RestartPrestoEngineOptions model - restartPrestoEngineOptionsModel := new(watsonxdatav2.RestartPrestoEngineOptions) - restartPrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - restartPrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - restartPrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResumeSparkEngineOptions model + resumeSparkEngineOptionsModel := new(watsonxdatav3.ResumeSparkEngineOptions) + resumeSparkEngineOptionsModel.ID = core.StringPtr("testString") + resumeSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + resumeSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.RestartPrestoEngine(restartPrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -17000,45 +18097,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ResumePrestoEngine(resumePrestoEngineOptions *ResumePrestoEngineOptions) - Operation response error`, func() { - resumePrestoEnginePath := "/presto_engines/testString/resume" + Describe(`ScaleSparkEngine(scaleSparkEngineOptions *ScaleSparkEngineOptions) - Operation response error`, func() { + scaleSparkEnginePath := "/v3/spark_engines/testString/scale" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(resumePrestoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(scaleSparkEnginePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ResumePrestoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScaleSparkEngine with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ResumePrestoEngineOptions model - resumePrestoEngineOptionsModel := new(watsonxdatav2.ResumePrestoEngineOptions) - resumePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - resumePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ScaleSparkEngineOptions model + scaleSparkEngineOptionsModel := new(watsonxdatav3.ScaleSparkEngineOptions) + scaleSparkEngineOptionsModel.ID = core.StringPtr("testString") + scaleSparkEngineOptionsModel.NumberOfNodes = core.Int64Ptr(int64(2)) + scaleSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scaleSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -17048,17 +18146,33 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ResumePrestoEngine(resumePrestoEngineOptions *ResumePrestoEngineOptions)`, func() { - resumePrestoEnginePath := "/presto_engines/testString/resume" + Describe(`ScaleSparkEngine(scaleSparkEngineOptions *ScaleSparkEngineOptions)`, func() { + scaleSparkEnginePath := "/v3/spark_engines/testString/scale" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(resumePrestoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(scaleSparkEnginePath)) Expect(req.Method).To(Equal("POST")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Sleep a short time to support a timeout test @@ -17066,12 +18180,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke ResumePrestoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScaleSparkEngine successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -17079,22 +18193,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ResumePrestoEngineOptions model - resumePrestoEngineOptionsModel := new(watsonxdatav2.ResumePrestoEngineOptions) - resumePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - resumePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ScaleSparkEngineOptions model + scaleSparkEngineOptionsModel := new(watsonxdatav3.ScaleSparkEngineOptions) + scaleSparkEngineOptionsModel.ID = core.StringPtr("testString") + scaleSparkEngineOptionsModel.NumberOfNodes = core.Int64Ptr(int64(2)) + scaleSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scaleSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ResumePrestoEngineWithContext(ctx, resumePrestoEngineOptionsModel) + _, _, operationErr := watsonxDataService.ScaleSparkEngineWithContext(ctx, scaleSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -17102,7 +18217,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ResumePrestoEngineWithContext(ctx, resumePrestoEngineOptionsModel) + _, _, operationErr = watsonxDataService.ScaleSparkEngineWithContext(ctx, scaleSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -17116,19 +18231,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(resumePrestoEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(scaleSparkEnginePath)) Expect(req.Method).To(Equal("POST")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke ResumePrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScaleSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -17136,49 +18267,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ResumePrestoEngine(nil) + result, response, operationErr := watsonxDataService.ScaleSparkEngine(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ResumePrestoEngineOptions model - resumePrestoEngineOptionsModel := new(watsonxdatav2.ResumePrestoEngineOptions) - resumePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - resumePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ScaleSparkEngineOptions model + scaleSparkEngineOptionsModel := new(watsonxdatav3.ScaleSparkEngineOptions) + scaleSparkEngineOptionsModel.ID = core.StringPtr("testString") + scaleSparkEngineOptionsModel.NumberOfNodes = core.Int64Ptr(int64(2)) + scaleSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scaleSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ResumePrestoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScaleSparkEngine with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ResumePrestoEngineOptions model - resumePrestoEngineOptionsModel := new(watsonxdatav2.ResumePrestoEngineOptions) - resumePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - resumePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ScaleSparkEngineOptions model + scaleSparkEngineOptionsModel := new(watsonxdatav3.ScaleSparkEngineOptions) + scaleSparkEngineOptionsModel.ID = core.StringPtr("testString") + scaleSparkEngineOptionsModel.NumberOfNodes = core.Int64Ptr(int64(2)) + scaleSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scaleSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ResumePrestoEngineOptions model with no property values - resumePrestoEngineOptionsModelNew := new(watsonxdatav2.ResumePrestoEngineOptions) + // Construct a second instance of the ScaleSparkEngineOptions model with no property values + scaleSparkEngineOptionsModelNew := new(watsonxdatav3.ScaleSparkEngineOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -17193,25 +18326,26 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke ResumePrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ScaleSparkEngine successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ResumePrestoEngineOptions model - resumePrestoEngineOptionsModel := new(watsonxdatav2.ResumePrestoEngineOptions) - resumePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - resumePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ScaleSparkEngineOptions model + scaleSparkEngineOptionsModel := new(watsonxdatav3.ScaleSparkEngineOptions) + scaleSparkEngineOptionsModel.ID = core.StringPtr("testString") + scaleSparkEngineOptionsModel.NumberOfNodes = core.Int64Ptr(int64(2)) + scaleSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") + scaleSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ResumePrestoEngine(resumePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -17223,52 +18357,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ScalePrestoEngine(scalePrestoEngineOptions *ScalePrestoEngineOptions) - Operation response error`, func() { - scalePrestoEnginePath := "/presto_engines/testString/scale" + Describe(`GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptions *GetSparkEngineApplicationStatusOptions) - Operation response error`, func() { + getSparkEngineApplicationStatusPath := "/v3/spark_engines/testString/applications/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(scalePrestoEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineApplicationStatusPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ScalePrestoEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineApplicationStatus with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NodeDescription model - nodeDescriptionModel := new(watsonxdatav2.NodeDescription) - nodeDescriptionModel.NodeType = core.StringPtr("starter") - nodeDescriptionModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the ScalePrestoEngineOptions model - scalePrestoEngineOptionsModel := new(watsonxdatav2.ScalePrestoEngineOptions) - scalePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - scalePrestoEngineOptionsModel.Coordinator = nodeDescriptionModel - scalePrestoEngineOptionsModel.Worker = nodeDescriptionModel - scalePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scalePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineApplicationStatusOptions model + getSparkEngineApplicationStatusOptionsModel := new(watsonxdatav3.GetSparkEngineApplicationStatusOptions) + getSparkEngineApplicationStatusOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.ID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -17278,32 +18406,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ScalePrestoEngine(scalePrestoEngineOptions *ScalePrestoEngineOptions)`, func() { - scalePrestoEnginePath := "/presto_engines/testString/scale" + Describe(`GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptions *GetSparkEngineApplicationStatusOptions)`, func() { + getSparkEngineApplicationStatusPath := "/v3/spark_engines/testString/applications/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(scalePrestoEnginePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineApplicationStatusPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -17312,12 +18424,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"application_details": {"application": "s3://mybucket/wordcount.py", "archives": "s3://mybucket/myarchive.zip", "arguments": ["people.txt"], "class": "org.apache.spark.examples.SparkPi", "conf": {"mapKey": "configuration"}, "env": {"mapKey": "configuration"}, "files": "s3://mybucket/myfile.txt", "jars": "Jars", "name": "SparkApplicaton1", "packages": "org.apache.spark:example_1.2.3", "repositories": "https://repo1.maven.org/maven2/", "runtime": {"spark_version": "3.4"}, "spark_version": "3.3"}, "auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "Saturday 28 October 2023 07:17:26.649+0000", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "init_scripts": ["file://init_scripts/test.sh"], "max_retries": "3", "min_retry_interval_in_seconds": "30", "retry_attempt": "2", "runtime": {"spark_version": "3.4"}, "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_ui": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui", "spark_version": "3.4", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}`) })) }) - It(`Invoke ScalePrestoEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineApplicationStatus successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -17325,29 +18437,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the NodeDescription model - nodeDescriptionModel := new(watsonxdatav2.NodeDescription) - nodeDescriptionModel.NodeType = core.StringPtr("starter") - nodeDescriptionModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the ScalePrestoEngineOptions model - scalePrestoEngineOptionsModel := new(watsonxdatav2.ScalePrestoEngineOptions) - scalePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - scalePrestoEngineOptionsModel.Coordinator = nodeDescriptionModel - scalePrestoEngineOptionsModel.Worker = nodeDescriptionModel - scalePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scalePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineApplicationStatusOptions model + getSparkEngineApplicationStatusOptionsModel := new(watsonxdatav3.GetSparkEngineApplicationStatusOptions) + getSparkEngineApplicationStatusOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.ID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ScalePrestoEngineWithContext(ctx, scalePrestoEngineOptionsModel) + _, _, operationErr := watsonxDataService.GetSparkEngineApplicationStatusWithContext(ctx, getSparkEngineApplicationStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -17355,7 +18461,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ScalePrestoEngineWithContext(ctx, scalePrestoEngineOptionsModel) + _, _, operationErr = watsonxDataService.GetSparkEngineApplicationStatusWithContext(ctx, getSparkEngineApplicationStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -17369,35 +18475,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(scalePrestoEnginePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineApplicationStatusPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"application_details": {"application": "s3://mybucket/wordcount.py", "archives": "s3://mybucket/myarchive.zip", "arguments": ["people.txt"], "class": "org.apache.spark.examples.SparkPi", "conf": {"mapKey": "configuration"}, "env": {"mapKey": "configuration"}, "files": "s3://mybucket/myfile.txt", "jars": "Jars", "name": "SparkApplicaton1", "packages": "org.apache.spark:example_1.2.3", "repositories": "https://repo1.maven.org/maven2/", "runtime": {"spark_version": "3.4"}, "spark_version": "3.3"}, "auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "Saturday 28 October 2023 07:17:26.649+0000", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "init_scripts": ["file://init_scripts/test.sh"], "max_retries": "3", "min_retry_interval_in_seconds": "30", "retry_attempt": "2", "runtime": {"spark_version": "3.4"}, "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_ui": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui", "spark_version": "3.4", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}`) })) }) - It(`Invoke ScalePrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineApplicationStatus successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -17405,63 +18495,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ScalePrestoEngine(nil) + result, response, operationErr := watsonxDataService.GetSparkEngineApplicationStatus(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the NodeDescription model - nodeDescriptionModel := new(watsonxdatav2.NodeDescription) - nodeDescriptionModel.NodeType = core.StringPtr("starter") - nodeDescriptionModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the ScalePrestoEngineOptions model - scalePrestoEngineOptionsModel := new(watsonxdatav2.ScalePrestoEngineOptions) - scalePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - scalePrestoEngineOptionsModel.Coordinator = nodeDescriptionModel - scalePrestoEngineOptionsModel.Worker = nodeDescriptionModel - scalePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scalePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineApplicationStatusOptions model + getSparkEngineApplicationStatusOptionsModel := new(watsonxdatav3.GetSparkEngineApplicationStatusOptions) + getSparkEngineApplicationStatusOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.ID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) + result, response, operationErr = watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ScalePrestoEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineApplicationStatus with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NodeDescription model - nodeDescriptionModel := new(watsonxdatav2.NodeDescription) - nodeDescriptionModel.NodeType = core.StringPtr("starter") - nodeDescriptionModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the ScalePrestoEngineOptions model - scalePrestoEngineOptionsModel := new(watsonxdatav2.ScalePrestoEngineOptions) - scalePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - scalePrestoEngineOptionsModel.Coordinator = nodeDescriptionModel - scalePrestoEngineOptionsModel.Worker = nodeDescriptionModel - scalePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scalePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineApplicationStatusOptions model + getSparkEngineApplicationStatusOptionsModel := new(watsonxdatav3.GetSparkEngineApplicationStatusOptions) + getSparkEngineApplicationStatusOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.ID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ScalePrestoEngineOptions model with no property values - scalePrestoEngineOptionsModelNew := new(watsonxdatav2.ScalePrestoEngineOptions) + // Construct a second instance of the GetSparkEngineApplicationStatusOptions model with no property values + getSparkEngineApplicationStatusOptionsModelNew := new(watsonxdatav3.GetSparkEngineApplicationStatusOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -17476,32 +18554,26 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke ScalePrestoEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineApplicationStatus successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the NodeDescription model - nodeDescriptionModel := new(watsonxdatav2.NodeDescription) - nodeDescriptionModel.NodeType = core.StringPtr("starter") - nodeDescriptionModel.Quantity = core.Int64Ptr(int64(38)) - - // Construct an instance of the ScalePrestoEngineOptions model - scalePrestoEngineOptionsModel := new(watsonxdatav2.ScalePrestoEngineOptions) - scalePrestoEngineOptionsModel.EngineID = core.StringPtr("testString") - scalePrestoEngineOptionsModel.Coordinator = nodeDescriptionModel - scalePrestoEngineOptionsModel.Worker = nodeDescriptionModel - scalePrestoEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scalePrestoEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineApplicationStatusOptions model + getSparkEngineApplicationStatusOptionsModel := new(watsonxdatav3.GetSparkEngineApplicationStatusOptions) + getSparkEngineApplicationStatusOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.ID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineApplicationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ScalePrestoEngine(scalePrestoEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -17513,133 +18585,98 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegration(getSalIntegrationOptions *GetSalIntegrationOptions) - Operation response error`, func() { - getSalIntegrationPath := "/sal_integrations" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`DeleteSparkEngineApplication(deleteSparkEngineApplicationOptions *DeleteSparkEngineApplicationOptions)`, func() { + deleteSparkEngineApplicationPath := "/v3/spark_engines/testString/applications/testString" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSparkEngineApplicationPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(204) })) }) - It(`Invoke GetSalIntegration with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSparkEngineApplication successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationOptions model - getSalIntegrationOptionsModel := new(watsonxdatav2.GetSalIntegrationOptions) - getSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteSparkEngineApplication(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSparkEngineApplicationOptions model + deleteSparkEngineApplicationOptionsModel := new(watsonxdatav3.DeleteSparkEngineApplicationOptions) + deleteSparkEngineApplicationOptionsModel.EngineID = core.StringPtr("testString") + deleteSparkEngineApplicationOptionsModel.ID = core.StringPtr("testString") + deleteSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteSparkEngineApplication(deleteSparkEngineApplicationOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + }) + It(`Invoke DeleteSparkEngineApplication with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) - // Enable retries and test again - watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) + // Construct an instance of the DeleteSparkEngineApplicationOptions model + deleteSparkEngineApplicationOptionsModel := new(watsonxdatav3.DeleteSparkEngineApplicationOptions) + deleteSparkEngineApplicationOptionsModel.EngineID = core.StringPtr("testString") + deleteSparkEngineApplicationOptionsModel.ID = core.StringPtr("testString") + deleteSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteSparkEngineApplication(deleteSparkEngineApplicationOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSparkEngineApplicationOptions model with no property values + deleteSparkEngineApplicationOptionsModelNew := new(watsonxdatav3.DeleteSparkEngineApplicationOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteSparkEngineApplication(deleteSparkEngineApplicationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetSalIntegration(getSalIntegrationOptions *GetSalIntegrationOptions)`, func() { - getSalIntegrationPath := "/sal_integrations" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "governance_scope_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "governance_scope_type": "category", "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "timestamp": "1715056266", "trial_plan": false, "username": "xyz@abc.com"}`) - })) - }) - It(`Invoke GetSalIntegration successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - watsonxDataService.EnableRetries(0, 0) - - // Construct an instance of the GetSalIntegrationOptions model - getSalIntegrationOptionsModel := new(watsonxdatav2.GetSalIntegrationOptions) - getSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSalIntegrationWithContext(ctx, getSalIntegrationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSalIntegrationWithContext(ctx, getSalIntegrationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - }) - AfterEach(func() { - testServer.Close() - }) - }) + Describe(`GetSparkEngineApplicationUi(getSparkEngineApplicationUiOptions *GetSparkEngineApplicationUiOptions)`, func() { + getSparkEngineApplicationUiPath := "/v3/spark_engines/testString/applications/testString/ui" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineApplicationUiPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Set mock response - res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "governance_scope_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "governance_scope_type": "category", "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "timestamp": "1715056266", "trial_plan": false, "username": "xyz@abc.com"}`) })) }) - It(`Invoke GetSalIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineApplicationUi successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -17647,126 +18684,105 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSalIntegration(nil) + response, operationErr := watsonxDataService.GetSparkEngineApplicationUi(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct an instance of the GetSalIntegrationOptions model - getSalIntegrationOptionsModel := new(watsonxdatav2.GetSalIntegrationOptions) - getSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineApplicationUiOptions model + getSparkEngineApplicationUiOptionsModel := new(watsonxdatav3.GetSparkEngineApplicationUiOptions) + getSparkEngineApplicationUiOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineApplicationUiOptionsModel.ID = core.StringPtr("testString") + getSparkEngineApplicationUiOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineApplicationUiOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) + response, operationErr = watsonxDataService.GetSparkEngineApplicationUi(getSparkEngineApplicationUiOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - }) - It(`Invoke GetSalIntegration with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineApplicationUi with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationOptions model - getSalIntegrationOptionsModel := new(watsonxdatav2.GetSalIntegrationOptions) - getSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineApplicationUiOptions model + getSparkEngineApplicationUiOptionsModel := new(watsonxdatav3.GetSparkEngineApplicationUiOptions) + getSparkEngineApplicationUiOptionsModel.EngineID = core.StringPtr("testString") + getSparkEngineApplicationUiOptionsModel.ID = core.StringPtr("testString") + getSparkEngineApplicationUiOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineApplicationUiOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) + response, operationErr := watsonxDataService.GetSparkEngineApplicationUi(getSparkEngineApplicationUiOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke GetSalIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the GetSalIntegrationOptions model - getSalIntegrationOptionsModel := new(watsonxdatav2.GetSalIntegrationOptions) - getSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) + // Construct a second instance of the GetSparkEngineApplicationUiOptions model with no property values + getSparkEngineApplicationUiOptionsModelNew := new(watsonxdatav3.GetSparkEngineApplicationUiOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.GetSparkEngineApplicationUi(getSparkEngineApplicationUiOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`CreateSalIntegration(createSalIntegrationOptions *CreateSalIntegrationOptions) - Operation response error`, func() { - createSalIntegrationPath := "/sal_integrations" + Describe(`ListSparkEngineApplications(listSparkEngineApplicationsOptions *ListSparkEngineApplicationsOptions) - Operation response error`, func() { + listSparkEngineApplicationsPath := "/v3/spark_engines/testString/applications" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineApplicationsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["submission_time_interval"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start_time_interval"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["end_time_interval"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSalIntegration with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngineApplications with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSalIntegrationOptions model - createSalIntegrationOptionsModel := new(watsonxdatav2.CreateSalIntegrationOptions) - createSalIntegrationOptionsModel.Apikey = core.StringPtr("12efd3raq") - createSalIntegrationOptionsModel.EngineID = core.StringPtr("presto-01") - createSalIntegrationOptionsModel.StorageResourceCrn = core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161") - createSalIntegrationOptionsModel.StorageType = core.StringPtr("bmcos_object_storage") - createSalIntegrationOptionsModel.TrialPlan = core.BoolPtr(true) - createSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSparkEngineApplicationsOptions model + listSparkEngineApplicationsOptionsModel := new(watsonxdatav3.ListSparkEngineApplicationsOptions) + listSparkEngineApplicationsOptionsModel.ID = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.State = []string{"testString"} + listSparkEngineApplicationsOptionsModel.SubmissionTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.StartTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.EndTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSparkEngineApplicationsOptionsModel.Start = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) + result, response, operationErr = watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -17776,46 +18792,35 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSalIntegration(createSalIntegrationOptions *CreateSalIntegrationOptions)`, func() { - createSalIntegrationPath := "/sal_integrations" + Describe(`ListSparkEngineApplications(listSparkEngineApplicationsOptions *ListSparkEngineApplicationsOptions)`, func() { + listSparkEngineApplicationsPath := "/v3/spark_engines/testString/applications" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineApplicationsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["submission_time_interval"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start_time_interval"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["end_time_interval"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "governance_scope_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "governance_scope_type": "category", "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "timestamp": "1715056266", "trial_plan": false, "username": "xyz@abc.com"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"applications": [{"auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "Saturday 28 October 2023 07:17:26.649+0000", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "idempotency_key": "IdempotencyKey", "init_scripts": ["file://init_scripts/test.sh"], "max_retries": "3", "min_retry_interval_in_seconds": "30", "retry_attempt": "2", "runtime": {"spark_version": "3.4"}, "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_ui": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui", "spark_version": "3.4", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "timeout_in_seconds": "60", "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}], "first": {"href": "https://example.com/v1/applications?limit=100"}, "limit": 100, "next": {"href": "https://example.com/v1/applications?limit=100"}}`) })) }) - It(`Invoke CreateSalIntegration successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngineApplications successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -17823,26 +18828,28 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateSalIntegrationOptions model - createSalIntegrationOptionsModel := new(watsonxdatav2.CreateSalIntegrationOptions) - createSalIntegrationOptionsModel.Apikey = core.StringPtr("12efd3raq") - createSalIntegrationOptionsModel.EngineID = core.StringPtr("presto-01") - createSalIntegrationOptionsModel.StorageResourceCrn = core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161") - createSalIntegrationOptionsModel.StorageType = core.StringPtr("bmcos_object_storage") - createSalIntegrationOptionsModel.TrialPlan = core.BoolPtr(true) - createSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSparkEngineApplicationsOptions model + listSparkEngineApplicationsOptionsModel := new(watsonxdatav3.ListSparkEngineApplicationsOptions) + listSparkEngineApplicationsOptionsModel.ID = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.State = []string{"testString"} + listSparkEngineApplicationsOptionsModel.SubmissionTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.StartTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.EndTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSparkEngineApplicationsOptionsModel.Start = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateSalIntegrationWithContext(ctx, createSalIntegrationOptionsModel) + _, _, operationErr := watsonxDataService.ListSparkEngineApplicationsWithContext(ctx, listSparkEngineApplicationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -17850,7 +18857,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateSalIntegrationWithContext(ctx, createSalIntegrationOptionsModel) + _, _, operationErr = watsonxDataService.ListSparkEngineApplicationsWithContext(ctx, listSparkEngineApplicationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -17864,35 +18871,24 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineApplicationsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["submission_time_interval"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["start_time_interval"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["end_time_interval"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "governance_scope_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "governance_scope_type": "category", "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "timestamp": "1715056266", "trial_plan": false, "username": "xyz@abc.com"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"applications": [{"auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "Saturday 28 October 2023 07:17:26.649+0000", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "idempotency_key": "IdempotencyKey", "init_scripts": ["file://init_scripts/test.sh"], "max_retries": "3", "min_retry_interval_in_seconds": "30", "retry_attempt": "2", "runtime": {"spark_version": "3.4"}, "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_ui": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui", "spark_version": "3.4", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "timeout_in_seconds": "60", "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}], "first": {"href": "https://example.com/v1/applications?limit=100"}, "limit": 100, "next": {"href": "https://example.com/v1/applications?limit=100"}}`) })) }) - It(`Invoke CreateSalIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngineApplications successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -17900,57 +18896,61 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateSalIntegration(nil) + result, response, operationErr := watsonxDataService.ListSparkEngineApplications(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateSalIntegrationOptions model - createSalIntegrationOptionsModel := new(watsonxdatav2.CreateSalIntegrationOptions) - createSalIntegrationOptionsModel.Apikey = core.StringPtr("12efd3raq") - createSalIntegrationOptionsModel.EngineID = core.StringPtr("presto-01") - createSalIntegrationOptionsModel.StorageResourceCrn = core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161") - createSalIntegrationOptionsModel.StorageType = core.StringPtr("bmcos_object_storage") - createSalIntegrationOptionsModel.TrialPlan = core.BoolPtr(true) - createSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSparkEngineApplicationsOptions model + listSparkEngineApplicationsOptionsModel := new(watsonxdatav3.ListSparkEngineApplicationsOptions) + listSparkEngineApplicationsOptionsModel.ID = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.State = []string{"testString"} + listSparkEngineApplicationsOptionsModel.SubmissionTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.StartTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.EndTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSparkEngineApplicationsOptionsModel.Start = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) + result, response, operationErr = watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSalIntegration with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngineApplications with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSalIntegrationOptions model - createSalIntegrationOptionsModel := new(watsonxdatav2.CreateSalIntegrationOptions) - createSalIntegrationOptionsModel.Apikey = core.StringPtr("12efd3raq") - createSalIntegrationOptionsModel.EngineID = core.StringPtr("presto-01") - createSalIntegrationOptionsModel.StorageResourceCrn = core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161") - createSalIntegrationOptionsModel.StorageType = core.StringPtr("bmcos_object_storage") - createSalIntegrationOptionsModel.TrialPlan = core.BoolPtr(true) - createSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSparkEngineApplicationsOptions model + listSparkEngineApplicationsOptionsModel := new(watsonxdatav3.ListSparkEngineApplicationsOptions) + listSparkEngineApplicationsOptionsModel.ID = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.State = []string{"testString"} + listSparkEngineApplicationsOptionsModel.SubmissionTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.StartTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.EndTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSparkEngineApplicationsOptionsModel.Start = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateSalIntegrationOptions model with no property values - createSalIntegrationOptionsModelNew := new(watsonxdatav2.CreateSalIntegrationOptions) + // Construct a second instance of the ListSparkEngineApplicationsOptions model with no property values + listSparkEngineApplicationsOptionsModelNew := new(watsonxdatav3.ListSparkEngineApplicationsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModelNew) + result, response, operationErr = watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -17965,29 +18965,31 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateSalIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSparkEngineApplications successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSalIntegrationOptions model - createSalIntegrationOptionsModel := new(watsonxdatav2.CreateSalIntegrationOptions) - createSalIntegrationOptionsModel.Apikey = core.StringPtr("12efd3raq") - createSalIntegrationOptionsModel.EngineID = core.StringPtr("presto-01") - createSalIntegrationOptionsModel.StorageResourceCrn = core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161") - createSalIntegrationOptionsModel.StorageType = core.StringPtr("bmcos_object_storage") - createSalIntegrationOptionsModel.TrialPlan = core.BoolPtr(true) - createSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSparkEngineApplicationsOptions model + listSparkEngineApplicationsOptionsModel := new(watsonxdatav3.ListSparkEngineApplicationsOptions) + listSparkEngineApplicationsOptionsModel.ID = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.State = []string{"testString"} + listSparkEngineApplicationsOptionsModel.SubmissionTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.StartTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.EndTimeInterval = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listSparkEngineApplicationsOptionsModel.Start = core.StringPtr("testString") + listSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -17998,77 +19000,128 @@ var _ = Describe(`WatsonxDataV2`, func() { testServer.Close() }) }) - }) - Describe(`DeleteSalIntegration(deleteSalIntegrationOptions *DeleteSalIntegrationOptions)`, func() { - deleteSalIntegrationPath := "/sal_integrations" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(watsonxdatav3.SparkEngineApplicationCollection) + nextObject := new(watsonxdatav3.PaginationLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(watsonxdatav3.SparkEngineApplicationCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(watsonxdatav3.SparkEngineApplicationCollection) + nextObject := new(watsonxdatav3.PaginationLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSalIntegrationPath)) - Expect(req.Method).To(Equal("DELETE")) + Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineApplicationsPath)) + Expect(req.Method).To(Equal("GET")) - res.WriteHeader(204) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"applications":[{"auto_termination_time":"2020-12-08T10:00:00.000Z","creation_time":"Saturday 28 October 2023 07:17:06.856+0000","deploy_mode":"stand-alone","end_time":"2020-12-08T10:00:00.000Z","failed_time":"Saturday 28 October 2023 07:17:26.649+0000","finish_time":"Saturday 28 October 2023 07:17:38.966+0000","id":"cd7cbf1f-8893-4c51-aa3d-d92729f05e99","idempotency_key":"IdempotencyKey","init_scripts":["file://init_scripts/test.sh"],"max_retries":"3","min_retry_interval_in_seconds":"30","retry_attempt":"2","runtime":{"spark_version":"3.4"},"spark_application_id":"app-20231028071726-0000","spark_application_name":"PythonWordCount","spark_ui":"$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui","spark_version":"3.4","start_time":"Saturday 28 October 2023 07:17:26.649+0000","state":"FINISHED","state_details":[{"code":"Code","message":"Message","type":"Type"}],"submission_time":"2023-11-01T11:18:49.758Z","template_id":"spark-3.3-jaas-v2-cp4d-template","timeout_in_seconds":"60","wxd_application_ui_endpoint":"$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}]}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"applications":[{"auto_termination_time":"2020-12-08T10:00:00.000Z","creation_time":"Saturday 28 October 2023 07:17:06.856+0000","deploy_mode":"stand-alone","end_time":"2020-12-08T10:00:00.000Z","failed_time":"Saturday 28 October 2023 07:17:26.649+0000","finish_time":"Saturday 28 October 2023 07:17:38.966+0000","id":"cd7cbf1f-8893-4c51-aa3d-d92729f05e99","idempotency_key":"IdempotencyKey","init_scripts":["file://init_scripts/test.sh"],"max_retries":"3","min_retry_interval_in_seconds":"30","retry_attempt":"2","runtime":{"spark_version":"3.4"},"spark_application_id":"app-20231028071726-0000","spark_application_name":"PythonWordCount","spark_ui":"$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui","spark_version":"3.4","start_time":"Saturday 28 October 2023 07:17:26.649+0000","state":"FINISHED","state_details":[{"code":"Code","message":"Message","type":"Type"}],"submission_time":"2023-11-01T11:18:49.758Z","template_id":"spark-3.3-jaas-v2-cp4d-template","timeout_in_seconds":"60","wxd_application_ui_endpoint":"$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}]}`) + } else { + res.WriteHeader(400) + } })) }) - It(`Invoke DeleteSalIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Use SparkEngineApplicationsPager.GetNext successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteSalIntegration(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) + listSparkEngineApplicationsOptionsModel := &watsonxdatav3.ListSparkEngineApplicationsOptions{ + ID: core.StringPtr("testString"), + AuthInstanceID: core.StringPtr("testString"), + State: []string{"testString"}, + SubmissionTimeInterval: core.StringPtr("testString"), + StartTimeInterval: core.StringPtr("testString"), + EndTimeInterval: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } - // Construct an instance of the DeleteSalIntegrationOptions model - deleteSalIntegrationOptionsModel := new(watsonxdatav2.DeleteSalIntegrationOptions) - deleteSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + pager, err := watsonxDataService.NewSparkEngineApplicationsPager(listSparkEngineApplicationsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteSalIntegration(deleteSalIntegrationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + var allResults []watsonxdatav3.SparkEngineApplicationSummary + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) }) - It(`Invoke DeleteSalIntegration with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Use SparkEngineApplicationsPager.GetAll successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DeleteSalIntegrationOptions model - deleteSalIntegrationOptionsModel := new(watsonxdatav2.DeleteSalIntegrationOptions) - deleteSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") + listSparkEngineApplicationsOptionsModel := &watsonxdatav3.ListSparkEngineApplicationsOptions{ + ID: core.StringPtr("testString"), + AuthInstanceID: core.StringPtr("testString"), + State: []string{"testString"}, + SubmissionTimeInterval: core.StringPtr("testString"), + StartTimeInterval: core.StringPtr("testString"), + EndTimeInterval: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := watsonxDataService.NewSparkEngineApplicationsPager(listSparkEngineApplicationsOptionsModel) Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteSalIntegration(deleteSalIntegrationOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) }) }) }) - Describe(`UpdateSalIntegration(updateSalIntegrationOptions *UpdateSalIntegrationOptions) - Operation response error`, func() { - updateSalIntegrationPath := "/sal_integrations" + Describe(`CreateSparkEngineApplication(createSparkEngineApplicationOptions *CreateSparkEngineApplicationOptions) - Operation response error`, func() { + createSparkEngineApplicationPath := "/v3/spark_engines/testString/applications" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSalIntegrationPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineApplicationPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -18076,36 +19129,73 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateSalIntegration with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngineApplication with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SalIntegrationPatch model - salIntegrationPatchModel := new(watsonxdatav2.SalIntegrationPatch) - salIntegrationPatchModel.Op = core.StringPtr("add") - salIntegrationPatchModel.Path = core.StringPtr("storage") - salIntegrationPatchModel.Value = core.StringPtr("new-apikey") - salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the SparkApplicationRuntime model + sparkApplicationRuntimeModel := new(watsonxdatav3.SparkApplicationRuntime) + sparkApplicationRuntimeModel.SparkVersion = core.StringPtr("3.4") - // Construct an instance of the UpdateSalIntegrationOptions model - updateSalIntegrationOptionsModel := new(watsonxdatav2.UpdateSalIntegrationOptions) - updateSalIntegrationOptionsModel.Body = salIntegrationPatchModelAsPatch - updateSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SparkApplicationDetails model + sparkApplicationDetailsModel := new(watsonxdatav3.SparkApplicationDetails) + sparkApplicationDetailsModel.Application = core.StringPtr("s3://mybucket/wordcount.py") + sparkApplicationDetailsModel.Archives = core.StringPtr("s3://mybucket/myarchive.zip") + sparkApplicationDetailsModel.Arguments = []string{"people.txt"} + sparkApplicationDetailsModel.Class = core.StringPtr("org.apache.spark.examples.SparkPi") + sparkApplicationDetailsModel.Conf = map[string]string{"key1": "configuration"} + sparkApplicationDetailsModel.Env = map[string]string{"key1": "configuration"} + sparkApplicationDetailsModel.Files = core.StringPtr("s3://mybucket/myfile.txt") + sparkApplicationDetailsModel.Jars = core.StringPtr("testString") + sparkApplicationDetailsModel.Name = core.StringPtr("SparkApplicaton1") + sparkApplicationDetailsModel.Packages = core.StringPtr("org.apache.spark:example_1.2.3") + sparkApplicationDetailsModel.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") + sparkApplicationDetailsModel.Runtime = sparkApplicationRuntimeModel + sparkApplicationDetailsModel.SparkVersion = core.StringPtr("3.3") + + // Construct an instance of the SparkEngineApplicationCallback model + sparkEngineApplicationCallbackModel := new(watsonxdatav3.SparkEngineApplicationCallback) + sparkEngineApplicationCallbackModel.URL = core.StringPtr("testString") + + // Construct an instance of the SparkVolumeDetails model + sparkVolumeDetailsModel := new(watsonxdatav3.SparkVolumeDetails) + sparkVolumeDetailsModel.MountPath = core.StringPtr("/mount/path") + sparkVolumeDetailsModel.Name = core.StringPtr("my-volume") + sparkVolumeDetailsModel.ReadOnly = core.BoolPtr(true) + sparkVolumeDetailsModel.SourceSubPath = core.StringPtr("/source/path") + + // Construct an instance of the CreateSparkEngineApplicationOptions model + createSparkEngineApplicationOptionsModel := new(watsonxdatav3.CreateSparkEngineApplicationOptions) + createSparkEngineApplicationOptionsModel.ID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.ApplicationDetails = sparkApplicationDetailsModel + createSparkEngineApplicationOptionsModel.Callback = sparkEngineApplicationCallbackModel + createSparkEngineApplicationOptionsModel.ContextID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.ContextType = core.StringPtr("project") + createSparkEngineApplicationOptionsModel.DeployMode = core.StringPtr("local") + createSparkEngineApplicationOptionsModel.IdempotencyKey = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.InitScripts = []string{"file://init_scripts/test.sh"} + createSparkEngineApplicationOptionsModel.JobEndpoint = core.StringPtr("/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications") + createSparkEngineApplicationOptionsModel.MaxRetries = core.StringPtr("3") + createSparkEngineApplicationOptionsModel.MinRetryIntervalInSeconds = core.StringPtr("30") + createSparkEngineApplicationOptionsModel.ServiceInstanceID = core.StringPtr("iae") + createSparkEngineApplicationOptionsModel.TimeoutInSeconds = core.StringPtr("60") + createSparkEngineApplicationOptionsModel.Type = core.StringPtr("spark") + createSparkEngineApplicationOptionsModel.Volumes = []watsonxdatav3.SparkVolumeDetails{*sparkVolumeDetailsModel} + createSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) + result, response, operationErr = watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -18115,16 +19205,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateSalIntegration(updateSalIntegrationOptions *UpdateSalIntegrationOptions)`, func() { - updateSalIntegrationPath := "/sal_integrations" + Describe(`CreateSparkEngineApplication(createSparkEngineApplicationOptions *CreateSparkEngineApplicationOptions)`, func() { + createSparkEngineApplicationPath := "/v3/spark_engines/testString/applications" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSalIntegrationPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineApplicationPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -18150,11 +19240,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "governance_scope_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "governance_scope_type": "category", "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "timestamp": "1715056266", "trial_plan": false, "username": "xyz@abc.com"}`) + fmt.Fprintf(res, "%s", `{"auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "Saturday 28 October 2023 07:17:26.649+0000", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "idempotency_key": "IdempotencyKey", "init_scripts": ["file://init_scripts/test.sh"], "max_retries": "3", "min_retry_interval_in_seconds": "30", "retry_attempt": "2", "runtime": {"spark_version": "3.4"}, "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_ui": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui", "spark_version": "3.4", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "timeout_in_seconds": "60", "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}`) })) }) - It(`Invoke UpdateSalIntegration successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngineApplication successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -18162,30 +19252,67 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the SalIntegrationPatch model - salIntegrationPatchModel := new(watsonxdatav2.SalIntegrationPatch) - salIntegrationPatchModel.Op = core.StringPtr("add") - salIntegrationPatchModel.Path = core.StringPtr("storage") - salIntegrationPatchModel.Value = core.StringPtr("new-apikey") - salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the SparkApplicationRuntime model + sparkApplicationRuntimeModel := new(watsonxdatav3.SparkApplicationRuntime) + sparkApplicationRuntimeModel.SparkVersion = core.StringPtr("3.4") - // Construct an instance of the UpdateSalIntegrationOptions model - updateSalIntegrationOptionsModel := new(watsonxdatav2.UpdateSalIntegrationOptions) - updateSalIntegrationOptionsModel.Body = salIntegrationPatchModelAsPatch - updateSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SparkApplicationDetails model + sparkApplicationDetailsModel := new(watsonxdatav3.SparkApplicationDetails) + sparkApplicationDetailsModel.Application = core.StringPtr("s3://mybucket/wordcount.py") + sparkApplicationDetailsModel.Archives = core.StringPtr("s3://mybucket/myarchive.zip") + sparkApplicationDetailsModel.Arguments = []string{"people.txt"} + sparkApplicationDetailsModel.Class = core.StringPtr("org.apache.spark.examples.SparkPi") + sparkApplicationDetailsModel.Conf = map[string]string{"key1": "configuration"} + sparkApplicationDetailsModel.Env = map[string]string{"key1": "configuration"} + sparkApplicationDetailsModel.Files = core.StringPtr("s3://mybucket/myfile.txt") + sparkApplicationDetailsModel.Jars = core.StringPtr("testString") + sparkApplicationDetailsModel.Name = core.StringPtr("SparkApplicaton1") + sparkApplicationDetailsModel.Packages = core.StringPtr("org.apache.spark:example_1.2.3") + sparkApplicationDetailsModel.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") + sparkApplicationDetailsModel.Runtime = sparkApplicationRuntimeModel + sparkApplicationDetailsModel.SparkVersion = core.StringPtr("3.3") + + // Construct an instance of the SparkEngineApplicationCallback model + sparkEngineApplicationCallbackModel := new(watsonxdatav3.SparkEngineApplicationCallback) + sparkEngineApplicationCallbackModel.URL = core.StringPtr("testString") + + // Construct an instance of the SparkVolumeDetails model + sparkVolumeDetailsModel := new(watsonxdatav3.SparkVolumeDetails) + sparkVolumeDetailsModel.MountPath = core.StringPtr("/mount/path") + sparkVolumeDetailsModel.Name = core.StringPtr("my-volume") + sparkVolumeDetailsModel.ReadOnly = core.BoolPtr(true) + sparkVolumeDetailsModel.SourceSubPath = core.StringPtr("/source/path") + + // Construct an instance of the CreateSparkEngineApplicationOptions model + createSparkEngineApplicationOptionsModel := new(watsonxdatav3.CreateSparkEngineApplicationOptions) + createSparkEngineApplicationOptionsModel.ID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.ApplicationDetails = sparkApplicationDetailsModel + createSparkEngineApplicationOptionsModel.Callback = sparkEngineApplicationCallbackModel + createSparkEngineApplicationOptionsModel.ContextID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.ContextType = core.StringPtr("project") + createSparkEngineApplicationOptionsModel.DeployMode = core.StringPtr("local") + createSparkEngineApplicationOptionsModel.IdempotencyKey = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.InitScripts = []string{"file://init_scripts/test.sh"} + createSparkEngineApplicationOptionsModel.JobEndpoint = core.StringPtr("/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications") + createSparkEngineApplicationOptionsModel.MaxRetries = core.StringPtr("3") + createSparkEngineApplicationOptionsModel.MinRetryIntervalInSeconds = core.StringPtr("30") + createSparkEngineApplicationOptionsModel.ServiceInstanceID = core.StringPtr("iae") + createSparkEngineApplicationOptionsModel.TimeoutInSeconds = core.StringPtr("60") + createSparkEngineApplicationOptionsModel.Type = core.StringPtr("spark") + createSparkEngineApplicationOptionsModel.Volumes = []watsonxdatav3.SparkVolumeDetails{*sparkVolumeDetailsModel} + createSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateSalIntegrationWithContext(ctx, updateSalIntegrationOptionsModel) + _, _, operationErr := watsonxDataService.CreateSparkEngineApplicationWithContext(ctx, createSparkEngineApplicationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -18193,7 +19320,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateSalIntegrationWithContext(ctx, updateSalIntegrationOptionsModel) + _, _, operationErr = watsonxDataService.CreateSparkEngineApplicationWithContext(ctx, createSparkEngineApplicationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -18207,8 +19334,8 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSalIntegrationPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineApplicationPath)) + Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -18231,11 +19358,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "governance_scope_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "governance_scope_type": "category", "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "timestamp": "1715056266", "trial_plan": false, "username": "xyz@abc.com"}`) + fmt.Fprintf(res, "%s", `{"auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "Saturday 28 October 2023 07:17:26.649+0000", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "idempotency_key": "IdempotencyKey", "init_scripts": ["file://init_scripts/test.sh"], "max_retries": "3", "min_retry_interval_in_seconds": "30", "retry_attempt": "2", "runtime": {"spark_version": "3.4"}, "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_ui": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui", "spark_version": "3.4", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "timeout_in_seconds": "60", "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}`) })) }) - It(`Invoke UpdateSalIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngineApplication successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -18243,65 +19370,139 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateSalIntegration(nil) + result, response, operationErr := watsonxDataService.CreateSparkEngineApplication(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SalIntegrationPatch model - salIntegrationPatchModel := new(watsonxdatav2.SalIntegrationPatch) - salIntegrationPatchModel.Op = core.StringPtr("add") - salIntegrationPatchModel.Path = core.StringPtr("storage") - salIntegrationPatchModel.Value = core.StringPtr("new-apikey") - salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the SparkApplicationRuntime model + sparkApplicationRuntimeModel := new(watsonxdatav3.SparkApplicationRuntime) + sparkApplicationRuntimeModel.SparkVersion = core.StringPtr("3.4") - // Construct an instance of the UpdateSalIntegrationOptions model - updateSalIntegrationOptionsModel := new(watsonxdatav2.UpdateSalIntegrationOptions) - updateSalIntegrationOptionsModel.Body = salIntegrationPatchModelAsPatch - updateSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SparkApplicationDetails model + sparkApplicationDetailsModel := new(watsonxdatav3.SparkApplicationDetails) + sparkApplicationDetailsModel.Application = core.StringPtr("s3://mybucket/wordcount.py") + sparkApplicationDetailsModel.Archives = core.StringPtr("s3://mybucket/myarchive.zip") + sparkApplicationDetailsModel.Arguments = []string{"people.txt"} + sparkApplicationDetailsModel.Class = core.StringPtr("org.apache.spark.examples.SparkPi") + sparkApplicationDetailsModel.Conf = map[string]string{"key1": "configuration"} + sparkApplicationDetailsModel.Env = map[string]string{"key1": "configuration"} + sparkApplicationDetailsModel.Files = core.StringPtr("s3://mybucket/myfile.txt") + sparkApplicationDetailsModel.Jars = core.StringPtr("testString") + sparkApplicationDetailsModel.Name = core.StringPtr("SparkApplicaton1") + sparkApplicationDetailsModel.Packages = core.StringPtr("org.apache.spark:example_1.2.3") + sparkApplicationDetailsModel.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") + sparkApplicationDetailsModel.Runtime = sparkApplicationRuntimeModel + sparkApplicationDetailsModel.SparkVersion = core.StringPtr("3.3") + + // Construct an instance of the SparkEngineApplicationCallback model + sparkEngineApplicationCallbackModel := new(watsonxdatav3.SparkEngineApplicationCallback) + sparkEngineApplicationCallbackModel.URL = core.StringPtr("testString") + + // Construct an instance of the SparkVolumeDetails model + sparkVolumeDetailsModel := new(watsonxdatav3.SparkVolumeDetails) + sparkVolumeDetailsModel.MountPath = core.StringPtr("/mount/path") + sparkVolumeDetailsModel.Name = core.StringPtr("my-volume") + sparkVolumeDetailsModel.ReadOnly = core.BoolPtr(true) + sparkVolumeDetailsModel.SourceSubPath = core.StringPtr("/source/path") + + // Construct an instance of the CreateSparkEngineApplicationOptions model + createSparkEngineApplicationOptionsModel := new(watsonxdatav3.CreateSparkEngineApplicationOptions) + createSparkEngineApplicationOptionsModel.ID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.ApplicationDetails = sparkApplicationDetailsModel + createSparkEngineApplicationOptionsModel.Callback = sparkEngineApplicationCallbackModel + createSparkEngineApplicationOptionsModel.ContextID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.ContextType = core.StringPtr("project") + createSparkEngineApplicationOptionsModel.DeployMode = core.StringPtr("local") + createSparkEngineApplicationOptionsModel.IdempotencyKey = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.InitScripts = []string{"file://init_scripts/test.sh"} + createSparkEngineApplicationOptionsModel.JobEndpoint = core.StringPtr("/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications") + createSparkEngineApplicationOptionsModel.MaxRetries = core.StringPtr("3") + createSparkEngineApplicationOptionsModel.MinRetryIntervalInSeconds = core.StringPtr("30") + createSparkEngineApplicationOptionsModel.ServiceInstanceID = core.StringPtr("iae") + createSparkEngineApplicationOptionsModel.TimeoutInSeconds = core.StringPtr("60") + createSparkEngineApplicationOptionsModel.Type = core.StringPtr("spark") + createSparkEngineApplicationOptionsModel.Volumes = []watsonxdatav3.SparkVolumeDetails{*sparkVolumeDetailsModel} + createSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) + result, response, operationErr = watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateSalIntegration with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngineApplication with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SalIntegrationPatch model - salIntegrationPatchModel := new(watsonxdatav2.SalIntegrationPatch) - salIntegrationPatchModel.Op = core.StringPtr("add") - salIntegrationPatchModel.Path = core.StringPtr("storage") - salIntegrationPatchModel.Value = core.StringPtr("new-apikey") - salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the SparkApplicationRuntime model + sparkApplicationRuntimeModel := new(watsonxdatav3.SparkApplicationRuntime) + sparkApplicationRuntimeModel.SparkVersion = core.StringPtr("3.4") - // Construct an instance of the UpdateSalIntegrationOptions model - updateSalIntegrationOptionsModel := new(watsonxdatav2.UpdateSalIntegrationOptions) - updateSalIntegrationOptionsModel.Body = salIntegrationPatchModelAsPatch - updateSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SparkApplicationDetails model + sparkApplicationDetailsModel := new(watsonxdatav3.SparkApplicationDetails) + sparkApplicationDetailsModel.Application = core.StringPtr("s3://mybucket/wordcount.py") + sparkApplicationDetailsModel.Archives = core.StringPtr("s3://mybucket/myarchive.zip") + sparkApplicationDetailsModel.Arguments = []string{"people.txt"} + sparkApplicationDetailsModel.Class = core.StringPtr("org.apache.spark.examples.SparkPi") + sparkApplicationDetailsModel.Conf = map[string]string{"key1": "configuration"} + sparkApplicationDetailsModel.Env = map[string]string{"key1": "configuration"} + sparkApplicationDetailsModel.Files = core.StringPtr("s3://mybucket/myfile.txt") + sparkApplicationDetailsModel.Jars = core.StringPtr("testString") + sparkApplicationDetailsModel.Name = core.StringPtr("SparkApplicaton1") + sparkApplicationDetailsModel.Packages = core.StringPtr("org.apache.spark:example_1.2.3") + sparkApplicationDetailsModel.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") + sparkApplicationDetailsModel.Runtime = sparkApplicationRuntimeModel + sparkApplicationDetailsModel.SparkVersion = core.StringPtr("3.3") + + // Construct an instance of the SparkEngineApplicationCallback model + sparkEngineApplicationCallbackModel := new(watsonxdatav3.SparkEngineApplicationCallback) + sparkEngineApplicationCallbackModel.URL = core.StringPtr("testString") + + // Construct an instance of the SparkVolumeDetails model + sparkVolumeDetailsModel := new(watsonxdatav3.SparkVolumeDetails) + sparkVolumeDetailsModel.MountPath = core.StringPtr("/mount/path") + sparkVolumeDetailsModel.Name = core.StringPtr("my-volume") + sparkVolumeDetailsModel.ReadOnly = core.BoolPtr(true) + sparkVolumeDetailsModel.SourceSubPath = core.StringPtr("/source/path") + + // Construct an instance of the CreateSparkEngineApplicationOptions model + createSparkEngineApplicationOptionsModel := new(watsonxdatav3.CreateSparkEngineApplicationOptions) + createSparkEngineApplicationOptionsModel.ID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.ApplicationDetails = sparkApplicationDetailsModel + createSparkEngineApplicationOptionsModel.Callback = sparkEngineApplicationCallbackModel + createSparkEngineApplicationOptionsModel.ContextID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.ContextType = core.StringPtr("project") + createSparkEngineApplicationOptionsModel.DeployMode = core.StringPtr("local") + createSparkEngineApplicationOptionsModel.IdempotencyKey = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.InitScripts = []string{"file://init_scripts/test.sh"} + createSparkEngineApplicationOptionsModel.JobEndpoint = core.StringPtr("/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications") + createSparkEngineApplicationOptionsModel.MaxRetries = core.StringPtr("3") + createSparkEngineApplicationOptionsModel.MinRetryIntervalInSeconds = core.StringPtr("30") + createSparkEngineApplicationOptionsModel.ServiceInstanceID = core.StringPtr("iae") + createSparkEngineApplicationOptionsModel.TimeoutInSeconds = core.StringPtr("60") + createSparkEngineApplicationOptionsModel.Type = core.StringPtr("spark") + createSparkEngineApplicationOptionsModel.Volumes = []watsonxdatav3.SparkVolumeDetails{*sparkVolumeDetailsModel} + createSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) + result, response, operationErr := watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateSalIntegrationOptions model with no property values - updateSalIntegrationOptionsModelNew := new(watsonxdatav2.UpdateSalIntegrationOptions) + // Construct a second instance of the CreateSparkEngineApplicationOptions model with no property values + createSparkEngineApplicationOptionsModelNew := new(watsonxdatav3.CreateSparkEngineApplicationOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -18319,177 +19520,117 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateSalIntegration successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSparkEngineApplication successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SalIntegrationPatch model - salIntegrationPatchModel := new(watsonxdatav2.SalIntegrationPatch) - salIntegrationPatchModel.Op = core.StringPtr("add") - salIntegrationPatchModel.Path = core.StringPtr("storage") - salIntegrationPatchModel.Value = core.StringPtr("new-apikey") - salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the SparkApplicationRuntime model + sparkApplicationRuntimeModel := new(watsonxdatav3.SparkApplicationRuntime) + sparkApplicationRuntimeModel.SparkVersion = core.StringPtr("3.4") - // Construct an instance of the UpdateSalIntegrationOptions model - updateSalIntegrationOptionsModel := new(watsonxdatav2.UpdateSalIntegrationOptions) - updateSalIntegrationOptionsModel.Body = salIntegrationPatchModelAsPatch - updateSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SparkApplicationDetails model + sparkApplicationDetailsModel := new(watsonxdatav3.SparkApplicationDetails) + sparkApplicationDetailsModel.Application = core.StringPtr("s3://mybucket/wordcount.py") + sparkApplicationDetailsModel.Archives = core.StringPtr("s3://mybucket/myarchive.zip") + sparkApplicationDetailsModel.Arguments = []string{"people.txt"} + sparkApplicationDetailsModel.Class = core.StringPtr("org.apache.spark.examples.SparkPi") + sparkApplicationDetailsModel.Conf = map[string]string{"key1": "configuration"} + sparkApplicationDetailsModel.Env = map[string]string{"key1": "configuration"} + sparkApplicationDetailsModel.Files = core.StringPtr("s3://mybucket/myfile.txt") + sparkApplicationDetailsModel.Jars = core.StringPtr("testString") + sparkApplicationDetailsModel.Name = core.StringPtr("SparkApplicaton1") + sparkApplicationDetailsModel.Packages = core.StringPtr("org.apache.spark:example_1.2.3") + sparkApplicationDetailsModel.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") + sparkApplicationDetailsModel.Runtime = sparkApplicationRuntimeModel + sparkApplicationDetailsModel.SparkVersion = core.StringPtr("3.3") - // Invoke operation - result, response, operationErr := watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) + // Construct an instance of the SparkEngineApplicationCallback model + sparkEngineApplicationCallbackModel := new(watsonxdatav3.SparkEngineApplicationCallback) + sparkEngineApplicationCallbackModel.URL = core.StringPtr("testString") - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptions *CreateSalIntegrationEnrichmentOptions)`, func() { - createSalIntegrationEnrichmentPath := "/sal_integrations/enrichment" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationEnrichmentPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(204) - })) - }) - It(`Invoke CreateSalIntegrationEnrichment successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.CreateSalIntegrationEnrichment(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the EnrichmentObj model - enrichmentObjModel := new(watsonxdatav2.EnrichmentObj) - enrichmentObjModel.Catalog = core.StringPtr("iceberg_data") - enrichmentObjModel.Operation = core.StringPtr("create") - enrichmentObjModel.Schema = core.StringPtr("testString") - enrichmentObjModel.Tables = []string{"testString"} + // Construct an instance of the SparkVolumeDetails model + sparkVolumeDetailsModel := new(watsonxdatav3.SparkVolumeDetails) + sparkVolumeDetailsModel.MountPath = core.StringPtr("/mount/path") + sparkVolumeDetailsModel.Name = core.StringPtr("my-volume") + sparkVolumeDetailsModel.ReadOnly = core.BoolPtr(true) + sparkVolumeDetailsModel.SourceSubPath = core.StringPtr("/source/path") - // Construct an instance of the CreateSalIntegrationEnrichmentOptions model - createSalIntegrationEnrichmentOptionsModel := new(watsonxdatav2.CreateSalIntegrationEnrichmentOptions) - createSalIntegrationEnrichmentOptionsModel.EnrichmentPrototype = enrichmentObjModel - createSalIntegrationEnrichmentOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationEnrichmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSparkEngineApplicationOptions model + createSparkEngineApplicationOptionsModel := new(watsonxdatav3.CreateSparkEngineApplicationOptions) + createSparkEngineApplicationOptionsModel.ID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.ApplicationDetails = sparkApplicationDetailsModel + createSparkEngineApplicationOptionsModel.Callback = sparkEngineApplicationCallbackModel + createSparkEngineApplicationOptionsModel.ContextID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.ContextType = core.StringPtr("project") + createSparkEngineApplicationOptionsModel.DeployMode = core.StringPtr("local") + createSparkEngineApplicationOptionsModel.IdempotencyKey = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.InitScripts = []string{"file://init_scripts/test.sh"} + createSparkEngineApplicationOptionsModel.JobEndpoint = core.StringPtr("/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications") + createSparkEngineApplicationOptionsModel.MaxRetries = core.StringPtr("3") + createSparkEngineApplicationOptionsModel.MinRetryIntervalInSeconds = core.StringPtr("30") + createSparkEngineApplicationOptionsModel.ServiceInstanceID = core.StringPtr("iae") + createSparkEngineApplicationOptionsModel.TimeoutInSeconds = core.StringPtr("60") + createSparkEngineApplicationOptionsModel.Type = core.StringPtr("spark") + createSparkEngineApplicationOptionsModel.Volumes = []watsonxdatav3.SparkVolumeDetails{*sparkVolumeDetailsModel} + createSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptionsModel) + // Invoke operation + result, response, operationErr := watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - }) - It(`Invoke CreateSalIntegrationEnrichment with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the EnrichmentObj model - enrichmentObjModel := new(watsonxdatav2.EnrichmentObj) - enrichmentObjModel.Catalog = core.StringPtr("iceberg_data") - enrichmentObjModel.Operation = core.StringPtr("create") - enrichmentObjModel.Schema = core.StringPtr("testString") - enrichmentObjModel.Tables = []string{"testString"} - // Construct an instance of the CreateSalIntegrationEnrichmentOptions model - createSalIntegrationEnrichmentOptionsModel := new(watsonxdatav2.CreateSalIntegrationEnrichmentOptions) - createSalIntegrationEnrichmentOptionsModel.EnrichmentPrototype = enrichmentObjModel - createSalIntegrationEnrichmentOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationEnrichmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) + // Verify a nil result + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetSalIntegrationEnrichmentAssets(getSalIntegrationEnrichmentAssetsOptions *GetSalIntegrationEnrichmentAssetsOptions) - Operation response error`, func() { - getSalIntegrationEnrichmentAssetsPath := "/sal_integrations/enrichment_assets" + Describe(`GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptions *GetSparkEngineHistoryServerOptions) - Operation response error`, func() { + getSparkEngineHistoryServerPath := "/v3/spark_engines/testString/history_server" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentAssetsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineHistoryServerPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSalIntegrationEnrichmentAssets with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineHistoryServer with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentAssetsOptions model - getSalIntegrationEnrichmentAssetsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentAssetsOptions) - getSalIntegrationEnrichmentAssetsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineHistoryServerOptions model + getSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.GetSparkEngineHistoryServerOptions) + getSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + getSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssets(getSalIntegrationEnrichmentAssetsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentAssets(getSalIntegrationEnrichmentAssetsOptionsModel) + result, response, operationErr = watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -18499,31 +19640,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationEnrichmentAssets(getSalIntegrationEnrichmentAssetsOptions *GetSalIntegrationEnrichmentAssetsOptions)`, func() { - getSalIntegrationEnrichmentAssetsPath := "/sal_integrations/enrichment_assets" + Describe(`GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptions *GetSparkEngineHistoryServerOptions)`, func() { + getSparkEngineHistoryServerPath := "/v3/spark_engines/testString/history_server" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentAssetsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineHistoryServerPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"enrichment_asset": {"asset_attributes": ["AssetAttributes"], "asset_id": "ee0383b9-dcab-4c1a-b03d-bf521837b6ed", "asset_name": "newtable", "resource_key": "0000:0000:0000:0000:0000:FFFF:9EB0:04E2|31134|:/iceberg_data/new_schema/sampletable", "schema_name": "sampleschema"}}`) + fmt.Fprintf(res, "%s", `{"auto_termination_time": "2022-02-24T07:37:47Z", "cores": "1", "memory": "4G", "start_time": "2022-02-21T07:37:47Z", "state": "started"}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentAssets successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineHistoryServer successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -18531,22 +19671,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSalIntegrationEnrichmentAssetsOptions model - getSalIntegrationEnrichmentAssetsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentAssetsOptions) - getSalIntegrationEnrichmentAssetsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineHistoryServerOptions model + getSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.GetSparkEngineHistoryServerOptions) + getSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + getSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssetsWithContext(ctx, getSalIntegrationEnrichmentAssetsOptionsModel) + _, _, operationErr := watsonxDataService.GetSparkEngineHistoryServerWithContext(ctx, getSparkEngineHistoryServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssets(getSalIntegrationEnrichmentAssetsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -18554,7 +19694,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSalIntegrationEnrichmentAssetsWithContext(ctx, getSalIntegrationEnrichmentAssetsOptionsModel) + _, _, operationErr = watsonxDataService.GetSparkEngineHistoryServerWithContext(ctx, getSparkEngineHistoryServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -18568,20 +19708,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentAssetsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineHistoryServerPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"enrichment_asset": {"asset_attributes": ["AssetAttributes"], "asset_id": "ee0383b9-dcab-4c1a-b03d-bf521837b6ed", "asset_name": "newtable", "resource_key": "0000:0000:0000:0000:0000:FFFF:9EB0:04E2|31134|:/iceberg_data/new_schema/sampletable", "schema_name": "sampleschema"}}`) + fmt.Fprintf(res, "%s", `{"auto_termination_time": "2022-02-24T07:37:47Z", "cores": "1", "memory": "4G", "start_time": "2022-02-21T07:37:47Z", "state": "started"}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentAssets successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineHistoryServer successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -18589,45 +19728,52 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssets(nil) + result, response, operationErr := watsonxDataService.GetSparkEngineHistoryServer(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentAssetsOptions model - getSalIntegrationEnrichmentAssetsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentAssetsOptions) - getSalIntegrationEnrichmentAssetsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineHistoryServerOptions model + getSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.GetSparkEngineHistoryServerOptions) + getSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + getSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentAssets(getSalIntegrationEnrichmentAssetsOptionsModel) + result, response, operationErr = watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSalIntegrationEnrichmentAssets with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineHistoryServer with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentAssetsOptions model - getSalIntegrationEnrichmentAssetsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentAssetsOptions) - getSalIntegrationEnrichmentAssetsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineHistoryServerOptions model + getSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.GetSparkEngineHistoryServerOptions) + getSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + getSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssets(getSalIntegrationEnrichmentAssetsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the GetSparkEngineHistoryServerOptions model with no property values + getSparkEngineHistoryServerOptionsModelNew := new(watsonxdatav3.GetSparkEngineHistoryServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -18642,22 +19788,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSalIntegrationEnrichmentAssets successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineHistoryServer successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentAssetsOptions model - getSalIntegrationEnrichmentAssetsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentAssetsOptions) - getSalIntegrationEnrichmentAssetsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineHistoryServerOptions model + getSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.GetSparkEngineHistoryServerOptions) + getSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + getSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssets(getSalIntegrationEnrichmentAssetsOptionsModel) + result, response, operationErr := watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -18669,48 +19815,47 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationEnrichmentDataAsset(getSalIntegrationEnrichmentDataAssetOptions *GetSalIntegrationEnrichmentDataAssetOptions) - Operation response error`, func() { - getSalIntegrationEnrichmentDataAssetPath := "/sal_integrations/enrichment_data_asset" + Describe(`StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptions *StartSparkEngineHistoryServerOptions) - Operation response error`, func() { + startSparkEngineHistoryServerPath := "/v3/spark_engines/testString/history_server" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentDataAssetPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(startSparkEngineHistoryServerPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["asset_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSalIntegrationEnrichmentDataAsset with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke StartSparkEngineHistoryServer with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentDataAssetOptions model - getSalIntegrationEnrichmentDataAssetOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentDataAssetOptions) - getSalIntegrationEnrichmentDataAssetOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.AssetID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the StartSparkEngineHistoryServerOptions model + startSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.StartSparkEngineHistoryServerOptions) + startSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + startSparkEngineHistoryServerOptionsModel.Cores = core.StringPtr("1") + startSparkEngineHistoryServerOptionsModel.Memory = core.StringPtr("4G") + startSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + startSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentDataAsset(getSalIntegrationEnrichmentDataAssetOptionsModel) + result, response, operationErr := watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentDataAsset(getSalIntegrationEnrichmentDataAssetOptionsModel) + result, response, operationErr = watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -18720,32 +19865,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationEnrichmentDataAsset(getSalIntegrationEnrichmentDataAssetOptions *GetSalIntegrationEnrichmentDataAssetOptions)`, func() { - getSalIntegrationEnrichmentDataAssetPath := "/sal_integrations/enrichment_data_asset" + Describe(`StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptions *StartSparkEngineHistoryServerOptions)`, func() { + startSparkEngineHistoryServerPath := "/v3/spark_engines/testString/history_server" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentDataAssetPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(startSparkEngineHistoryServerPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["asset_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"asset": "{}"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"auto_termination_time": "2022-02-24T07:37:47Z", "cores": "1", "memory": "4G", "start_time": "2022-02-21T07:37:47Z", "state": "started"}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentDataAsset successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke StartSparkEngineHistoryServer successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -18753,23 +19912,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSalIntegrationEnrichmentDataAssetOptions model - getSalIntegrationEnrichmentDataAssetOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentDataAssetOptions) - getSalIntegrationEnrichmentDataAssetOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.AssetID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the StartSparkEngineHistoryServerOptions model + startSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.StartSparkEngineHistoryServerOptions) + startSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + startSparkEngineHistoryServerOptionsModel.Cores = core.StringPtr("1") + startSparkEngineHistoryServerOptionsModel.Memory = core.StringPtr("4G") + startSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + startSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSalIntegrationEnrichmentDataAssetWithContext(ctx, getSalIntegrationEnrichmentDataAssetOptionsModel) + _, _, operationErr := watsonxDataService.StartSparkEngineHistoryServerWithContext(ctx, startSparkEngineHistoryServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentDataAsset(getSalIntegrationEnrichmentDataAssetOptionsModel) + result, response, operationErr := watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -18777,7 +19937,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSalIntegrationEnrichmentDataAssetWithContext(ctx, getSalIntegrationEnrichmentDataAssetOptionsModel) + _, _, operationErr = watsonxDataService.StartSparkEngineHistoryServerWithContext(ctx, startSparkEngineHistoryServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -18791,21 +19951,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentDataAssetPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(startSparkEngineHistoryServerPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["asset_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"asset": "{}"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"auto_termination_time": "2022-02-24T07:37:47Z", "cores": "1", "memory": "4G", "start_time": "2022-02-21T07:37:47Z", "state": "started"}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentDataAsset successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke StartSparkEngineHistoryServer successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -18813,47 +19987,56 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentDataAsset(nil) + result, response, operationErr := watsonxDataService.StartSparkEngineHistoryServer(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentDataAssetOptions model - getSalIntegrationEnrichmentDataAssetOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentDataAssetOptions) - getSalIntegrationEnrichmentDataAssetOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.AssetID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the StartSparkEngineHistoryServerOptions model + startSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.StartSparkEngineHistoryServerOptions) + startSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + startSparkEngineHistoryServerOptionsModel.Cores = core.StringPtr("1") + startSparkEngineHistoryServerOptionsModel.Memory = core.StringPtr("4G") + startSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + startSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentDataAsset(getSalIntegrationEnrichmentDataAssetOptionsModel) + result, response, operationErr = watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSalIntegrationEnrichmentDataAsset with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke StartSparkEngineHistoryServer with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentDataAssetOptions model - getSalIntegrationEnrichmentDataAssetOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentDataAssetOptions) - getSalIntegrationEnrichmentDataAssetOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.AssetID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the StartSparkEngineHistoryServerOptions model + startSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.StartSparkEngineHistoryServerOptions) + startSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + startSparkEngineHistoryServerOptionsModel.Cores = core.StringPtr("1") + startSparkEngineHistoryServerOptionsModel.Memory = core.StringPtr("4G") + startSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + startSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentDataAsset(getSalIntegrationEnrichmentDataAssetOptionsModel) + result, response, operationErr := watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the StartSparkEngineHistoryServerOptions model with no property values + startSparkEngineHistoryServerOptionsModelNew := new(watsonxdatav3.StartSparkEngineHistoryServerOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -18865,26 +20048,27 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetSalIntegrationEnrichmentDataAsset successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke StartSparkEngineHistoryServer successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentDataAssetOptions model - getSalIntegrationEnrichmentDataAssetOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentDataAssetOptions) - getSalIntegrationEnrichmentDataAssetOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.AssetID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the StartSparkEngineHistoryServerOptions model + startSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.StartSparkEngineHistoryServerOptions) + startSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + startSparkEngineHistoryServerOptionsModel.Cores = core.StringPtr("1") + startSparkEngineHistoryServerOptionsModel.Memory = core.StringPtr("4G") + startSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + startSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentDataAsset(getSalIntegrationEnrichmentDataAssetOptionsModel) + result, response, operationErr := watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -18896,148 +20080,96 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptions *GetSalIntegrationEnrichmentJobRunLogsOptions) - Operation response error`, func() { - getSalIntegrationEnrichmentJobRunLogsPath := "/sal_integrations/enrichment_job_run_logs" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptions *DeleteSparkEngineHistoryServerOptions)`, func() { + deleteSparkEngineHistoryServerPath := "/v3/spark_engines/testString/history_server" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobRunLogsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSparkEngineHistoryServerPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["job_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["job_run_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(204) })) }) - It(`Invoke GetSalIntegrationEnrichmentJobRunLogs with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSparkEngineHistoryServer successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model - getSalIntegrationEnrichmentJobRunLogsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobRunLogsOptions) - getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobRunID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - - // Enable retries and test again - watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptions *GetSalIntegrationEnrichmentJobRunLogsOptions)`, func() { - getSalIntegrationEnrichmentJobRunLogsPath := "/sal_integrations/enrichment_job_run_logs" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobRunLogsPath)) - Expect(req.Method).To(Equal("GET")) + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteSparkEngineHistoryServer(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["job_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["job_run_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) + // Construct an instance of the DeleteSparkEngineHistoryServerOptions model + deleteSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.DeleteSparkEngineHistoryServerOptions) + deleteSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + deleteSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"results": ["Results"], "total_count": 12}`) - })) + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) }) - It(`Invoke GetSalIntegrationEnrichmentJobRunLogs successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSparkEngineHistoryServer with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - watsonxDataService.EnableRetries(0, 0) - - // Construct an instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model - getSalIntegrationEnrichmentJobRunLogsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobRunLogsOptions) - getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobRunID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogsWithContext(ctx, getSalIntegrationEnrichmentJobRunLogsOptionsModel) + // Construct an instance of the DeleteSparkEngineHistoryServerOptions model + deleteSparkEngineHistoryServerOptionsModel := new(watsonxdatav3.DeleteSparkEngineHistoryServerOptions) + deleteSparkEngineHistoryServerOptionsModel.ID = core.StringPtr("testString") + deleteSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) - - // Disable retries and test again - watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobRunLogsWithContext(ctx, getSalIntegrationEnrichmentJobRunLogsOptionsModel) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSparkEngineHistoryServerOptions model with no property values + deleteSparkEngineHistoryServerOptionsModelNew := new(watsonxdatav3.DeleteSparkEngineHistoryServerOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptionsModelNew) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) + }) + Describe(`GetSparkEngineHistoryServerUi(getSparkEngineHistoryServerUiOptions *GetSparkEngineHistoryServerUiOptions)`, func() { + getSparkEngineHistoryServerUiPath := "/v3/spark_engines/testString/history_server/ui" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobRunLogsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineHistoryServerUiPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["job_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["job_run_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) - // Set mock response - res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"results": ["Results"], "total_count": 12}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentJobRunLogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineHistoryServerUi successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -19045,134 +20177,104 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(nil) + response, operationErr := watsonxDataService.GetSparkEngineHistoryServerUi(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model - getSalIntegrationEnrichmentJobRunLogsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobRunLogsOptions) - getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobRunID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineHistoryServerUiOptions model + getSparkEngineHistoryServerUiOptionsModel := new(watsonxdatav3.GetSparkEngineHistoryServerUiOptions) + getSparkEngineHistoryServerUiOptionsModel.ID = core.StringPtr("testString") + getSparkEngineHistoryServerUiOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineHistoryServerUiOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) + response, operationErr = watsonxDataService.GetSparkEngineHistoryServerUi(getSparkEngineHistoryServerUiOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - }) - It(`Invoke GetSalIntegrationEnrichmentJobRunLogs with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSparkEngineHistoryServerUi with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model - getSalIntegrationEnrichmentJobRunLogsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobRunLogsOptions) - getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobRunID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSparkEngineHistoryServerUiOptions model + getSparkEngineHistoryServerUiOptionsModel := new(watsonxdatav3.GetSparkEngineHistoryServerUiOptions) + getSparkEngineHistoryServerUiOptionsModel.ID = core.StringPtr("testString") + getSparkEngineHistoryServerUiOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSparkEngineHistoryServerUiOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) + response, operationErr := watsonxDataService.GetSparkEngineHistoryServerUi(getSparkEngineHistoryServerUiOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(200) - })) - }) - It(`Invoke GetSalIntegrationEnrichmentJobRunLogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model - getSalIntegrationEnrichmentJobRunLogsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobRunLogsOptions) - getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobRunID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) + // Construct a second instance of the GetSparkEngineHistoryServerUiOptions model with no property values + getSparkEngineHistoryServerUiOptionsModelNew := new(watsonxdatav3.GetSparkEngineHistoryServerUiOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.GetSparkEngineHistoryServerUi(getSparkEngineHistoryServerUiOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetSalIntegrationEnrichmentJobRuns(getSalIntegrationEnrichmentJobRunsOptions *GetSalIntegrationEnrichmentJobRunsOptions) - Operation response error`, func() { - getSalIntegrationEnrichmentJobRunsPath := "/sal_integrations/enrichment_job_runs" + Describe(`ValidateIntegration(validateIntegrationOptions *ValidateIntegrationOptions) - Operation response error`, func() { + validateIntegrationPath := "/v3/integration_validation" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobRunsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(validateIntegrationPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["job_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSalIntegrationEnrichmentJobRuns with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ValidateIntegration with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentJobRunsOptions model - getSalIntegrationEnrichmentJobRunsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobRunsOptions) - getSalIntegrationEnrichmentJobRunsOptionsModel.JobID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the ValidateIntegrationOptions model + validateIntegrationOptionsModel := new(watsonxdatav3.ValidateIntegrationOptions) + validateIntegrationOptionsModel.Type = core.StringPtr("ranger") + validateIntegrationOptionsModel.AccessToken = core.StringPtr("Header.Payload.Signature") + validateIntegrationOptionsModel.Apikey = core.StringPtr("apikey") + validateIntegrationOptionsModel.Catalogs = catalogsModel + validateIntegrationOptionsModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + validateIntegrationOptionsModel.Password = core.StringPtr("password") + validateIntegrationOptionsModel.Ssl = core.BoolPtr(true) + validateIntegrationOptionsModel.URL = core.StringPtr("https://www.abcd.com") + validateIntegrationOptionsModel.Username = core.StringPtr("username") + validateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + validateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRuns(getSalIntegrationEnrichmentJobRunsOptionsModel) + result, response, operationErr := watsonxDataService.ValidateIntegration(validateIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobRuns(getSalIntegrationEnrichmentJobRunsOptionsModel) + result, response, operationErr = watsonxDataService.ValidateIntegration(validateIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -19182,32 +20284,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationEnrichmentJobRuns(getSalIntegrationEnrichmentJobRunsOptions *GetSalIntegrationEnrichmentJobRunsOptions)`, func() { - getSalIntegrationEnrichmentJobRunsPath := "/sal_integrations/enrichment_job_runs" + Describe(`ValidateIntegration(validateIntegrationOptions *ValidateIntegrationOptions)`, func() { + validateIntegrationPath := "/v3/integration_validation" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobRunsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(validateIntegrationPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["job_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": "{}"}`) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode", "ranger_details": {"resources": [{"name": "presto01", "type": "presto"}]}}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentJobRuns successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ValidateIntegration successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -19215,23 +20331,34 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSalIntegrationEnrichmentJobRunsOptions model - getSalIntegrationEnrichmentJobRunsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobRunsOptions) - getSalIntegrationEnrichmentJobRunsOptionsModel.JobID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the ValidateIntegrationOptions model + validateIntegrationOptionsModel := new(watsonxdatav3.ValidateIntegrationOptions) + validateIntegrationOptionsModel.Type = core.StringPtr("ranger") + validateIntegrationOptionsModel.AccessToken = core.StringPtr("Header.Payload.Signature") + validateIntegrationOptionsModel.Apikey = core.StringPtr("apikey") + validateIntegrationOptionsModel.Catalogs = catalogsModel + validateIntegrationOptionsModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + validateIntegrationOptionsModel.Password = core.StringPtr("password") + validateIntegrationOptionsModel.Ssl = core.BoolPtr(true) + validateIntegrationOptionsModel.URL = core.StringPtr("https://www.abcd.com") + validateIntegrationOptionsModel.Username = core.StringPtr("username") + validateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + validateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunsWithContext(ctx, getSalIntegrationEnrichmentJobRunsOptionsModel) + _, _, operationErr := watsonxDataService.ValidateIntegrationWithContext(ctx, validateIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRuns(getSalIntegrationEnrichmentJobRunsOptionsModel) + result, response, operationErr := watsonxDataService.ValidateIntegration(validateIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -19239,7 +20366,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobRunsWithContext(ctx, getSalIntegrationEnrichmentJobRunsOptionsModel) + _, _, operationErr = watsonxDataService.ValidateIntegrationWithContext(ctx, validateIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -19253,21 +20380,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobRunsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(validateIntegrationPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["job_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": "{}"}`) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode", "ranger_details": {"resources": [{"name": "presto01", "type": "presto"}]}}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentJobRuns successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ValidateIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -19275,47 +20416,76 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRuns(nil) + result, response, operationErr := watsonxDataService.ValidateIntegration(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentJobRunsOptions model - getSalIntegrationEnrichmentJobRunsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobRunsOptions) - getSalIntegrationEnrichmentJobRunsOptionsModel.JobID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the ValidateIntegrationOptions model + validateIntegrationOptionsModel := new(watsonxdatav3.ValidateIntegrationOptions) + validateIntegrationOptionsModel.Type = core.StringPtr("ranger") + validateIntegrationOptionsModel.AccessToken = core.StringPtr("Header.Payload.Signature") + validateIntegrationOptionsModel.Apikey = core.StringPtr("apikey") + validateIntegrationOptionsModel.Catalogs = catalogsModel + validateIntegrationOptionsModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + validateIntegrationOptionsModel.Password = core.StringPtr("password") + validateIntegrationOptionsModel.Ssl = core.BoolPtr(true) + validateIntegrationOptionsModel.URL = core.StringPtr("https://www.abcd.com") + validateIntegrationOptionsModel.Username = core.StringPtr("username") + validateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + validateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobRuns(getSalIntegrationEnrichmentJobRunsOptionsModel) + result, response, operationErr = watsonxDataService.ValidateIntegration(validateIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSalIntegrationEnrichmentJobRuns with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ValidateIntegration with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentJobRunsOptions model - getSalIntegrationEnrichmentJobRunsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobRunsOptions) - getSalIntegrationEnrichmentJobRunsOptionsModel.JobID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the ValidateIntegrationOptions model + validateIntegrationOptionsModel := new(watsonxdatav3.ValidateIntegrationOptions) + validateIntegrationOptionsModel.Type = core.StringPtr("ranger") + validateIntegrationOptionsModel.AccessToken = core.StringPtr("Header.Payload.Signature") + validateIntegrationOptionsModel.Apikey = core.StringPtr("apikey") + validateIntegrationOptionsModel.Catalogs = catalogsModel + validateIntegrationOptionsModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + validateIntegrationOptionsModel.Password = core.StringPtr("password") + validateIntegrationOptionsModel.Ssl = core.BoolPtr(true) + validateIntegrationOptionsModel.URL = core.StringPtr("https://www.abcd.com") + validateIntegrationOptionsModel.Username = core.StringPtr("username") + validateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + validateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRuns(getSalIntegrationEnrichmentJobRunsOptionsModel) + result, response, operationErr := watsonxDataService.ValidateIntegration(validateIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the ValidateIntegrationOptions model with no property values + validateIntegrationOptionsModelNew := new(watsonxdatav3.ValidateIntegrationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.ValidateIntegration(validateIntegrationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -19330,23 +20500,34 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSalIntegrationEnrichmentJobRuns successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ValidateIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentJobRunsOptions model - getSalIntegrationEnrichmentJobRunsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobRunsOptions) - getSalIntegrationEnrichmentJobRunsOptionsModel.JobID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the ValidateIntegrationOptions model + validateIntegrationOptionsModel := new(watsonxdatav3.ValidateIntegrationOptions) + validateIntegrationOptionsModel.Type = core.StringPtr("ranger") + validateIntegrationOptionsModel.AccessToken = core.StringPtr("Header.Payload.Signature") + validateIntegrationOptionsModel.Apikey = core.StringPtr("apikey") + validateIntegrationOptionsModel.Catalogs = catalogsModel + validateIntegrationOptionsModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + validateIntegrationOptionsModel.Password = core.StringPtr("password") + validateIntegrationOptionsModel.Ssl = core.BoolPtr(true) + validateIntegrationOptionsModel.URL = core.StringPtr("https://www.abcd.com") + validateIntegrationOptionsModel.Username = core.StringPtr("username") + validateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + validateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRuns(getSalIntegrationEnrichmentJobRunsOptionsModel) + result, response, operationErr := watsonxDataService.ValidateIntegration(validateIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -19358,46 +20539,49 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationEnrichmentJobs(getSalIntegrationEnrichmentJobsOptions *GetSalIntegrationEnrichmentJobsOptions) - Operation response error`, func() { - getSalIntegrationEnrichmentJobsPath := "/sal_integrations/enrichment_jobs" + Describe(`ListAllIntegrations(listAllIntegrationsOptions *ListAllIntegrationsOptions) - Operation response error`, func() { + listAllIntegrationsPath := "/v3/integrations" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listAllIntegrationsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["wkc_project_id"]).To(Equal([]string{"testString"})) + Expect(req.Header["Secret"]).ToNot(BeNil()) + Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSalIntegrationEnrichmentJobs with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListAllIntegrations with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentJobsOptions model - getSalIntegrationEnrichmentJobsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobsOptions) - getSalIntegrationEnrichmentJobsOptionsModel.WkcProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListAllIntegrationsOptions model + listAllIntegrationsOptionsModel := new(watsonxdatav3.ListAllIntegrationsOptions) + listAllIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listAllIntegrationsOptionsModel.Secret = core.StringPtr("testString") + listAllIntegrationsOptionsModel.Type = []string{"testString"} + listAllIntegrationsOptionsModel.State = []string{"active"} + listAllIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobs(getSalIntegrationEnrichmentJobsOptionsModel) + result, response, operationErr := watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobs(getSalIntegrationEnrichmentJobsOptionsModel) + result, response, operationErr = watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -19407,31 +20591,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationEnrichmentJobs(getSalIntegrationEnrichmentJobsOptions *GetSalIntegrationEnrichmentJobsOptions)`, func() { - getSalIntegrationEnrichmentJobsPath := "/sal_integrations/enrichment_jobs" + Describe(`ListAllIntegrations(listAllIntegrationsOptions *ListAllIntegrationsOptions)`, func() { + listAllIntegrationsPath := "/v3/integrations" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listAllIntegrationsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["wkc_project_id"]).To(Equal([]string{"testString"})) + Expect(req.Header["Secret"]).ToNot(BeNil()) + Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"jobs": {"results": [{"entity": {"job": {"asset_ref": "8688a3b6-a946-499e-a93c-b7d099db80dd", "asset_ref_type": "metadata_enrichment_area", "configuration": {"env_type": "EnvType", "env_variables": ["EnvVariables"]}, "enable_notifications": false, "future_scheduled_runs": ["FutureScheduledRuns"], "last_run_initiator": "deprecated field", "last_run_status": "deprecated field", "last_run_status_timestamp": 0, "last_run_time": "deprecated field", "project_name": "SAL Mapping /iceberg_data/new_schema 9aae5be3-87cf-4c31-b17d-9256ab42c14e", "schedule_creator_id": "ScheduleCreatorID", "schedule_id": "ScheduleID", "schedule_info": {"frequency": "Frequency"}, "task_credentials_support": {"account_id": "04e9bc4761254b719ac22759cb69bebd", "task_credentials_enabled": true, "user_id": "IBMid-55000832RK"}}}, "metadata": {"asset_id": "ea73ce44-8aa0-4c75-bd69-6ca7074a1030", "name": "SAL_MDE job", "owner_id": "IBMid-55000832RK", "version": 0}}], "total_rows": 1}}`) + fmt.Fprintf(res, "%s", `{"integrations": [{"access_token": "Header.Payload.Signature", "apikey": "apikey", "auth_url": "https://iam.abc.com", "catalogs": {"catalog_names": ["CatalogNames"]}, "certificate": "certificate_content_base64_encoded", "certificate_extension": "pem", "config_properties": "properties", "connection_mode": "external", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "id": "presto01", "ikc_user_account_id": "ikc_user_account_id", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 0, "modified_by": "@.com", "password": "password", "policy_cache_time_configuration": "123456789", "resource": "presto01", "ssl": true, "state": "active", "type": "ranger", "url": "https://www.abcd.com", "username": "username", "zen_apikey": "zen_apikey"}]}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentJobs successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListAllIntegrations successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -19439,22 +20624,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSalIntegrationEnrichmentJobsOptions model - getSalIntegrationEnrichmentJobsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobsOptions) - getSalIntegrationEnrichmentJobsOptionsModel.WkcProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListAllIntegrationsOptions model + listAllIntegrationsOptionsModel := new(watsonxdatav3.ListAllIntegrationsOptions) + listAllIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listAllIntegrationsOptionsModel.Secret = core.StringPtr("testString") + listAllIntegrationsOptionsModel.Type = []string{"testString"} + listAllIntegrationsOptionsModel.State = []string{"active"} + listAllIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobsWithContext(ctx, getSalIntegrationEnrichmentJobsOptionsModel) + _, _, operationErr := watsonxDataService.ListAllIntegrationsWithContext(ctx, listAllIntegrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobs(getSalIntegrationEnrichmentJobsOptionsModel) + result, response, operationErr := watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -19462,7 +20649,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobsWithContext(ctx, getSalIntegrationEnrichmentJobsOptionsModel) + _, _, operationErr = watsonxDataService.ListAllIntegrationsWithContext(ctx, listAllIntegrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -19476,20 +20663,21 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listAllIntegrationsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["wkc_project_id"]).To(Equal([]string{"testString"})) + Expect(req.Header["Secret"]).ToNot(BeNil()) + Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"jobs": {"results": [{"entity": {"job": {"asset_ref": "8688a3b6-a946-499e-a93c-b7d099db80dd", "asset_ref_type": "metadata_enrichment_area", "configuration": {"env_type": "EnvType", "env_variables": ["EnvVariables"]}, "enable_notifications": false, "future_scheduled_runs": ["FutureScheduledRuns"], "last_run_initiator": "deprecated field", "last_run_status": "deprecated field", "last_run_status_timestamp": 0, "last_run_time": "deprecated field", "project_name": "SAL Mapping /iceberg_data/new_schema 9aae5be3-87cf-4c31-b17d-9256ab42c14e", "schedule_creator_id": "ScheduleCreatorID", "schedule_id": "ScheduleID", "schedule_info": {"frequency": "Frequency"}, "task_credentials_support": {"account_id": "04e9bc4761254b719ac22759cb69bebd", "task_credentials_enabled": true, "user_id": "IBMid-55000832RK"}}}, "metadata": {"asset_id": "ea73ce44-8aa0-4c75-bd69-6ca7074a1030", "name": "SAL_MDE job", "owner_id": "IBMid-55000832RK", "version": 0}}], "total_rows": 1}}`) + fmt.Fprintf(res, "%s", `{"integrations": [{"access_token": "Header.Payload.Signature", "apikey": "apikey", "auth_url": "https://iam.abc.com", "catalogs": {"catalog_names": ["CatalogNames"]}, "certificate": "certificate_content_base64_encoded", "certificate_extension": "pem", "config_properties": "properties", "connection_mode": "external", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "id": "presto01", "ikc_user_account_id": "ikc_user_account_id", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 0, "modified_by": "@.com", "password": "password", "policy_cache_time_configuration": "123456789", "resource": "presto01", "ssl": true, "state": "active", "type": "ranger", "url": "https://www.abcd.com", "username": "username", "zen_apikey": "zen_apikey"}]}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentJobs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListAllIntegrations successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -19497,41 +20685,45 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobs(nil) + result, response, operationErr := watsonxDataService.ListAllIntegrations(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentJobsOptions model - getSalIntegrationEnrichmentJobsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobsOptions) - getSalIntegrationEnrichmentJobsOptionsModel.WkcProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListAllIntegrationsOptions model + listAllIntegrationsOptionsModel := new(watsonxdatav3.ListAllIntegrationsOptions) + listAllIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listAllIntegrationsOptionsModel.Secret = core.StringPtr("testString") + listAllIntegrationsOptionsModel.Type = []string{"testString"} + listAllIntegrationsOptionsModel.State = []string{"active"} + listAllIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobs(getSalIntegrationEnrichmentJobsOptionsModel) + result, response, operationErr = watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSalIntegrationEnrichmentJobs with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListAllIntegrations with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentJobsOptions model - getSalIntegrationEnrichmentJobsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobsOptions) - getSalIntegrationEnrichmentJobsOptionsModel.WkcProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListAllIntegrationsOptions model + listAllIntegrationsOptionsModel := new(watsonxdatav3.ListAllIntegrationsOptions) + listAllIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listAllIntegrationsOptionsModel.Secret = core.StringPtr("testString") + listAllIntegrationsOptionsModel.Type = []string{"testString"} + listAllIntegrationsOptionsModel.State = []string{"active"} + listAllIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobs(getSalIntegrationEnrichmentJobsOptionsModel) + result, response, operationErr := watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -19550,22 +20742,24 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSalIntegrationEnrichmentJobs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListAllIntegrations successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentJobsOptions model - getSalIntegrationEnrichmentJobsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentJobsOptions) - getSalIntegrationEnrichmentJobsOptionsModel.WkcProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListAllIntegrationsOptions model + listAllIntegrationsOptionsModel := new(watsonxdatav3.ListAllIntegrationsOptions) + listAllIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listAllIntegrationsOptionsModel.Secret = core.StringPtr("testString") + listAllIntegrationsOptionsModel.Type = []string{"testString"} + listAllIntegrationsOptionsModel.State = []string{"active"} + listAllIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobs(getSalIntegrationEnrichmentJobsOptionsModel) + result, response, operationErr := watsonxDataService.ListAllIntegrations(listAllIntegrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -19577,44 +20771,64 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptions *GetSalIntegrationGlossaryTermsOptions) - Operation response error`, func() { - getSalIntegrationGlossaryTermsPath := "/sal_integrations/glossary_terms" + Describe(`CreateIntegration(createIntegrationOptions *CreateIntegrationOptions) - Operation response error`, func() { + createIntegrationPath := "/v3/integrations" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationGlossaryTermsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createIntegrationPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSalIntegrationGlossaryTerms with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateIntegration with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationGlossaryTermsOptions model - getSalIntegrationGlossaryTermsOptionsModel := new(watsonxdatav2.GetSalIntegrationGlossaryTermsOptions) - getSalIntegrationGlossaryTermsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationGlossaryTermsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the CreateIntegrationOptions model + createIntegrationOptionsModel := new(watsonxdatav3.CreateIntegrationOptions) + createIntegrationOptionsModel.AccessToken = core.StringPtr("Header.Payload.Signature") + createIntegrationOptionsModel.Apikey = core.StringPtr("apikey") + createIntegrationOptionsModel.Catalogs = catalogsModel + createIntegrationOptionsModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + createIntegrationOptionsModel.CertificateExtension = core.StringPtr("pem") + createIntegrationOptionsModel.ConnectionMode = core.StringPtr("external") + createIntegrationOptionsModel.CrossAccountIntegration = core.BoolPtr(false) + createIntegrationOptionsModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) + createIntegrationOptionsModel.IkcUserAccountID = core.StringPtr("ikc_user_account_id") + createIntegrationOptionsModel.Password = core.StringPtr("password") + createIntegrationOptionsModel.PolicyCacheTimeConfiguration = core.StringPtr("123456789") + createIntegrationOptionsModel.Resource = core.StringPtr("presto01") + createIntegrationOptionsModel.Ssl = core.BoolPtr(true) + createIntegrationOptionsModel.Type = core.StringPtr("ranger") + createIntegrationOptionsModel.URL = core.StringPtr("https://abcd.efgh.com") + createIntegrationOptionsModel.Username = core.StringPtr("username") + createIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) + result, response, operationErr := watsonxDataService.CreateIntegration(createIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) + result, response, operationErr = watsonxDataService.CreateIntegration(createIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -19624,16 +20838,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptions *GetSalIntegrationGlossaryTermsOptions)`, func() { - getSalIntegrationGlossaryTermsPath := "/sal_integrations/glossary_terms" + Describe(`CreateIntegration(createIntegrationOptions *CreateIntegrationOptions)`, func() { + createIntegrationPath := "/v3/integrations" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationGlossaryTermsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createIntegrationPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -19642,12 +20872,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"glossary_term": {"description": "First Name", "name": "Name"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"access_token": "Header.Payload.Signature", "apikey": "apikey", "auth_url": "https://iam.abc.com", "catalogs": {"catalog_names": ["CatalogNames"]}, "certificate": "certificate_content_base64_encoded", "certificate_extension": "pem", "config_properties": "properties", "connection_mode": "external", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "id": "presto01", "ikc_user_account_id": "ikc_user_account_id", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 0, "modified_by": "@.com", "password": "password", "policy_cache_time_configuration": "123456789", "resource": "presto01", "ssl": true, "state": "active", "type": "ranger", "url": "https://www.abcd.com", "username": "username", "zen_apikey": "zen_apikey"}`) })) }) - It(`Invoke GetSalIntegrationGlossaryTerms successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateIntegration successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -19655,21 +20885,41 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSalIntegrationGlossaryTermsOptions model - getSalIntegrationGlossaryTermsOptionsModel := new(watsonxdatav2.GetSalIntegrationGlossaryTermsOptions) - getSalIntegrationGlossaryTermsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationGlossaryTermsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the CreateIntegrationOptions model + createIntegrationOptionsModel := new(watsonxdatav3.CreateIntegrationOptions) + createIntegrationOptionsModel.AccessToken = core.StringPtr("Header.Payload.Signature") + createIntegrationOptionsModel.Apikey = core.StringPtr("apikey") + createIntegrationOptionsModel.Catalogs = catalogsModel + createIntegrationOptionsModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + createIntegrationOptionsModel.CertificateExtension = core.StringPtr("pem") + createIntegrationOptionsModel.ConnectionMode = core.StringPtr("external") + createIntegrationOptionsModel.CrossAccountIntegration = core.BoolPtr(false) + createIntegrationOptionsModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) + createIntegrationOptionsModel.IkcUserAccountID = core.StringPtr("ikc_user_account_id") + createIntegrationOptionsModel.Password = core.StringPtr("password") + createIntegrationOptionsModel.PolicyCacheTimeConfiguration = core.StringPtr("123456789") + createIntegrationOptionsModel.Resource = core.StringPtr("presto01") + createIntegrationOptionsModel.Ssl = core.BoolPtr(true) + createIntegrationOptionsModel.Type = core.StringPtr("ranger") + createIntegrationOptionsModel.URL = core.StringPtr("https://abcd.efgh.com") + createIntegrationOptionsModel.Username = core.StringPtr("username") + createIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSalIntegrationGlossaryTermsWithContext(ctx, getSalIntegrationGlossaryTermsOptionsModel) + _, _, operationErr := watsonxDataService.CreateIntegrationWithContext(ctx, createIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) + result, response, operationErr := watsonxDataService.CreateIntegration(createIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -19677,7 +20927,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSalIntegrationGlossaryTermsWithContext(ctx, getSalIntegrationGlossaryTermsOptionsModel) + _, _, operationErr = watsonxDataService.CreateIntegrationWithContext(ctx, createIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -19691,19 +20941,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationGlossaryTermsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createIntegrationPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"glossary_term": {"description": "First Name", "name": "Name"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"access_token": "Header.Payload.Signature", "apikey": "apikey", "auth_url": "https://iam.abc.com", "catalogs": {"catalog_names": ["CatalogNames"]}, "certificate": "certificate_content_base64_encoded", "certificate_extension": "pem", "config_properties": "properties", "connection_mode": "external", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "id": "presto01", "ikc_user_account_id": "ikc_user_account_id", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 0, "modified_by": "@.com", "password": "password", "policy_cache_time_configuration": "123456789", "resource": "presto01", "ssl": true, "state": "active", "type": "ranger", "url": "https://www.abcd.com", "username": "username", "zen_apikey": "zen_apikey"}`) })) }) - It(`Invoke GetSalIntegrationGlossaryTerms successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -19711,39 +20977,79 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSalIntegrationGlossaryTerms(nil) + result, response, operationErr := watsonxDataService.CreateIntegration(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSalIntegrationGlossaryTermsOptions model - getSalIntegrationGlossaryTermsOptionsModel := new(watsonxdatav2.GetSalIntegrationGlossaryTermsOptions) - getSalIntegrationGlossaryTermsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationGlossaryTermsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the CreateIntegrationOptions model + createIntegrationOptionsModel := new(watsonxdatav3.CreateIntegrationOptions) + createIntegrationOptionsModel.AccessToken = core.StringPtr("Header.Payload.Signature") + createIntegrationOptionsModel.Apikey = core.StringPtr("apikey") + createIntegrationOptionsModel.Catalogs = catalogsModel + createIntegrationOptionsModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + createIntegrationOptionsModel.CertificateExtension = core.StringPtr("pem") + createIntegrationOptionsModel.ConnectionMode = core.StringPtr("external") + createIntegrationOptionsModel.CrossAccountIntegration = core.BoolPtr(false) + createIntegrationOptionsModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) + createIntegrationOptionsModel.IkcUserAccountID = core.StringPtr("ikc_user_account_id") + createIntegrationOptionsModel.Password = core.StringPtr("password") + createIntegrationOptionsModel.PolicyCacheTimeConfiguration = core.StringPtr("123456789") + createIntegrationOptionsModel.Resource = core.StringPtr("presto01") + createIntegrationOptionsModel.Ssl = core.BoolPtr(true) + createIntegrationOptionsModel.Type = core.StringPtr("ranger") + createIntegrationOptionsModel.URL = core.StringPtr("https://abcd.efgh.com") + createIntegrationOptionsModel.Username = core.StringPtr("username") + createIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) + result, response, operationErr = watsonxDataService.CreateIntegration(createIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSalIntegrationGlossaryTerms with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateIntegration with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationGlossaryTermsOptions model - getSalIntegrationGlossaryTermsOptionsModel := new(watsonxdatav2.GetSalIntegrationGlossaryTermsOptions) - getSalIntegrationGlossaryTermsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationGlossaryTermsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the CreateIntegrationOptions model + createIntegrationOptionsModel := new(watsonxdatav3.CreateIntegrationOptions) + createIntegrationOptionsModel.AccessToken = core.StringPtr("Header.Payload.Signature") + createIntegrationOptionsModel.Apikey = core.StringPtr("apikey") + createIntegrationOptionsModel.Catalogs = catalogsModel + createIntegrationOptionsModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + createIntegrationOptionsModel.CertificateExtension = core.StringPtr("pem") + createIntegrationOptionsModel.ConnectionMode = core.StringPtr("external") + createIntegrationOptionsModel.CrossAccountIntegration = core.BoolPtr(false) + createIntegrationOptionsModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) + createIntegrationOptionsModel.IkcUserAccountID = core.StringPtr("ikc_user_account_id") + createIntegrationOptionsModel.Password = core.StringPtr("password") + createIntegrationOptionsModel.PolicyCacheTimeConfiguration = core.StringPtr("123456789") + createIntegrationOptionsModel.Resource = core.StringPtr("presto01") + createIntegrationOptionsModel.Ssl = core.BoolPtr(true) + createIntegrationOptionsModel.Type = core.StringPtr("ranger") + createIntegrationOptionsModel.URL = core.StringPtr("https://abcd.efgh.com") + createIntegrationOptionsModel.Username = core.StringPtr("username") + createIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) + result, response, operationErr := watsonxDataService.CreateIntegration(createIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -19759,24 +21065,44 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetSalIntegrationGlossaryTerms successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationGlossaryTermsOptions model - getSalIntegrationGlossaryTermsOptionsModel := new(watsonxdatav2.GetSalIntegrationGlossaryTermsOptions) - getSalIntegrationGlossaryTermsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationGlossaryTermsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the CreateIntegrationOptions model + createIntegrationOptionsModel := new(watsonxdatav3.CreateIntegrationOptions) + createIntegrationOptionsModel.AccessToken = core.StringPtr("Header.Payload.Signature") + createIntegrationOptionsModel.Apikey = core.StringPtr("apikey") + createIntegrationOptionsModel.Catalogs = catalogsModel + createIntegrationOptionsModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + createIntegrationOptionsModel.CertificateExtension = core.StringPtr("pem") + createIntegrationOptionsModel.ConnectionMode = core.StringPtr("external") + createIntegrationOptionsModel.CrossAccountIntegration = core.BoolPtr(false) + createIntegrationOptionsModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) + createIntegrationOptionsModel.IkcUserAccountID = core.StringPtr("ikc_user_account_id") + createIntegrationOptionsModel.Password = core.StringPtr("password") + createIntegrationOptionsModel.PolicyCacheTimeConfiguration = core.StringPtr("123456789") + createIntegrationOptionsModel.Resource = core.StringPtr("presto01") + createIntegrationOptionsModel.Ssl = core.BoolPtr(true) + createIntegrationOptionsModel.Type = core.StringPtr("ranger") + createIntegrationOptionsModel.URL = core.StringPtr("https://abcd.efgh.com") + createIntegrationOptionsModel.Username = core.StringPtr("username") + createIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) + result, response, operationErr := watsonxDataService.CreateIntegration(createIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -19788,48 +21114,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationMappings(getSalIntegrationMappingsOptions *GetSalIntegrationMappingsOptions) - Operation response error`, func() { - getSalIntegrationMappingsPath := "/sal_integrations/mappings" + Describe(`GetIntegrations(getIntegrationsOptions *GetIntegrationsOptions) - Operation response error`, func() { + getIntegrationsPath := "/v3/integrations/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationMappingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getIntegrationsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSalIntegrationMappings with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetIntegrations with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationMappingsOptions model - getSalIntegrationMappingsOptionsModel := new(watsonxdatav2.GetSalIntegrationMappingsOptions) - getSalIntegrationMappingsOptionsModel.CatalogName = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.SchemaName = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetIntegrationsOptions model + getIntegrationsOptionsModel := new(watsonxdatav3.GetIntegrationsOptions) + getIntegrationsOptionsModel.ID = core.StringPtr("testString") + getIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSalIntegrationMappings(getSalIntegrationMappingsOptionsModel) + result, response, operationErr := watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSalIntegrationMappings(getSalIntegrationMappingsOptionsModel) + result, response, operationErr = watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -19839,32 +21162,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationMappings(getSalIntegrationMappingsOptions *GetSalIntegrationMappingsOptions)`, func() { - getSalIntegrationMappingsPath := "/sal_integrations/mappings" + Describe(`GetIntegrations(getIntegrationsOptions *GetIntegrationsOptions)`, func() { + getIntegrationsPath := "/v3/integrations/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationMappingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getIntegrationsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"wkc_catalog_id": "iceberg_data", "wkc_project_id": "create"}`) + fmt.Fprintf(res, "%s", `{"access_token": "Header.Payload.Signature", "apikey": "apikey", "auth_url": "https://iam.abc.com", "catalogs": {"catalog_names": ["CatalogNames"]}, "certificate": "certificate_content_base64_encoded", "certificate_extension": "pem", "config_properties": "properties", "connection_mode": "external", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "id": "presto01", "ikc_user_account_id": "ikc_user_account_id", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 0, "modified_by": "@.com", "password": "password", "policy_cache_time_configuration": "123456789", "resource": "presto01", "ssl": true, "state": "active", "type": "ranger", "url": "https://www.abcd.com", "username": "username", "zen_apikey": "zen_apikey"}`) })) }) - It(`Invoke GetSalIntegrationMappings successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetIntegrations successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -19872,23 +21193,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSalIntegrationMappingsOptions model - getSalIntegrationMappingsOptionsModel := new(watsonxdatav2.GetSalIntegrationMappingsOptions) - getSalIntegrationMappingsOptionsModel.CatalogName = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.SchemaName = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetIntegrationsOptions model + getIntegrationsOptionsModel := new(watsonxdatav3.GetIntegrationsOptions) + getIntegrationsOptionsModel.ID = core.StringPtr("testString") + getIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSalIntegrationMappingsWithContext(ctx, getSalIntegrationMappingsOptionsModel) + _, _, operationErr := watsonxDataService.GetIntegrationsWithContext(ctx, getIntegrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSalIntegrationMappings(getSalIntegrationMappingsOptionsModel) + result, response, operationErr := watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -19896,7 +21216,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSalIntegrationMappingsWithContext(ctx, getSalIntegrationMappingsOptionsModel) + _, _, operationErr = watsonxDataService.GetIntegrationsWithContext(ctx, getIntegrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -19910,21 +21230,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationMappingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getIntegrationsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"wkc_catalog_id": "iceberg_data", "wkc_project_id": "create"}`) + fmt.Fprintf(res, "%s", `{"access_token": "Header.Payload.Signature", "apikey": "apikey", "auth_url": "https://iam.abc.com", "catalogs": {"catalog_names": ["CatalogNames"]}, "certificate": "certificate_content_base64_encoded", "certificate_extension": "pem", "config_properties": "properties", "connection_mode": "external", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "id": "presto01", "ikc_user_account_id": "ikc_user_account_id", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 0, "modified_by": "@.com", "password": "password", "policy_cache_time_configuration": "123456789", "resource": "presto01", "ssl": true, "state": "active", "type": "ranger", "url": "https://www.abcd.com", "username": "username", "zen_apikey": "zen_apikey"}`) })) }) - It(`Invoke GetSalIntegrationMappings successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetIntegrations successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -19932,51 +21250,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSalIntegrationMappings(nil) + result, response, operationErr := watsonxDataService.GetIntegrations(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSalIntegrationMappingsOptions model - getSalIntegrationMappingsOptionsModel := new(watsonxdatav2.GetSalIntegrationMappingsOptions) - getSalIntegrationMappingsOptionsModel.CatalogName = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.SchemaName = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetIntegrationsOptions model + getIntegrationsOptionsModel := new(watsonxdatav3.GetIntegrationsOptions) + getIntegrationsOptionsModel.ID = core.StringPtr("testString") + getIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSalIntegrationMappings(getSalIntegrationMappingsOptionsModel) + result, response, operationErr = watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSalIntegrationMappings with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetIntegrations with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationMappingsOptions model - getSalIntegrationMappingsOptionsModel := new(watsonxdatav2.GetSalIntegrationMappingsOptions) - getSalIntegrationMappingsOptionsModel.CatalogName = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.SchemaName = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetIntegrationsOptions model + getIntegrationsOptionsModel := new(watsonxdatav3.GetIntegrationsOptions) + getIntegrationsOptionsModel.ID = core.StringPtr("testString") + getIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSalIntegrationMappings(getSalIntegrationMappingsOptionsModel) + result, response, operationErr := watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetSalIntegrationMappingsOptions model with no property values - getSalIntegrationMappingsOptionsModelNew := new(watsonxdatav2.GetSalIntegrationMappingsOptions) + // Construct a second instance of the GetIntegrationsOptions model with no property values + getIntegrationsOptionsModelNew := new(watsonxdatav3.GetIntegrationsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetSalIntegrationMappings(getSalIntegrationMappingsOptionsModelNew) + result, response, operationErr = watsonxDataService.GetIntegrations(getIntegrationsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -19994,23 +21310,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSalIntegrationMappings successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetIntegrations successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationMappingsOptions model - getSalIntegrationMappingsOptionsModel := new(watsonxdatav2.GetSalIntegrationMappingsOptions) - getSalIntegrationMappingsOptionsModel.CatalogName = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.SchemaName = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationMappingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetIntegrationsOptions model + getIntegrationsOptionsModel := new(watsonxdatav3.GetIntegrationsOptions) + getIntegrationsOptionsModel.ID = core.StringPtr("testString") + getIntegrationsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getIntegrationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSalIntegrationMappings(getSalIntegrationMappingsOptionsModel) + result, response, operationErr := watsonxDataService.GetIntegrations(getIntegrationsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -20022,107 +21337,255 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptions *GetSalIntegrationEnrichmentGlobalSettingsOptions) - Operation response error`, func() { - getSalIntegrationEnrichmentGlobalSettingsPath := "/sal_integrations/metadata_enrichment_global_settings" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`DeleteIntegration(deleteIntegrationOptions *DeleteIntegrationOptions)`, func() { + deleteIntegrationPath := "/v3/integrations/testString" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentGlobalSettingsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteIntegrationPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(204) })) }) - It(`Invoke GetSalIntegrationEnrichmentGlobalSettings with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentGlobalSettingsOptions model - getSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentGlobalSettingsOptions) - getSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteIntegration(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteIntegrationOptions model + deleteIntegrationOptionsModel := new(watsonxdatav3.DeleteIntegrationOptions) + deleteIntegrationOptionsModel.ID = core.StringPtr("testString") + deleteIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteIntegration(deleteIntegrationOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + }) + It(`Invoke DeleteIntegration with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) - // Enable retries and test again - watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) + // Construct an instance of the DeleteIntegrationOptions model + deleteIntegrationOptionsModel := new(watsonxdatav3.DeleteIntegrationOptions) + deleteIntegrationOptionsModel.ID = core.StringPtr("testString") + deleteIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteIntegration(deleteIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteIntegrationOptions model with no property values + deleteIntegrationOptionsModelNew := new(watsonxdatav3.DeleteIntegrationOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteIntegration(deleteIntegrationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptions *GetSalIntegrationEnrichmentGlobalSettingsOptions)`, func() { - getSalIntegrationEnrichmentGlobalSettingsPath := "/sal_integrations/metadata_enrichment_global_settings" - Context(`Using mock server endpoint with timeout`, func() { + Describe(`UpdateIntegration(updateIntegrationOptions *UpdateIntegrationOptions) - Operation response error`, func() { + updateIntegrationPath := "/v3/integrations/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentGlobalSettingsPath)) - Expect(req.Method).To(Equal("GET")) - + Expect(req.URL.EscapedPath()).To(Equal(updateIntegrationPath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) - - // Set mock response + Expect(req.Header["Secret"]).ToNot(BeNil()) + Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"semantic_expansion": {"description_generation": true, "description_generation_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name_expansion": true, "name_expansion_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSalIntegrationEnrichmentGlobalSettings successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateIntegration with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - watsonxDataService.EnableRetries(0, 0) - - // Construct an instance of the GetSalIntegrationEnrichmentGlobalSettingsOptions model - getSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentGlobalSettingsOptions) - getSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettingsWithContext(ctx, getSalIntegrationEnrichmentGlobalSettingsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} - // Disable retries and test again - watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) - Expect(operationErr).To(BeNil()) + // Construct an instance of the IntegrationPatch model + integrationPatchModel := new(watsonxdatav3.IntegrationPatch) + integrationPatchModel.AccessToken = core.StringPtr("Header.Payload.Signature") + integrationPatchModel.Apikey = core.StringPtr("apikey") + integrationPatchModel.Catalogs = catalogsModel + integrationPatchModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + integrationPatchModel.CertificateExtension = core.StringPtr("pem") + integrationPatchModel.ConnectionMode = core.StringPtr("external") + integrationPatchModel.CrossAccountIntegration = core.BoolPtr(false) + integrationPatchModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) + integrationPatchModel.IkcUserAccountID = core.StringPtr("ikc_user_account_id") + integrationPatchModel.Password = core.StringPtr("password") + integrationPatchModel.PolicyCacheTimeConfiguration = core.StringPtr("123456789") + integrationPatchModel.Resource = core.StringPtr("presto01") + integrationPatchModel.Ssl = core.BoolPtr(true) + integrationPatchModel.State = core.StringPtr("active") + integrationPatchModel.URL = core.StringPtr("https://abcd.efgh.com") + integrationPatchModel.Username = core.StringPtr("username") + integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateIntegrationOptions model + updateIntegrationOptionsModel := new(watsonxdatav3.UpdateIntegrationOptions) + updateIntegrationOptionsModel.ID = core.StringPtr("testString") + updateIntegrationOptionsModel.Body = integrationPatchModelAsPatch + updateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateIntegrationOptionsModel.Secret = core.StringPtr("testString") + updateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + watsonxDataService.EnableRetries(0, 0) + result, response, operationErr = watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateIntegration(updateIntegrationOptions *UpdateIntegrationOptions)`, func() { + updateIntegrationPath := "/v3/integrations/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateIntegrationPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.Header["Secret"]).ToNot(BeNil()) + Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"access_token": "Header.Payload.Signature", "apikey": "apikey", "auth_url": "https://iam.abc.com", "catalogs": {"catalog_names": ["CatalogNames"]}, "certificate": "certificate_content_base64_encoded", "certificate_extension": "pem", "config_properties": "properties", "connection_mode": "external", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "id": "presto01", "ikc_user_account_id": "ikc_user_account_id", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 0, "modified_by": "@.com", "password": "password", "policy_cache_time_configuration": "123456789", "resource": "presto01", "ssl": true, "state": "active", "type": "ranger", "url": "https://www.abcd.com", "username": "username", "zen_apikey": "zen_apikey"}`) + })) + }) + It(`Invoke UpdateIntegration successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + watsonxDataService.EnableRetries(0, 0) + + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the IntegrationPatch model + integrationPatchModel := new(watsonxdatav3.IntegrationPatch) + integrationPatchModel.AccessToken = core.StringPtr("Header.Payload.Signature") + integrationPatchModel.Apikey = core.StringPtr("apikey") + integrationPatchModel.Catalogs = catalogsModel + integrationPatchModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + integrationPatchModel.CertificateExtension = core.StringPtr("pem") + integrationPatchModel.ConnectionMode = core.StringPtr("external") + integrationPatchModel.CrossAccountIntegration = core.BoolPtr(false) + integrationPatchModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) + integrationPatchModel.IkcUserAccountID = core.StringPtr("ikc_user_account_id") + integrationPatchModel.Password = core.StringPtr("password") + integrationPatchModel.PolicyCacheTimeConfiguration = core.StringPtr("123456789") + integrationPatchModel.Resource = core.StringPtr("presto01") + integrationPatchModel.Ssl = core.BoolPtr(true) + integrationPatchModel.State = core.StringPtr("active") + integrationPatchModel.URL = core.StringPtr("https://abcd.efgh.com") + integrationPatchModel.Username = core.StringPtr("username") + integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateIntegrationOptions model + updateIntegrationOptionsModel := new(watsonxdatav3.UpdateIntegrationOptions) + updateIntegrationOptionsModel.ID = core.StringPtr("testString") + updateIntegrationOptionsModel.Body = integrationPatchModelAsPatch + updateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateIntegrationOptionsModel.Secret = core.StringPtr("testString") + updateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with a Context to test a timeout error + ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) + defer cancelFunc() + _, _, operationErr := watsonxDataService.UpdateIntegrationWithContext(ctx, updateIntegrationOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + + // Disable retries and test again + watsonxDataService.DisableRetries() + result, response, operationErr := watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSalIntegrationEnrichmentGlobalSettingsWithContext(ctx, getSalIntegrationEnrichmentGlobalSettingsOptionsModel) + _, _, operationErr = watsonxDataService.UpdateIntegrationWithContext(ctx, updateIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -20136,19 +21599,37 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentGlobalSettingsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateIntegrationPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.Header["Secret"]).ToNot(BeNil()) + Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"semantic_expansion": {"description_generation": true, "description_generation_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name_expansion": true, "name_expansion_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) + fmt.Fprintf(res, "%s", `{"access_token": "Header.Payload.Signature", "apikey": "apikey", "auth_url": "https://iam.abc.com", "catalogs": {"catalog_names": ["CatalogNames"]}, "certificate": "certificate_content_base64_encoded", "certificate_extension": "pem", "config_properties": "properties", "connection_mode": "external", "cross_account_integration": false, "enable_data_policy_within_wxd": false, "governance_properties": "query-governance.name=external", "id": "presto01", "ikc_user_account_id": "ikc_user_account_id", "manta_url": "https://abcd.com/gov_lineage/v2/lineage_events/openlineage", "modified_at": 0, "modified_by": "@.com", "password": "password", "policy_cache_time_configuration": "123456789", "resource": "presto01", "ssl": true, "state": "active", "type": "ranger", "url": "https://www.abcd.com", "username": "username", "zen_apikey": "zen_apikey"}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentGlobalSettings successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -20156,43 +21637,106 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(nil) + result, response, operationErr := watsonxDataService.UpdateIntegration(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentGlobalSettingsOptions model - getSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentGlobalSettingsOptions) - getSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the IntegrationPatch model + integrationPatchModel := new(watsonxdatav3.IntegrationPatch) + integrationPatchModel.AccessToken = core.StringPtr("Header.Payload.Signature") + integrationPatchModel.Apikey = core.StringPtr("apikey") + integrationPatchModel.Catalogs = catalogsModel + integrationPatchModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + integrationPatchModel.CertificateExtension = core.StringPtr("pem") + integrationPatchModel.ConnectionMode = core.StringPtr("external") + integrationPatchModel.CrossAccountIntegration = core.BoolPtr(false) + integrationPatchModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) + integrationPatchModel.IkcUserAccountID = core.StringPtr("ikc_user_account_id") + integrationPatchModel.Password = core.StringPtr("password") + integrationPatchModel.PolicyCacheTimeConfiguration = core.StringPtr("123456789") + integrationPatchModel.Resource = core.StringPtr("presto01") + integrationPatchModel.Ssl = core.BoolPtr(true) + integrationPatchModel.State = core.StringPtr("active") + integrationPatchModel.URL = core.StringPtr("https://abcd.efgh.com") + integrationPatchModel.Username = core.StringPtr("username") + integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateIntegrationOptions model + updateIntegrationOptionsModel := new(watsonxdatav3.UpdateIntegrationOptions) + updateIntegrationOptionsModel.ID = core.StringPtr("testString") + updateIntegrationOptionsModel.Body = integrationPatchModelAsPatch + updateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateIntegrationOptionsModel.Secret = core.StringPtr("testString") + updateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) + result, response, operationErr = watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSalIntegrationEnrichmentGlobalSettings with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateIntegration with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentGlobalSettingsOptions model - getSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentGlobalSettingsOptions) - getSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the IntegrationPatch model + integrationPatchModel := new(watsonxdatav3.IntegrationPatch) + integrationPatchModel.AccessToken = core.StringPtr("Header.Payload.Signature") + integrationPatchModel.Apikey = core.StringPtr("apikey") + integrationPatchModel.Catalogs = catalogsModel + integrationPatchModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + integrationPatchModel.CertificateExtension = core.StringPtr("pem") + integrationPatchModel.ConnectionMode = core.StringPtr("external") + integrationPatchModel.CrossAccountIntegration = core.BoolPtr(false) + integrationPatchModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) + integrationPatchModel.IkcUserAccountID = core.StringPtr("ikc_user_account_id") + integrationPatchModel.Password = core.StringPtr("password") + integrationPatchModel.PolicyCacheTimeConfiguration = core.StringPtr("123456789") + integrationPatchModel.Resource = core.StringPtr("presto01") + integrationPatchModel.Ssl = core.BoolPtr(true) + integrationPatchModel.State = core.StringPtr("active") + integrationPatchModel.URL = core.StringPtr("https://abcd.efgh.com") + integrationPatchModel.Username = core.StringPtr("username") + integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateIntegrationOptions model + updateIntegrationOptionsModel := new(watsonxdatav3.UpdateIntegrationOptions) + updateIntegrationOptionsModel.ID = core.StringPtr("testString") + updateIntegrationOptionsModel.Body = integrationPatchModelAsPatch + updateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateIntegrationOptionsModel.Secret = core.StringPtr("testString") + updateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) + result, response, operationErr := watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the UpdateIntegrationOptions model with no property values + updateIntegrationOptionsModelNew := new(watsonxdatav3.UpdateIntegrationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.UpdateIntegration(updateIntegrationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -20207,21 +21751,49 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSalIntegrationEnrichmentGlobalSettings successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentGlobalSettingsOptions model - getSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentGlobalSettingsOptions) - getSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + + // Construct an instance of the IntegrationPatch model + integrationPatchModel := new(watsonxdatav3.IntegrationPatch) + integrationPatchModel.AccessToken = core.StringPtr("Header.Payload.Signature") + integrationPatchModel.Apikey = core.StringPtr("apikey") + integrationPatchModel.Catalogs = catalogsModel + integrationPatchModel.Certificate = core.StringPtr("certificate_content_base64_encoded") + integrationPatchModel.CertificateExtension = core.StringPtr("pem") + integrationPatchModel.ConnectionMode = core.StringPtr("external") + integrationPatchModel.CrossAccountIntegration = core.BoolPtr(false) + integrationPatchModel.EnableDataPolicyWithinWxd = core.BoolPtr(false) + integrationPatchModel.IkcUserAccountID = core.StringPtr("ikc_user_account_id") + integrationPatchModel.Password = core.StringPtr("password") + integrationPatchModel.PolicyCacheTimeConfiguration = core.StringPtr("123456789") + integrationPatchModel.Resource = core.StringPtr("presto01") + integrationPatchModel.Ssl = core.BoolPtr(true) + integrationPatchModel.State = core.StringPtr("active") + integrationPatchModel.URL = core.StringPtr("https://abcd.efgh.com") + integrationPatchModel.Username = core.StringPtr("username") + integrationPatchModelAsPatch, asPatchErr := integrationPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateIntegrationOptions model + updateIntegrationOptionsModel := new(watsonxdatav3.UpdateIntegrationOptions) + updateIntegrationOptionsModel.ID = core.StringPtr("testString") + updateIntegrationOptionsModel.Body = integrationPatchModelAsPatch + updateIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateIntegrationOptionsModel.Secret = core.StringPtr("testString") + updateIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) + result, response, operationErr := watsonxDataService.UpdateIntegration(updateIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -20233,15 +21805,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSalIntegrationEnrichmentGlobalSettings(createSalIntegrationEnrichmentGlobalSettingsOptions *CreateSalIntegrationEnrichmentGlobalSettingsOptions) - Operation response error`, func() { - createSalIntegrationEnrichmentGlobalSettingsPath := "/sal_integrations/metadata_enrichment_global_settings" + Describe(`RegisterTable(registerTableOptions *RegisterTableOptions) - Operation response error`, func() { + registerTablePath := "/v3/catalogs/testString/schemas/testString/register" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationEnrichmentGlobalSettingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(registerTablePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -20250,57 +21822,31 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSalIntegrationEnrichmentGlobalSettings with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RegisterTable with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansion model - salIntegrationEnrichmentSettingsSemanticExpansionModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGeneration = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGenerationConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansion = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansionConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel - - // Construct an instance of the SalIntegrationEnrichmentSettingsTermAssignment model - salIntegrationEnrichmentSettingsTermAssignmentModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment) - salIntegrationEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) - - // Construct an instance of the CreateSalIntegrationEnrichmentGlobalSettingsOptions model - createSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav2.CreateSalIntegrationEnrichmentGlobalSettingsOptions) - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.SemanticExpansion = salIntegrationEnrichmentSettingsSemanticExpansionModel - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment = salIntegrationEnrichmentSettingsTermAssignmentModel - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RegisterTableOptions model + registerTableOptionsModel := new(watsonxdatav3.RegisterTableOptions) + registerTableOptionsModel.CatalogID = core.StringPtr("testString") + registerTableOptionsModel.SchemaID = core.StringPtr("testString") + registerTableOptionsModel.MetadataLocation = core.StringPtr("s3a://storagename/path/to/table/metadata_location/_delta_log") + registerTableOptionsModel.TableName = core.StringPtr("table1") + registerTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + registerTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateSalIntegrationEnrichmentGlobalSettings(createSalIntegrationEnrichmentGlobalSettingsOptionsModel) + result, response, operationErr := watsonxDataService.RegisterTable(registerTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateSalIntegrationEnrichmentGlobalSettings(createSalIntegrationEnrichmentGlobalSettingsOptionsModel) + result, response, operationErr = watsonxDataService.RegisterTable(registerTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -20310,15 +21856,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSalIntegrationEnrichmentGlobalSettings(createSalIntegrationEnrichmentGlobalSettingsOptions *CreateSalIntegrationEnrichmentGlobalSettingsOptions)`, func() { - createSalIntegrationEnrichmentGlobalSettingsPath := "/sal_integrations/metadata_enrichment_global_settings" + Describe(`RegisterTable(registerTableOptions *RegisterTableOptions)`, func() { + registerTablePath := "/v3/catalogs/testString/schemas/testString/register" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationEnrichmentGlobalSettingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(registerTablePath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -20345,11 +21891,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"semantic_expansion": {"description_generation": true, "description_generation_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name_expansion": true, "name_expansion_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke CreateSalIntegrationEnrichmentGlobalSettings successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RegisterTable successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -20357,51 +21903,25 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansion model - salIntegrationEnrichmentSettingsSemanticExpansionModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGeneration = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGenerationConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansion = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansionConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel - - // Construct an instance of the SalIntegrationEnrichmentSettingsTermAssignment model - salIntegrationEnrichmentSettingsTermAssignmentModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment) - salIntegrationEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) - - // Construct an instance of the CreateSalIntegrationEnrichmentGlobalSettingsOptions model - createSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav2.CreateSalIntegrationEnrichmentGlobalSettingsOptions) - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.SemanticExpansion = salIntegrationEnrichmentSettingsSemanticExpansionModel - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment = salIntegrationEnrichmentSettingsTermAssignmentModel - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RegisterTableOptions model + registerTableOptionsModel := new(watsonxdatav3.RegisterTableOptions) + registerTableOptionsModel.CatalogID = core.StringPtr("testString") + registerTableOptionsModel.SchemaID = core.StringPtr("testString") + registerTableOptionsModel.MetadataLocation = core.StringPtr("s3a://storagename/path/to/table/metadata_location/_delta_log") + registerTableOptionsModel.TableName = core.StringPtr("table1") + registerTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + registerTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateSalIntegrationEnrichmentGlobalSettingsWithContext(ctx, createSalIntegrationEnrichmentGlobalSettingsOptionsModel) + _, _, operationErr := watsonxDataService.RegisterTableWithContext(ctx, registerTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateSalIntegrationEnrichmentGlobalSettings(createSalIntegrationEnrichmentGlobalSettingsOptionsModel) + result, response, operationErr := watsonxDataService.RegisterTable(registerTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -20409,7 +21929,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateSalIntegrationEnrichmentGlobalSettingsWithContext(ctx, createSalIntegrationEnrichmentGlobalSettingsOptionsModel) + _, _, operationErr = watsonxDataService.RegisterTableWithContext(ctx, registerTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -20423,7 +21943,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationEnrichmentGlobalSettingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(registerTablePath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -20447,11 +21967,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"semantic_expansion": {"description_generation": true, "description_generation_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name_expansion": true, "name_expansion_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke CreateSalIntegrationEnrichmentGlobalSettings successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RegisterTable successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -20459,103 +21979,58 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateSalIntegrationEnrichmentGlobalSettings(nil) + result, response, operationErr := watsonxDataService.RegisterTable(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansion model - salIntegrationEnrichmentSettingsSemanticExpansionModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGeneration = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGenerationConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansion = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansionConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel - - // Construct an instance of the SalIntegrationEnrichmentSettingsTermAssignment model - salIntegrationEnrichmentSettingsTermAssignmentModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment) - salIntegrationEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) - - // Construct an instance of the CreateSalIntegrationEnrichmentGlobalSettingsOptions model - createSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav2.CreateSalIntegrationEnrichmentGlobalSettingsOptions) - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.SemanticExpansion = salIntegrationEnrichmentSettingsSemanticExpansionModel - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment = salIntegrationEnrichmentSettingsTermAssignmentModel - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RegisterTableOptions model + registerTableOptionsModel := new(watsonxdatav3.RegisterTableOptions) + registerTableOptionsModel.CatalogID = core.StringPtr("testString") + registerTableOptionsModel.SchemaID = core.StringPtr("testString") + registerTableOptionsModel.MetadataLocation = core.StringPtr("s3a://storagename/path/to/table/metadata_location/_delta_log") + registerTableOptionsModel.TableName = core.StringPtr("table1") + registerTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + registerTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateSalIntegrationEnrichmentGlobalSettings(createSalIntegrationEnrichmentGlobalSettingsOptionsModel) + result, response, operationErr = watsonxDataService.RegisterTable(registerTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSalIntegrationEnrichmentGlobalSettings with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RegisterTable with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansion model - salIntegrationEnrichmentSettingsSemanticExpansionModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGeneration = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGenerationConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansion = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansionConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel - - // Construct an instance of the SalIntegrationEnrichmentSettingsTermAssignment model - salIntegrationEnrichmentSettingsTermAssignmentModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment) - salIntegrationEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) - - // Construct an instance of the CreateSalIntegrationEnrichmentGlobalSettingsOptions model - createSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav2.CreateSalIntegrationEnrichmentGlobalSettingsOptions) - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.SemanticExpansion = salIntegrationEnrichmentSettingsSemanticExpansionModel - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment = salIntegrationEnrichmentSettingsTermAssignmentModel - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RegisterTableOptions model + registerTableOptionsModel := new(watsonxdatav3.RegisterTableOptions) + registerTableOptionsModel.CatalogID = core.StringPtr("testString") + registerTableOptionsModel.SchemaID = core.StringPtr("testString") + registerTableOptionsModel.MetadataLocation = core.StringPtr("s3a://storagename/path/to/table/metadata_location/_delta_log") + registerTableOptionsModel.TableName = core.StringPtr("table1") + registerTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + registerTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateSalIntegrationEnrichmentGlobalSettings(createSalIntegrationEnrichmentGlobalSettingsOptionsModel) + result, response, operationErr := watsonxDataService.RegisterTable(registerTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the RegisterTableOptions model with no property values + registerTableOptionsModelNew := new(watsonxdatav3.RegisterTableOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.RegisterTable(registerTableOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -20570,51 +22045,25 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateSalIntegrationEnrichmentGlobalSettings successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RegisterTable successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansion model - salIntegrationEnrichmentSettingsSemanticExpansionModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGeneration = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGenerationConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansion = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansionConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel - - // Construct an instance of the SalIntegrationEnrichmentSettingsTermAssignment model - salIntegrationEnrichmentSettingsTermAssignmentModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment) - salIntegrationEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) - - // Construct an instance of the CreateSalIntegrationEnrichmentGlobalSettingsOptions model - createSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav2.CreateSalIntegrationEnrichmentGlobalSettingsOptions) - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.SemanticExpansion = salIntegrationEnrichmentSettingsSemanticExpansionModel - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment = salIntegrationEnrichmentSettingsTermAssignmentModel - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - + // Construct an instance of the RegisterTableOptions model + registerTableOptionsModel := new(watsonxdatav3.RegisterTableOptions) + registerTableOptionsModel.CatalogID = core.StringPtr("testString") + registerTableOptionsModel.SchemaID = core.StringPtr("testString") + registerTableOptionsModel.MetadataLocation = core.StringPtr("s3a://storagename/path/to/table/metadata_location/_delta_log") + registerTableOptionsModel.TableName = core.StringPtr("table1") + registerTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + registerTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation - result, response, operationErr := watsonxDataService.CreateSalIntegrationEnrichmentGlobalSettings(createSalIntegrationEnrichmentGlobalSettingsOptionsModel) + result, response, operationErr := watsonxDataService.RegisterTable(registerTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -20626,46 +22075,47 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationEnrichmentSettings(getSalIntegrationEnrichmentSettingsOptions *GetSalIntegrationEnrichmentSettingsOptions) - Operation response error`, func() { - getSalIntegrationEnrichmentSettingsPath := "/sal_integrations/metadata_enrichment_settings" + Describe(`LoadTable(loadTableOptions *LoadTableOptions) - Operation response error`, func() { + loadTablePath := "/v3/catalogs/testString/schemas/testString/tables/testString/metadata" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentSettingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(loadTablePath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSalIntegrationEnrichmentSettings with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke LoadTable with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentSettingsOptions model - getSalIntegrationEnrichmentSettingsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentSettingsOptions) - getSalIntegrationEnrichmentSettingsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the LoadTableOptions model + loadTableOptionsModel := new(watsonxdatav3.LoadTableOptions) + loadTableOptionsModel.CatalogID = core.StringPtr("testString") + loadTableOptionsModel.SchemaID = core.StringPtr("testString") + loadTableOptionsModel.TableID = core.StringPtr("testString") + loadTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + loadTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentSettings(getSalIntegrationEnrichmentSettingsOptionsModel) + result, response, operationErr := watsonxDataService.LoadTable(loadTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentSettings(getSalIntegrationEnrichmentSettingsOptionsModel) + result, response, operationErr = watsonxDataService.LoadTable(loadTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -20675,31 +22125,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationEnrichmentSettings(getSalIntegrationEnrichmentSettingsOptions *GetSalIntegrationEnrichmentSettingsOptions)`, func() { - getSalIntegrationEnrichmentSettingsPath := "/sal_integrations/metadata_enrichment_settings" + Describe(`LoadTable(loadTableOptions *LoadTableOptions)`, func() { + loadTablePath := "/v3/catalogs/testString/schemas/testString/tables/testString/metadata" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentSettingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(loadTablePath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"semantic_expansion": {"description_generation": true, "description_generation_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name_expansion": true, "name_expansion_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) + fmt.Fprintf(res, "%s", `{"metadata_location": "s3a://storagename/path/to/table/metadata_location/_delta_log", "table_path": "s3a://storagename/path/to/table"}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentSettings successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke LoadTable successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -20707,22 +22156,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSalIntegrationEnrichmentSettingsOptions model - getSalIntegrationEnrichmentSettingsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentSettingsOptions) - getSalIntegrationEnrichmentSettingsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the LoadTableOptions model + loadTableOptionsModel := new(watsonxdatav3.LoadTableOptions) + loadTableOptionsModel.CatalogID = core.StringPtr("testString") + loadTableOptionsModel.SchemaID = core.StringPtr("testString") + loadTableOptionsModel.TableID = core.StringPtr("testString") + loadTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + loadTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSalIntegrationEnrichmentSettingsWithContext(ctx, getSalIntegrationEnrichmentSettingsOptionsModel) + _, _, operationErr := watsonxDataService.LoadTableWithContext(ctx, loadTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentSettings(getSalIntegrationEnrichmentSettingsOptionsModel) + result, response, operationErr := watsonxDataService.LoadTable(loadTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -20730,7 +22181,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSalIntegrationEnrichmentSettingsWithContext(ctx, getSalIntegrationEnrichmentSettingsOptionsModel) + _, _, operationErr = watsonxDataService.LoadTableWithContext(ctx, loadTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -20744,20 +22195,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentSettingsPath)) + Expect(req.URL.EscapedPath()).To(Equal(loadTablePath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"semantic_expansion": {"description_generation": true, "description_generation_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name_expansion": true, "name_expansion_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) + fmt.Fprintf(res, "%s", `{"metadata_location": "s3a://storagename/path/to/table/metadata_location/_delta_log", "table_path": "s3a://storagename/path/to/table"}`) })) }) - It(`Invoke GetSalIntegrationEnrichmentSettings successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke LoadTable successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -20765,45 +22215,56 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentSettings(nil) + result, response, operationErr := watsonxDataService.LoadTable(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentSettingsOptions model - getSalIntegrationEnrichmentSettingsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentSettingsOptions) - getSalIntegrationEnrichmentSettingsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the LoadTableOptions model + loadTableOptionsModel := new(watsonxdatav3.LoadTableOptions) + loadTableOptionsModel.CatalogID = core.StringPtr("testString") + loadTableOptionsModel.SchemaID = core.StringPtr("testString") + loadTableOptionsModel.TableID = core.StringPtr("testString") + loadTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + loadTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentSettings(getSalIntegrationEnrichmentSettingsOptionsModel) + result, response, operationErr = watsonxDataService.LoadTable(loadTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSalIntegrationEnrichmentSettings with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke LoadTable with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentSettingsOptions model - getSalIntegrationEnrichmentSettingsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentSettingsOptions) - getSalIntegrationEnrichmentSettingsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the LoadTableOptions model + loadTableOptionsModel := new(watsonxdatav3.LoadTableOptions) + loadTableOptionsModel.CatalogID = core.StringPtr("testString") + loadTableOptionsModel.SchemaID = core.StringPtr("testString") + loadTableOptionsModel.TableID = core.StringPtr("testString") + loadTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + loadTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentSettings(getSalIntegrationEnrichmentSettingsOptionsModel) + result, response, operationErr := watsonxDataService.LoadTable(loadTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the LoadTableOptions model with no property values + loadTableOptionsModelNew := new(watsonxdatav3.LoadTableOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.LoadTable(loadTableOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -20818,22 +22279,24 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSalIntegrationEnrichmentSettings successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke LoadTable successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationEnrichmentSettingsOptions model - getSalIntegrationEnrichmentSettingsOptionsModel := new(watsonxdatav2.GetSalIntegrationEnrichmentSettingsOptions) - getSalIntegrationEnrichmentSettingsOptionsModel.ProjectID = core.StringPtr("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the LoadTableOptions model + loadTableOptionsModel := new(watsonxdatav3.LoadTableOptions) + loadTableOptionsModel.CatalogID = core.StringPtr("testString") + loadTableOptionsModel.SchemaID = core.StringPtr("testString") + loadTableOptionsModel.TableID = core.StringPtr("testString") + loadTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + loadTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentSettings(getSalIntegrationEnrichmentSettingsOptionsModel) + result, response, operationErr := watsonxDataService.LoadTable(loadTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -20845,190 +22308,51 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSalIntegrationEnrichmentSettings(createSalIntegrationEnrichmentSettingsOptions *CreateSalIntegrationEnrichmentSettingsOptions)`, func() { - createSalIntegrationEnrichmentSettingsPath := "/sal_integrations/metadata_enrichment_settings" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationEnrichmentSettingsPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) - res.WriteHeader(204) - })) - }) - It(`Invoke CreateSalIntegrationEnrichmentSettings successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.CreateSalIntegrationEnrichmentSettings(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansion model - salIntegrationEnrichmentSettingsSemanticExpansionModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGeneration = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGenerationConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansion = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansionConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel - - // Construct an instance of the SalIntegrationEnrichmentSettingsTermAssignment model - salIntegrationEnrichmentSettingsTermAssignmentModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment) - salIntegrationEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) - - // Construct an instance of the CreateSalIntegrationEnrichmentSettingsOptions model - createSalIntegrationEnrichmentSettingsOptionsModel := new(watsonxdatav2.CreateSalIntegrationEnrichmentSettingsOptions) - createSalIntegrationEnrichmentSettingsOptionsModel.SemanticExpansion = salIntegrationEnrichmentSettingsSemanticExpansionModel - createSalIntegrationEnrichmentSettingsOptionsModel.TermAssignment = salIntegrationEnrichmentSettingsTermAssignmentModel - createSalIntegrationEnrichmentSettingsOptionsModel.ProjectID = core.StringPtr("testString") - createSalIntegrationEnrichmentSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationEnrichmentSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.CreateSalIntegrationEnrichmentSettings(createSalIntegrationEnrichmentSettingsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke CreateSalIntegrationEnrichmentSettings with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansion model - salIntegrationEnrichmentSettingsSemanticExpansionModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGeneration = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGenerationConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansion = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansionConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel - - // Construct an instance of the SalIntegrationEnrichmentSettingsTermAssignment model - salIntegrationEnrichmentSettingsTermAssignmentModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment) - salIntegrationEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) - - // Construct an instance of the CreateSalIntegrationEnrichmentSettingsOptions model - createSalIntegrationEnrichmentSettingsOptionsModel := new(watsonxdatav2.CreateSalIntegrationEnrichmentSettingsOptions) - createSalIntegrationEnrichmentSettingsOptionsModel.SemanticExpansion = salIntegrationEnrichmentSettingsSemanticExpansionModel - createSalIntegrationEnrichmentSettingsOptionsModel.TermAssignment = salIntegrationEnrichmentSettingsTermAssignmentModel - createSalIntegrationEnrichmentSettingsOptionsModel.ProjectID = core.StringPtr("testString") - createSalIntegrationEnrichmentSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationEnrichmentSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.CreateSalIntegrationEnrichmentSettings(createSalIntegrationEnrichmentSettingsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptions *CreateSalIntegrationUploadGlossaryOptions) - Operation response error`, func() { - createSalIntegrationUploadGlossaryPath := "/sal_integrations/upload_glossary" + Describe(`ListCatalogs(listCatalogsOptions *ListCatalogsOptions) - Operation response error`, func() { + listCatalogsPath := "/v3/catalogs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationUploadGlossaryPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listCatalogsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.Header["Secret"]).ToNot(BeNil()) + Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for default_catalogs query parameter + Expect(req.URL.Query()["view"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSalIntegrationUploadGlossary with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListCatalogs with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSalIntegrationUploadGlossaryOptions model - createSalIntegrationUploadGlossaryOptionsModel := new(watsonxdatav2.CreateSalIntegrationUploadGlossaryOptions) - createSalIntegrationUploadGlossaryOptionsModel.ReplaceOption = core.StringPtr("all") - createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsv = CreateMockReader("This is a mock file.") - createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsvContentType = core.StringPtr("testString") - createSalIntegrationUploadGlossaryOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationUploadGlossaryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogsOptions model + listCatalogsOptionsModel := new(watsonxdatav3.ListCatalogsOptions) + listCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listCatalogsOptionsModel.Secret = core.StringPtr("testString") + listCatalogsOptionsModel.DefaultCatalogs = core.BoolPtr(false) + listCatalogsOptionsModel.View = core.StringPtr("testString") + listCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) + result, response, operationErr := watsonxDataService.ListCatalogs(listCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) + result, response, operationErr = watsonxDataService.ListCatalogs(listCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -21038,30 +22362,34 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptions *CreateSalIntegrationUploadGlossaryOptions)`, func() { - createSalIntegrationUploadGlossaryPath := "/sal_integrations/upload_glossary" + Describe(`ListCatalogs(listCatalogsOptions *ListCatalogsOptions)`, func() { + listCatalogsPath := "/v3/catalogs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationUploadGlossaryPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listCatalogsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.Header["Secret"]).ToNot(BeNil()) + Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for default_catalogs query parameter + Expect(req.URL.Query()["view"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"process_id": "18b49d7a-9519-4539-8db5-ff080623c226"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke CreateSalIntegrationUploadGlossary successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListCatalogs successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -21069,24 +22397,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateSalIntegrationUploadGlossaryOptions model - createSalIntegrationUploadGlossaryOptionsModel := new(watsonxdatav2.CreateSalIntegrationUploadGlossaryOptions) - createSalIntegrationUploadGlossaryOptionsModel.ReplaceOption = core.StringPtr("all") - createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsv = CreateMockReader("This is a mock file.") - createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsvContentType = core.StringPtr("testString") - createSalIntegrationUploadGlossaryOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationUploadGlossaryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogsOptions model + listCatalogsOptionsModel := new(watsonxdatav3.ListCatalogsOptions) + listCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listCatalogsOptionsModel.Secret = core.StringPtr("testString") + listCatalogsOptionsModel.DefaultCatalogs = core.BoolPtr(false) + listCatalogsOptionsModel.View = core.StringPtr("testString") + listCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossaryWithContext(ctx, createSalIntegrationUploadGlossaryOptionsModel) + _, _, operationErr := watsonxDataService.ListCatalogsWithContext(ctx, listCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) + result, response, operationErr := watsonxDataService.ListCatalogs(listCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -21094,7 +22422,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateSalIntegrationUploadGlossaryWithContext(ctx, createSalIntegrationUploadGlossaryOptionsModel) + _, _, operationErr = watsonxDataService.ListCatalogsWithContext(ctx, listCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -21108,19 +22436,23 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationUploadGlossaryPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listCatalogsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.Header["Secret"]).ToNot(BeNil()) + Expect(req.Header["Secret"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for default_catalogs query parameter + Expect(req.URL.Query()["view"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"process_id": "18b49d7a-9519-4539-8db5-ff080623c226"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}]}`) })) }) - It(`Invoke CreateSalIntegrationUploadGlossary successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -21128,56 +22460,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossary(nil) + result, response, operationErr := watsonxDataService.ListCatalogs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateSalIntegrationUploadGlossaryOptions model - createSalIntegrationUploadGlossaryOptionsModel := new(watsonxdatav2.CreateSalIntegrationUploadGlossaryOptions) - createSalIntegrationUploadGlossaryOptionsModel.ReplaceOption = core.StringPtr("all") - createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsv = CreateMockReader("This is a mock file.") - createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsvContentType = core.StringPtr("testString") - createSalIntegrationUploadGlossaryOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationUploadGlossaryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogsOptions model + listCatalogsOptionsModel := new(watsonxdatav3.ListCatalogsOptions) + listCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listCatalogsOptionsModel.Secret = core.StringPtr("testString") + listCatalogsOptionsModel.DefaultCatalogs = core.BoolPtr(false) + listCatalogsOptionsModel.View = core.StringPtr("testString") + listCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) + result, response, operationErr = watsonxDataService.ListCatalogs(listCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSalIntegrationUploadGlossary with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListCatalogs with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSalIntegrationUploadGlossaryOptions model - createSalIntegrationUploadGlossaryOptionsModel := new(watsonxdatav2.CreateSalIntegrationUploadGlossaryOptions) - createSalIntegrationUploadGlossaryOptionsModel.ReplaceOption = core.StringPtr("all") - createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsv = CreateMockReader("This is a mock file.") - createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsvContentType = core.StringPtr("testString") - createSalIntegrationUploadGlossaryOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationUploadGlossaryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogsOptions model + listCatalogsOptionsModel := new(watsonxdatav3.ListCatalogsOptions) + listCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listCatalogsOptionsModel.Secret = core.StringPtr("testString") + listCatalogsOptionsModel.DefaultCatalogs = core.BoolPtr(false) + listCatalogsOptionsModel.View = core.StringPtr("testString") + listCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) + result, response, operationErr := watsonxDataService.ListCatalogs(listCatalogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateSalIntegrationUploadGlossaryOptions model with no property values - createSalIntegrationUploadGlossaryOptionsModelNew := new(watsonxdatav2.CreateSalIntegrationUploadGlossaryOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -21189,27 +22514,27 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateSalIntegrationUploadGlossary successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListCatalogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSalIntegrationUploadGlossaryOptions model - createSalIntegrationUploadGlossaryOptionsModel := new(watsonxdatav2.CreateSalIntegrationUploadGlossaryOptions) - createSalIntegrationUploadGlossaryOptionsModel.ReplaceOption = core.StringPtr("all") - createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsv = CreateMockReader("This is a mock file.") - createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsvContentType = core.StringPtr("testString") - createSalIntegrationUploadGlossaryOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSalIntegrationUploadGlossaryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListCatalogsOptions model + listCatalogsOptionsModel := new(watsonxdatav3.ListCatalogsOptions) + listCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listCatalogsOptionsModel.Secret = core.StringPtr("testString") + listCatalogsOptionsModel.DefaultCatalogs = core.BoolPtr(false) + listCatalogsOptionsModel.View = core.StringPtr("testString") + listCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) + result, response, operationErr := watsonxDataService.ListCatalogs(listCatalogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -21221,46 +22546,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptions *GetSalIntegrationUploadGlossaryStatusOptions) - Operation response error`, func() { - getSalIntegrationUploadGlossaryStatusPath := "/sal_integrations/upload_glossary_status" + Describe(`GetCatalogEngineAssociation(getCatalogEngineAssociationOptions *GetCatalogEngineAssociationOptions) - Operation response error`, func() { + getCatalogEngineAssociationPath := "/v3/catalogs/testString/engines" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationUploadGlossaryStatusPath)) + Expect(req.URL.EscapedPath()).To(Equal(getCatalogEngineAssociationPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["process_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSalIntegrationUploadGlossaryStatus with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetCatalogEngineAssociation with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationUploadGlossaryStatusOptions model - getSalIntegrationUploadGlossaryStatusOptionsModel := new(watsonxdatav2.GetSalIntegrationUploadGlossaryStatusOptions) - getSalIntegrationUploadGlossaryStatusOptionsModel.ProcessID = core.StringPtr("testString") - getSalIntegrationUploadGlossaryStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationUploadGlossaryStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogEngineAssociationOptions model + getCatalogEngineAssociationOptionsModel := new(watsonxdatav3.GetCatalogEngineAssociationOptions) + getCatalogEngineAssociationOptionsModel.CatalogName = core.StringPtr("testString") + getCatalogEngineAssociationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getCatalogEngineAssociationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) + result, response, operationErr := watsonxDataService.GetCatalogEngineAssociation(getCatalogEngineAssociationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) + result, response, operationErr = watsonxDataService.GetCatalogEngineAssociation(getCatalogEngineAssociationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -21270,31 +22594,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptions *GetSalIntegrationUploadGlossaryStatusOptions)`, func() { - getSalIntegrationUploadGlossaryStatusPath := "/sal_integrations/upload_glossary_status" + Describe(`GetCatalogEngineAssociation(getCatalogEngineAssociationOptions *GetCatalogEngineAssociationOptions)`, func() { + getCatalogEngineAssociationPath := "/v3/catalogs/testString/engines" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationUploadGlossaryStatusPath)) + Expect(req.URL.EscapedPath()).To(Equal(getCatalogEngineAssociationPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["process_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": "Import status available"}`) + fmt.Fprintf(res, "%s", `{"associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg"}`) })) }) - It(`Invoke GetSalIntegrationUploadGlossaryStatus successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetCatalogEngineAssociation successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -21302,22 +22625,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSalIntegrationUploadGlossaryStatusOptions model - getSalIntegrationUploadGlossaryStatusOptionsModel := new(watsonxdatav2.GetSalIntegrationUploadGlossaryStatusOptions) - getSalIntegrationUploadGlossaryStatusOptionsModel.ProcessID = core.StringPtr("testString") - getSalIntegrationUploadGlossaryStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationUploadGlossaryStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogEngineAssociationOptions model + getCatalogEngineAssociationOptionsModel := new(watsonxdatav3.GetCatalogEngineAssociationOptions) + getCatalogEngineAssociationOptionsModel.CatalogName = core.StringPtr("testString") + getCatalogEngineAssociationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getCatalogEngineAssociationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatusWithContext(ctx, getSalIntegrationUploadGlossaryStatusOptionsModel) + _, _, operationErr := watsonxDataService.GetCatalogEngineAssociationWithContext(ctx, getCatalogEngineAssociationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) + result, response, operationErr := watsonxDataService.GetCatalogEngineAssociation(getCatalogEngineAssociationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -21325,7 +22648,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSalIntegrationUploadGlossaryStatusWithContext(ctx, getSalIntegrationUploadGlossaryStatusOptionsModel) + _, _, operationErr = watsonxDataService.GetCatalogEngineAssociationWithContext(ctx, getCatalogEngineAssociationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -21339,20 +22662,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationUploadGlossaryStatusPath)) + Expect(req.URL.EscapedPath()).To(Equal(getCatalogEngineAssociationPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["process_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": "Import status available"}`) + fmt.Fprintf(res, "%s", `{"associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg"}`) })) }) - It(`Invoke GetSalIntegrationUploadGlossaryStatus successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetCatalogEngineAssociation successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -21360,45 +22682,52 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(nil) + result, response, operationErr := watsonxDataService.GetCatalogEngineAssociation(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSalIntegrationUploadGlossaryStatusOptions model - getSalIntegrationUploadGlossaryStatusOptionsModel := new(watsonxdatav2.GetSalIntegrationUploadGlossaryStatusOptions) - getSalIntegrationUploadGlossaryStatusOptionsModel.ProcessID = core.StringPtr("testString") - getSalIntegrationUploadGlossaryStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationUploadGlossaryStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogEngineAssociationOptions model + getCatalogEngineAssociationOptionsModel := new(watsonxdatav3.GetCatalogEngineAssociationOptions) + getCatalogEngineAssociationOptionsModel.CatalogName = core.StringPtr("testString") + getCatalogEngineAssociationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getCatalogEngineAssociationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) + result, response, operationErr = watsonxDataService.GetCatalogEngineAssociation(getCatalogEngineAssociationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSalIntegrationUploadGlossaryStatus with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetCatalogEngineAssociation with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationUploadGlossaryStatusOptions model - getSalIntegrationUploadGlossaryStatusOptionsModel := new(watsonxdatav2.GetSalIntegrationUploadGlossaryStatusOptions) - getSalIntegrationUploadGlossaryStatusOptionsModel.ProcessID = core.StringPtr("testString") - getSalIntegrationUploadGlossaryStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationUploadGlossaryStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogEngineAssociationOptions model + getCatalogEngineAssociationOptionsModel := new(watsonxdatav3.GetCatalogEngineAssociationOptions) + getCatalogEngineAssociationOptionsModel.CatalogName = core.StringPtr("testString") + getCatalogEngineAssociationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getCatalogEngineAssociationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) + result, response, operationErr := watsonxDataService.GetCatalogEngineAssociation(getCatalogEngineAssociationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the GetCatalogEngineAssociationOptions model with no property values + getCatalogEngineAssociationOptionsModelNew := new(watsonxdatav3.GetCatalogEngineAssociationOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.GetCatalogEngineAssociation(getCatalogEngineAssociationOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -21413,22 +22742,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSalIntegrationUploadGlossaryStatus successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetCatalogEngineAssociation successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSalIntegrationUploadGlossaryStatusOptions model - getSalIntegrationUploadGlossaryStatusOptionsModel := new(watsonxdatav2.GetSalIntegrationUploadGlossaryStatusOptions) - getSalIntegrationUploadGlossaryStatusOptionsModel.ProcessID = core.StringPtr("testString") - getSalIntegrationUploadGlossaryStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSalIntegrationUploadGlossaryStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogEngineAssociationOptions model + getCatalogEngineAssociationOptionsModel := new(watsonxdatav3.GetCatalogEngineAssociationOptions) + getCatalogEngineAssociationOptionsModel.CatalogName = core.StringPtr("testString") + getCatalogEngineAssociationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getCatalogEngineAssociationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) + result, response, operationErr := watsonxDataService.GetCatalogEngineAssociation(getCatalogEngineAssociationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -21440,44 +22769,125 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListSparkEngines(listSparkEnginesOptions *ListSparkEnginesOptions) - Operation response error`, func() { - listSparkEnginesPath := "/spark_engines" + Describe(`DeleteSchema(deleteSchemaOptions *DeleteSchemaOptions)`, func() { + deleteSchemaPath := "/v3/catalogs/testString/schemas/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteSchemaPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteSchema successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteSchema(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteSchemaOptions model + deleteSchemaOptionsModel := new(watsonxdatav3.DeleteSchemaOptions) + deleteSchemaOptionsModel.EngineID = core.StringPtr("testString") + deleteSchemaOptionsModel.CatalogName = core.StringPtr("testString") + deleteSchemaOptionsModel.SchemaName = core.StringPtr("testString") + deleteSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteSchema(deleteSchemaOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteSchema with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DeleteSchemaOptions model + deleteSchemaOptionsModel := new(watsonxdatav3.DeleteSchemaOptions) + deleteSchemaOptionsModel.EngineID = core.StringPtr("testString") + deleteSchemaOptionsModel.CatalogName = core.StringPtr("testString") + deleteSchemaOptionsModel.SchemaName = core.StringPtr("testString") + deleteSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteSchema(deleteSchemaOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSchemaOptions model with no property values + deleteSchemaOptionsModelNew := new(watsonxdatav3.DeleteSchemaOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteSchema(deleteSchemaOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListTables(listTablesOptions *ListTablesOptions) - Operation response error`, func() { + listTablesPath := "/v3/catalogs/testString/schemas/testString/tables" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listTablesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListSparkEngines with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListTables with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkEnginesOptions model - listSparkEnginesOptionsModel := new(watsonxdatav2.ListSparkEnginesOptions) - listSparkEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListTablesOptions model + listTablesOptionsModel := new(watsonxdatav3.ListTablesOptions) + listTablesOptionsModel.CatalogName = core.StringPtr("testString") + listTablesOptionsModel.SchemaName = core.StringPtr("testString") + listTablesOptionsModel.EngineID = core.StringPtr("testString") + listTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListTables(listTablesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + result, response, operationErr = watsonxDataService.ListTables(listTablesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -21487,30 +22897,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListSparkEngines(listSparkEnginesOptions *ListSparkEnginesOptions)`, func() { - listSparkEnginesPath := "/spark_engines" + Describe(`ListTables(listTablesOptions *ListTablesOptions)`, func() { + listTablesPath := "/v3/catalogs/testString/schemas/testString/tables" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listTablesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"spark_engines": [{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "spark engine for running sql queries", "engine_details": {"api_key": "apikey", "connection_string": "https://xyz..ae.cloud.123.com/v3/analytics-engines/", "default_config": {"config1": "Config1", "config2": "Config2"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home_bucket_display_name": "test-spark-bucket", "engine_home_bucket_name": "test-spark-bucket", "engine_home_path": "spark/spark1234", "engine_home_volume": "test-spark-volume", "engine_home_volume_id": "1704979825978585", "engine_home_volume_name": "my-volume", "engine_home_volume_storage_class": "nfs-client", "engine_home_volume_storage_size": "5Gi", "instance_id": "spark-id", "engine_sub_type": "java/cpp", "managed_by": "fully/self", "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "origin": "external", "status": "Registered", "tags": ["Tags"], "type": "spark"}]}`) + fmt.Fprintf(res, "%s", `{"tables": ["Tables"]}`) })) }) - It(`Invoke ListSparkEngines successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListTables successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -21518,21 +22929,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListSparkEnginesOptions model - listSparkEnginesOptionsModel := new(watsonxdatav2.ListSparkEnginesOptions) - listSparkEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListTablesOptions model + listTablesOptionsModel := new(watsonxdatav3.ListTablesOptions) + listTablesOptionsModel.CatalogName = core.StringPtr("testString") + listTablesOptionsModel.SchemaName = core.StringPtr("testString") + listTablesOptionsModel.EngineID = core.StringPtr("testString") + listTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListSparkEnginesWithContext(ctx, listSparkEnginesOptionsModel) + _, _, operationErr := watsonxDataService.ListTablesWithContext(ctx, listTablesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListTables(listTablesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -21540,7 +22954,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListSparkEnginesWithContext(ctx, listSparkEnginesOptionsModel) + _, _, operationErr = watsonxDataService.ListTablesWithContext(ctx, listTablesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -21554,19 +22968,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkEnginesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listTablesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"spark_engines": [{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "spark engine for running sql queries", "engine_details": {"api_key": "apikey", "connection_string": "https://xyz..ae.cloud.123.com/v3/analytics-engines/", "default_config": {"config1": "Config1", "config2": "Config2"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home_bucket_display_name": "test-spark-bucket", "engine_home_bucket_name": "test-spark-bucket", "engine_home_path": "spark/spark1234", "engine_home_volume": "test-spark-volume", "engine_home_volume_id": "1704979825978585", "engine_home_volume_name": "my-volume", "engine_home_volume_storage_class": "nfs-client", "engine_home_volume_storage_size": "5Gi", "instance_id": "spark-id", "engine_sub_type": "java/cpp", "managed_by": "fully/self", "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "origin": "external", "status": "Registered", "tags": ["Tags"], "type": "spark"}]}`) + fmt.Fprintf(res, "%s", `{"tables": ["Tables"]}`) })) }) - It(`Invoke ListSparkEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListTables successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -21574,43 +22989,56 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListSparkEngines(nil) + result, response, operationErr := watsonxDataService.ListTables(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSparkEnginesOptions model - listSparkEnginesOptionsModel := new(watsonxdatav2.ListSparkEnginesOptions) - listSparkEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListTablesOptions model + listTablesOptionsModel := new(watsonxdatav3.ListTablesOptions) + listTablesOptionsModel.CatalogName = core.StringPtr("testString") + listTablesOptionsModel.SchemaName = core.StringPtr("testString") + listTablesOptionsModel.EngineID = core.StringPtr("testString") + listTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + result, response, operationErr = watsonxDataService.ListTables(listTablesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListSparkEngines with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListTables with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkEnginesOptions model - listSparkEnginesOptionsModel := new(watsonxdatav2.ListSparkEnginesOptions) - listSparkEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListTablesOptions model + listTablesOptionsModel := new(watsonxdatav3.ListTablesOptions) + listTablesOptionsModel.CatalogName = core.StringPtr("testString") + listTablesOptionsModel.SchemaName = core.StringPtr("testString") + listTablesOptionsModel.EngineID = core.StringPtr("testString") + listTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListTables(listTablesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the ListTablesOptions model with no property values + listTablesOptionsModelNew := new(watsonxdatav3.ListTablesOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.ListTables(listTablesOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -21625,21 +23053,24 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListSparkEngines successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListTables successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkEnginesOptions model - listSparkEnginesOptionsModel := new(watsonxdatav2.ListSparkEnginesOptions) - listSparkEnginesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEnginesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListTablesOptions model + listTablesOptionsModel := new(watsonxdatav3.ListTablesOptions) + listTablesOptionsModel.CatalogName = core.StringPtr("testString") + listTablesOptionsModel.SchemaName = core.StringPtr("testString") + listTablesOptionsModel.EngineID = core.StringPtr("testString") + listTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListSparkEngines(listSparkEnginesOptionsModel) + result, response, operationErr := watsonxDataService.ListTables(listTablesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -21651,84 +23082,51 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSparkEngine(createSparkEngineOptions *CreateSparkEngineOptions) - Operation response error`, func() { - createSparkEnginePath := "/spark_engines" + Describe(`GetTable(getTableOptions *GetTableOptions) - Operation response error`, func() { + getTablePath := "/v3/catalogs/testString/schemas/testString/tables/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSparkEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getTablePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSparkEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetTable with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SparkDefaultConfig model - sparkDefaultConfigModel := new(watsonxdatav2.SparkDefaultConfig) - sparkDefaultConfigModel.Config1 = core.StringPtr("testString") - sparkDefaultConfigModel.Config2 = core.StringPtr("testString") - - // Construct an instance of the SparkScaleConfig model - sparkScaleConfigModel := new(watsonxdatav2.SparkScaleConfig) - sparkScaleConfigModel.AutoScaleEnabled = core.BoolPtr(true) - sparkScaleConfigModel.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) - sparkScaleConfigModel.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) - sparkScaleConfigModel.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) - sparkScaleConfigModel.NodeType = core.StringPtr("small") - sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(5)) - - // Construct an instance of the SparkEngineDetailsPrototype model - sparkEngineDetailsPrototypeModel := new(watsonxdatav2.SparkEngineDetailsPrototype) - sparkEngineDetailsPrototypeModel.ApiKey = core.StringPtr("apikey") - sparkEngineDetailsPrototypeModel.ConnectionString = core.StringPtr("1.2.3.4") - sparkEngineDetailsPrototypeModel.DefaultConfig = sparkDefaultConfigModel - sparkEngineDetailsPrototypeModel.DefaultVersion = core.StringPtr("3.3") - sparkEngineDetailsPrototypeModel.EngineHomeBucketDisplayName = core.StringPtr("test-spark-bucket") - sparkEngineDetailsPrototypeModel.EngineHomeBucketName = core.StringPtr("4fec0f8b-888a-4c16-8f38-250c8499e6ce-customer") - sparkEngineDetailsPrototypeModel.EngineHomePath = core.StringPtr("spark/spark1234") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeID = core.StringPtr("1704979825978585") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeName = core.StringPtr("my-volume") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageClass = core.StringPtr("nfs-client") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageSize = core.StringPtr("5Gi") - sparkEngineDetailsPrototypeModel.EngineSubType = core.StringPtr("java/cpp") - sparkEngineDetailsPrototypeModel.InstanceID = core.StringPtr("spark-id") - sparkEngineDetailsPrototypeModel.ManagedBy = core.StringPtr("fully/self") - sparkEngineDetailsPrototypeModel.ScaleConfig = sparkScaleConfigModel - - // Construct an instance of the CreateSparkEngineOptions model - createSparkEngineOptionsModel := new(watsonxdatav2.CreateSparkEngineOptions) - createSparkEngineOptionsModel.Origin = core.StringPtr("native") - createSparkEngineOptionsModel.AssociatedCatalogs = []string{"iceberg-data"} - createSparkEngineOptionsModel.Description = core.StringPtr("testString") - createSparkEngineOptionsModel.EngineDetails = sparkEngineDetailsPrototypeModel - createSparkEngineOptionsModel.EngineDisplayName = core.StringPtr("test-native") - createSparkEngineOptionsModel.Status = core.StringPtr("testString") - createSparkEngineOptionsModel.Tags = []string{"testString"} - createSparkEngineOptionsModel.Type = core.StringPtr("spark") - createSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetTableOptions model + getTableOptionsModel := new(watsonxdatav3.GetTableOptions) + getTableOptionsModel.CatalogName = core.StringPtr("testString") + getTableOptionsModel.SchemaName = core.StringPtr("testString") + getTableOptionsModel.TableName = core.StringPtr("testString") + getTableOptionsModel.EngineID = core.StringPtr("testString") + getTableOptionsModel.Type = core.StringPtr("testString") + getTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + getTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetTable(getTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.GetTable(getTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -21738,46 +23136,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSparkEngine(createSparkEngineOptions *CreateSparkEngineOptions)`, func() { - createSparkEnginePath := "/spark_engines" + Describe(`GetTable(getTableOptions *GetTableOptions)`, func() { + getTablePath := "/v3/catalogs/testString/schemas/testString/tables/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSparkEnginePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getTablePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "spark engine for running sql queries", "engine_details": {"api_key": "apikey", "connection_string": "https://xyz..ae.cloud.123.com/v3/analytics-engines/", "default_config": {"config1": "Config1", "config2": "Config2"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home_bucket_display_name": "test-spark-bucket", "engine_home_bucket_name": "test-spark-bucket", "engine_home_path": "spark/spark1234", "engine_home_volume": "test-spark-volume", "engine_home_volume_id": "1704979825978585", "engine_home_volume_name": "my-volume", "engine_home_volume_storage_class": "nfs-client", "engine_home_volume_storage_size": "5Gi", "instance_id": "spark-id", "engine_sub_type": "java/cpp", "managed_by": "fully/self", "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "origin": "external", "status": "Registered", "tags": ["Tags"], "type": "spark"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"columns": [{"comment": "Expenses column for each department", "extra": "AUTO_INCREMENT", "length": "30", "name": "expenses", "precision": "10", "scale": "2", "type": "varchar"}], "name": "Name"}`) })) }) - It(`Invoke CreateSparkEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetTable successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -21785,61 +23169,26 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the SparkDefaultConfig model - sparkDefaultConfigModel := new(watsonxdatav2.SparkDefaultConfig) - sparkDefaultConfigModel.Config1 = core.StringPtr("testString") - sparkDefaultConfigModel.Config2 = core.StringPtr("testString") - - // Construct an instance of the SparkScaleConfig model - sparkScaleConfigModel := new(watsonxdatav2.SparkScaleConfig) - sparkScaleConfigModel.AutoScaleEnabled = core.BoolPtr(true) - sparkScaleConfigModel.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) - sparkScaleConfigModel.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) - sparkScaleConfigModel.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) - sparkScaleConfigModel.NodeType = core.StringPtr("small") - sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(5)) - - // Construct an instance of the SparkEngineDetailsPrototype model - sparkEngineDetailsPrototypeModel := new(watsonxdatav2.SparkEngineDetailsPrototype) - sparkEngineDetailsPrototypeModel.ApiKey = core.StringPtr("apikey") - sparkEngineDetailsPrototypeModel.ConnectionString = core.StringPtr("1.2.3.4") - sparkEngineDetailsPrototypeModel.DefaultConfig = sparkDefaultConfigModel - sparkEngineDetailsPrototypeModel.DefaultVersion = core.StringPtr("3.3") - sparkEngineDetailsPrototypeModel.EngineHomeBucketDisplayName = core.StringPtr("test-spark-bucket") - sparkEngineDetailsPrototypeModel.EngineHomeBucketName = core.StringPtr("4fec0f8b-888a-4c16-8f38-250c8499e6ce-customer") - sparkEngineDetailsPrototypeModel.EngineHomePath = core.StringPtr("spark/spark1234") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeID = core.StringPtr("1704979825978585") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeName = core.StringPtr("my-volume") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageClass = core.StringPtr("nfs-client") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageSize = core.StringPtr("5Gi") - sparkEngineDetailsPrototypeModel.EngineSubType = core.StringPtr("java/cpp") - sparkEngineDetailsPrototypeModel.InstanceID = core.StringPtr("spark-id") - sparkEngineDetailsPrototypeModel.ManagedBy = core.StringPtr("fully/self") - sparkEngineDetailsPrototypeModel.ScaleConfig = sparkScaleConfigModel - - // Construct an instance of the CreateSparkEngineOptions model - createSparkEngineOptionsModel := new(watsonxdatav2.CreateSparkEngineOptions) - createSparkEngineOptionsModel.Origin = core.StringPtr("native") - createSparkEngineOptionsModel.AssociatedCatalogs = []string{"iceberg-data"} - createSparkEngineOptionsModel.Description = core.StringPtr("testString") - createSparkEngineOptionsModel.EngineDetails = sparkEngineDetailsPrototypeModel - createSparkEngineOptionsModel.EngineDisplayName = core.StringPtr("test-native") - createSparkEngineOptionsModel.Status = core.StringPtr("testString") - createSparkEngineOptionsModel.Tags = []string{"testString"} - createSparkEngineOptionsModel.Type = core.StringPtr("spark") - createSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetTableOptions model + getTableOptionsModel := new(watsonxdatav3.GetTableOptions) + getTableOptionsModel.CatalogName = core.StringPtr("testString") + getTableOptionsModel.SchemaName = core.StringPtr("testString") + getTableOptionsModel.TableName = core.StringPtr("testString") + getTableOptionsModel.EngineID = core.StringPtr("testString") + getTableOptionsModel.Type = core.StringPtr("testString") + getTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + getTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateSparkEngineWithContext(ctx, createSparkEngineOptionsModel) + _, _, operationErr := watsonxDataService.GetTableWithContext(ctx, getTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetTable(getTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -21847,7 +23196,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateSparkEngineWithContext(ctx, createSparkEngineOptionsModel) + _, _, operationErr = watsonxDataService.GetTableWithContext(ctx, getTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -21861,35 +23210,21 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSparkEnginePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getTablePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "spark engine for running sql queries", "engine_details": {"api_key": "apikey", "connection_string": "https://xyz..ae.cloud.123.com/v3/analytics-engines/", "default_config": {"config1": "Config1", "config2": "Config2"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home_bucket_display_name": "test-spark-bucket", "engine_home_bucket_name": "test-spark-bucket", "engine_home_path": "spark/spark1234", "engine_home_volume": "test-spark-volume", "engine_home_volume_id": "1704979825978585", "engine_home_volume_name": "my-volume", "engine_home_volume_storage_class": "nfs-client", "engine_home_volume_storage_size": "5Gi", "instance_id": "spark-id", "engine_sub_type": "java/cpp", "managed_by": "fully/self", "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "origin": "external", "status": "Registered", "tags": ["Tags"], "type": "spark"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"columns": [{"comment": "Expenses column for each department", "extra": "AUTO_INCREMENT", "length": "30", "name": "expenses", "precision": "10", "scale": "2", "type": "varchar"}], "name": "Name"}`) })) }) - It(`Invoke CreateSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetTable successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -21897,127 +23232,57 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateSparkEngine(nil) + result, response, operationErr := watsonxDataService.GetTable(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SparkDefaultConfig model - sparkDefaultConfigModel := new(watsonxdatav2.SparkDefaultConfig) - sparkDefaultConfigModel.Config1 = core.StringPtr("testString") - sparkDefaultConfigModel.Config2 = core.StringPtr("testString") - - // Construct an instance of the SparkScaleConfig model - sparkScaleConfigModel := new(watsonxdatav2.SparkScaleConfig) - sparkScaleConfigModel.AutoScaleEnabled = core.BoolPtr(true) - sparkScaleConfigModel.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) - sparkScaleConfigModel.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) - sparkScaleConfigModel.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) - sparkScaleConfigModel.NodeType = core.StringPtr("small") - sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(5)) - - // Construct an instance of the SparkEngineDetailsPrototype model - sparkEngineDetailsPrototypeModel := new(watsonxdatav2.SparkEngineDetailsPrototype) - sparkEngineDetailsPrototypeModel.ApiKey = core.StringPtr("apikey") - sparkEngineDetailsPrototypeModel.ConnectionString = core.StringPtr("1.2.3.4") - sparkEngineDetailsPrototypeModel.DefaultConfig = sparkDefaultConfigModel - sparkEngineDetailsPrototypeModel.DefaultVersion = core.StringPtr("3.3") - sparkEngineDetailsPrototypeModel.EngineHomeBucketDisplayName = core.StringPtr("test-spark-bucket") - sparkEngineDetailsPrototypeModel.EngineHomeBucketName = core.StringPtr("4fec0f8b-888a-4c16-8f38-250c8499e6ce-customer") - sparkEngineDetailsPrototypeModel.EngineHomePath = core.StringPtr("spark/spark1234") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeID = core.StringPtr("1704979825978585") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeName = core.StringPtr("my-volume") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageClass = core.StringPtr("nfs-client") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageSize = core.StringPtr("5Gi") - sparkEngineDetailsPrototypeModel.EngineSubType = core.StringPtr("java/cpp") - sparkEngineDetailsPrototypeModel.InstanceID = core.StringPtr("spark-id") - sparkEngineDetailsPrototypeModel.ManagedBy = core.StringPtr("fully/self") - sparkEngineDetailsPrototypeModel.ScaleConfig = sparkScaleConfigModel - - // Construct an instance of the CreateSparkEngineOptions model - createSparkEngineOptionsModel := new(watsonxdatav2.CreateSparkEngineOptions) - createSparkEngineOptionsModel.Origin = core.StringPtr("native") - createSparkEngineOptionsModel.AssociatedCatalogs = []string{"iceberg-data"} - createSparkEngineOptionsModel.Description = core.StringPtr("testString") - createSparkEngineOptionsModel.EngineDetails = sparkEngineDetailsPrototypeModel - createSparkEngineOptionsModel.EngineDisplayName = core.StringPtr("test-native") - createSparkEngineOptionsModel.Status = core.StringPtr("testString") - createSparkEngineOptionsModel.Tags = []string{"testString"} - createSparkEngineOptionsModel.Type = core.StringPtr("spark") - createSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetTableOptions model + getTableOptionsModel := new(watsonxdatav3.GetTableOptions) + getTableOptionsModel.CatalogName = core.StringPtr("testString") + getTableOptionsModel.SchemaName = core.StringPtr("testString") + getTableOptionsModel.TableName = core.StringPtr("testString") + getTableOptionsModel.EngineID = core.StringPtr("testString") + getTableOptionsModel.Type = core.StringPtr("testString") + getTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + getTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.GetTable(getTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSparkEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetTable with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SparkDefaultConfig model - sparkDefaultConfigModel := new(watsonxdatav2.SparkDefaultConfig) - sparkDefaultConfigModel.Config1 = core.StringPtr("testString") - sparkDefaultConfigModel.Config2 = core.StringPtr("testString") - - // Construct an instance of the SparkScaleConfig model - sparkScaleConfigModel := new(watsonxdatav2.SparkScaleConfig) - sparkScaleConfigModel.AutoScaleEnabled = core.BoolPtr(true) - sparkScaleConfigModel.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) - sparkScaleConfigModel.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) - sparkScaleConfigModel.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) - sparkScaleConfigModel.NodeType = core.StringPtr("small") - sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(5)) - - // Construct an instance of the SparkEngineDetailsPrototype model - sparkEngineDetailsPrototypeModel := new(watsonxdatav2.SparkEngineDetailsPrototype) - sparkEngineDetailsPrototypeModel.ApiKey = core.StringPtr("apikey") - sparkEngineDetailsPrototypeModel.ConnectionString = core.StringPtr("1.2.3.4") - sparkEngineDetailsPrototypeModel.DefaultConfig = sparkDefaultConfigModel - sparkEngineDetailsPrototypeModel.DefaultVersion = core.StringPtr("3.3") - sparkEngineDetailsPrototypeModel.EngineHomeBucketDisplayName = core.StringPtr("test-spark-bucket") - sparkEngineDetailsPrototypeModel.EngineHomeBucketName = core.StringPtr("4fec0f8b-888a-4c16-8f38-250c8499e6ce-customer") - sparkEngineDetailsPrototypeModel.EngineHomePath = core.StringPtr("spark/spark1234") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeID = core.StringPtr("1704979825978585") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeName = core.StringPtr("my-volume") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageClass = core.StringPtr("nfs-client") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageSize = core.StringPtr("5Gi") - sparkEngineDetailsPrototypeModel.EngineSubType = core.StringPtr("java/cpp") - sparkEngineDetailsPrototypeModel.InstanceID = core.StringPtr("spark-id") - sparkEngineDetailsPrototypeModel.ManagedBy = core.StringPtr("fully/self") - sparkEngineDetailsPrototypeModel.ScaleConfig = sparkScaleConfigModel - - // Construct an instance of the CreateSparkEngineOptions model - createSparkEngineOptionsModel := new(watsonxdatav2.CreateSparkEngineOptions) - createSparkEngineOptionsModel.Origin = core.StringPtr("native") - createSparkEngineOptionsModel.AssociatedCatalogs = []string{"iceberg-data"} - createSparkEngineOptionsModel.Description = core.StringPtr("testString") - createSparkEngineOptionsModel.EngineDetails = sparkEngineDetailsPrototypeModel - createSparkEngineOptionsModel.EngineDisplayName = core.StringPtr("test-native") - createSparkEngineOptionsModel.Status = core.StringPtr("testString") - createSparkEngineOptionsModel.Tags = []string{"testString"} - createSparkEngineOptionsModel.Type = core.StringPtr("spark") - createSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetTableOptions model + getTableOptionsModel := new(watsonxdatav3.GetTableOptions) + getTableOptionsModel.CatalogName = core.StringPtr("testString") + getTableOptionsModel.SchemaName = core.StringPtr("testString") + getTableOptionsModel.TableName = core.StringPtr("testString") + getTableOptionsModel.EngineID = core.StringPtr("testString") + getTableOptionsModel.Type = core.StringPtr("testString") + getTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + getTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetTable(getTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateSparkEngineOptions model with no property values - createSparkEngineOptionsModelNew := new(watsonxdatav2.CreateSparkEngineOptions) + // Construct a second instance of the GetTableOptions model with no property values + getTableOptionsModelNew := new(watsonxdatav3.GetTableOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.GetTable(getTableOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -22032,64 +23297,29 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke CreateSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetTable successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SparkDefaultConfig model - sparkDefaultConfigModel := new(watsonxdatav2.SparkDefaultConfig) - sparkDefaultConfigModel.Config1 = core.StringPtr("testString") - sparkDefaultConfigModel.Config2 = core.StringPtr("testString") - - // Construct an instance of the SparkScaleConfig model - sparkScaleConfigModel := new(watsonxdatav2.SparkScaleConfig) - sparkScaleConfigModel.AutoScaleEnabled = core.BoolPtr(true) - sparkScaleConfigModel.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) - sparkScaleConfigModel.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) - sparkScaleConfigModel.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) - sparkScaleConfigModel.NodeType = core.StringPtr("small") - sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(5)) - - // Construct an instance of the SparkEngineDetailsPrototype model - sparkEngineDetailsPrototypeModel := new(watsonxdatav2.SparkEngineDetailsPrototype) - sparkEngineDetailsPrototypeModel.ApiKey = core.StringPtr("apikey") - sparkEngineDetailsPrototypeModel.ConnectionString = core.StringPtr("1.2.3.4") - sparkEngineDetailsPrototypeModel.DefaultConfig = sparkDefaultConfigModel - sparkEngineDetailsPrototypeModel.DefaultVersion = core.StringPtr("3.3") - sparkEngineDetailsPrototypeModel.EngineHomeBucketDisplayName = core.StringPtr("test-spark-bucket") - sparkEngineDetailsPrototypeModel.EngineHomeBucketName = core.StringPtr("4fec0f8b-888a-4c16-8f38-250c8499e6ce-customer") - sparkEngineDetailsPrototypeModel.EngineHomePath = core.StringPtr("spark/spark1234") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeID = core.StringPtr("1704979825978585") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeName = core.StringPtr("my-volume") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageClass = core.StringPtr("nfs-client") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageSize = core.StringPtr("5Gi") - sparkEngineDetailsPrototypeModel.EngineSubType = core.StringPtr("java/cpp") - sparkEngineDetailsPrototypeModel.InstanceID = core.StringPtr("spark-id") - sparkEngineDetailsPrototypeModel.ManagedBy = core.StringPtr("fully/self") - sparkEngineDetailsPrototypeModel.ScaleConfig = sparkScaleConfigModel - - // Construct an instance of the CreateSparkEngineOptions model - createSparkEngineOptionsModel := new(watsonxdatav2.CreateSparkEngineOptions) - createSparkEngineOptionsModel.Origin = core.StringPtr("native") - createSparkEngineOptionsModel.AssociatedCatalogs = []string{"iceberg-data"} - createSparkEngineOptionsModel.Description = core.StringPtr("testString") - createSparkEngineOptionsModel.EngineDetails = sparkEngineDetailsPrototypeModel - createSparkEngineOptionsModel.EngineDisplayName = core.StringPtr("test-native") - createSparkEngineOptionsModel.Status = core.StringPtr("testString") - createSparkEngineOptionsModel.Tags = []string{"testString"} - createSparkEngineOptionsModel.Type = core.StringPtr("spark") - createSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetTableOptions model + getTableOptionsModel := new(watsonxdatav3.GetTableOptions) + getTableOptionsModel.CatalogName = core.StringPtr("testString") + getTableOptionsModel.SchemaName = core.StringPtr("testString") + getTableOptionsModel.TableName = core.StringPtr("testString") + getTableOptionsModel.EngineID = core.StringPtr("testString") + getTableOptionsModel.Type = core.StringPtr("testString") + getTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + getTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateSparkEngine(createSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetTable(getTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -22101,45 +23331,140 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSparkEngine(getSparkEngineOptions *GetSparkEngineOptions) - Operation response error`, func() { - getSparkEnginePath := "/spark_engines/testString" + Describe(`DeleteTable(deleteTableOptions *DeleteTableOptions)`, func() { + deleteTablePath := "/v3/catalogs/testString/schemas/testString/tables/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteTablePath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteTable successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteTable(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteTableOptions model + deleteTableOptionsModel := new(watsonxdatav3.DeleteTableOptions) + deleteTableOptionsModel.CatalogName = core.StringPtr("testString") + deleteTableOptionsModel.SchemaName = core.StringPtr("testString") + deleteTableOptionsModel.TableName = core.StringPtr("testString") + deleteTableOptionsModel.EngineID = core.StringPtr("testString") + deleteTableOptionsModel.Type = core.StringPtr("testString") + deleteTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteTable(deleteTableOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteTable with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DeleteTableOptions model + deleteTableOptionsModel := new(watsonxdatav3.DeleteTableOptions) + deleteTableOptionsModel.CatalogName = core.StringPtr("testString") + deleteTableOptionsModel.SchemaName = core.StringPtr("testString") + deleteTableOptionsModel.TableName = core.StringPtr("testString") + deleteTableOptionsModel.EngineID = core.StringPtr("testString") + deleteTableOptionsModel.Type = core.StringPtr("testString") + deleteTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteTable(deleteTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteTableOptions model with no property values + deleteTableOptionsModelNew := new(watsonxdatav3.DeleteTableOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteTable(deleteTableOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateTable(updateTableOptions *UpdateTableOptions) - Operation response error`, func() { + updateTablePath := "/v3/catalogs/testString/schemas/testString/tables/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEnginePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateTablePath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSparkEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateTable with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSparkEngineOptions model - getSparkEngineOptionsModel := new(watsonxdatav2.GetSparkEngineOptions) - getSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the TablePatch model + tablePatchModel := new(watsonxdatav3.TablePatch) + tablePatchModel.Name = core.StringPtr("updated_table_name") + tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateTableOptions model + updateTableOptionsModel := new(watsonxdatav3.UpdateTableOptions) + updateTableOptionsModel.CatalogName = core.StringPtr("testString") + updateTableOptionsModel.SchemaName = core.StringPtr("testString") + updateTableOptionsModel.TableName = core.StringPtr("testString") + updateTableOptionsModel.EngineID = core.StringPtr("testString") + updateTableOptionsModel.Body = tablePatchModelAsPatch + updateTableOptionsModel.Type = core.StringPtr("testString") + updateTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateTable(updateTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.UpdateTable(updateTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -22149,30 +23474,48 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSparkEngine(getSparkEngineOptions *GetSparkEngineOptions)`, func() { - getSparkEnginePath := "/spark_engines/testString" + Describe(`UpdateTable(updateTableOptions *UpdateTableOptions)`, func() { + updateTablePath := "/v3/catalogs/testString/schemas/testString/tables/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEnginePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateTablePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "spark engine for running sql queries", "engine_details": {"api_key": "apikey", "connection_string": "https://xyz..ae.cloud.123.com/v3/analytics-engines/", "default_config": {"config1": "Config1", "config2": "Config2"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home_bucket_display_name": "test-spark-bucket", "engine_home_bucket_name": "test-spark-bucket", "engine_home_path": "spark/spark1234", "engine_home_volume": "test-spark-volume", "engine_home_volume_id": "1704979825978585", "engine_home_volume_name": "my-volume", "engine_home_volume_storage_class": "nfs-client", "engine_home_volume_storage_size": "5Gi", "instance_id": "spark-id", "engine_sub_type": "java/cpp", "managed_by": "fully/self", "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "origin": "external", "status": "Registered", "tags": ["Tags"], "type": "spark"}`) + fmt.Fprintf(res, "%s", `{"columns": [{"comment": "Expenses column for each department", "extra": "AUTO_INCREMENT", "length": "30", "name": "expenses", "precision": "10", "scale": "2", "type": "varchar"}], "name": "Name"}`) })) }) - It(`Invoke GetSparkEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateTable successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -22180,22 +23523,33 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSparkEngineOptions model - getSparkEngineOptionsModel := new(watsonxdatav2.GetSparkEngineOptions) - getSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the TablePatch model + tablePatchModel := new(watsonxdatav3.TablePatch) + tablePatchModel.Name = core.StringPtr("updated_table_name") + tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateTableOptions model + updateTableOptionsModel := new(watsonxdatav3.UpdateTableOptions) + updateTableOptionsModel.CatalogName = core.StringPtr("testString") + updateTableOptionsModel.SchemaName = core.StringPtr("testString") + updateTableOptionsModel.TableName = core.StringPtr("testString") + updateTableOptionsModel.EngineID = core.StringPtr("testString") + updateTableOptionsModel.Body = tablePatchModelAsPatch + updateTableOptionsModel.Type = core.StringPtr("testString") + updateTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSparkEngineWithContext(ctx, getSparkEngineOptionsModel) + _, _, operationErr := watsonxDataService.UpdateTableWithContext(ctx, updateTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateTable(updateTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -22203,7 +23557,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSparkEngineWithContext(ctx, getSparkEngineOptionsModel) + _, _, operationErr = watsonxDataService.UpdateTableWithContext(ctx, updateTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -22217,19 +23571,37 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEnginePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateTablePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "spark engine for running sql queries", "engine_details": {"api_key": "apikey", "connection_string": "https://xyz..ae.cloud.123.com/v3/analytics-engines/", "default_config": {"config1": "Config1", "config2": "Config2"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home_bucket_display_name": "test-spark-bucket", "engine_home_bucket_name": "test-spark-bucket", "engine_home_path": "spark/spark1234", "engine_home_volume": "test-spark-volume", "engine_home_volume_id": "1704979825978585", "engine_home_volume_name": "my-volume", "engine_home_volume_storage_class": "nfs-client", "engine_home_volume_storage_size": "5Gi", "instance_id": "spark-id", "engine_sub_type": "java/cpp", "managed_by": "fully/self", "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "origin": "external", "status": "Registered", "tags": ["Tags"], "type": "spark"}`) + fmt.Fprintf(res, "%s", `{"columns": [{"comment": "Expenses column for each department", "extra": "AUTO_INCREMENT", "length": "30", "name": "expenses", "precision": "10", "scale": "2", "type": "varchar"}], "name": "Name"}`) })) }) - It(`Invoke GetSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateTable successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -22237,49 +23609,71 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSparkEngine(nil) + result, response, operationErr := watsonxDataService.UpdateTable(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSparkEngineOptions model - getSparkEngineOptionsModel := new(watsonxdatav2.GetSparkEngineOptions) - getSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the TablePatch model + tablePatchModel := new(watsonxdatav3.TablePatch) + tablePatchModel.Name = core.StringPtr("updated_table_name") + tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateTableOptions model + updateTableOptionsModel := new(watsonxdatav3.UpdateTableOptions) + updateTableOptionsModel.CatalogName = core.StringPtr("testString") + updateTableOptionsModel.SchemaName = core.StringPtr("testString") + updateTableOptionsModel.TableName = core.StringPtr("testString") + updateTableOptionsModel.EngineID = core.StringPtr("testString") + updateTableOptionsModel.Body = tablePatchModelAsPatch + updateTableOptionsModel.Type = core.StringPtr("testString") + updateTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.UpdateTable(updateTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSparkEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateTable with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSparkEngineOptions model - getSparkEngineOptionsModel := new(watsonxdatav2.GetSparkEngineOptions) - getSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the TablePatch model + tablePatchModel := new(watsonxdatav3.TablePatch) + tablePatchModel.Name = core.StringPtr("updated_table_name") + tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateTableOptions model + updateTableOptionsModel := new(watsonxdatav3.UpdateTableOptions) + updateTableOptionsModel.CatalogName = core.StringPtr("testString") + updateTableOptionsModel.SchemaName = core.StringPtr("testString") + updateTableOptionsModel.TableName = core.StringPtr("testString") + updateTableOptionsModel.EngineID = core.StringPtr("testString") + updateTableOptionsModel.Body = tablePatchModelAsPatch + updateTableOptionsModel.Type = core.StringPtr("testString") + updateTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateTable(updateTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetSparkEngineOptions model with no property values - getSparkEngineOptionsModelNew := new(watsonxdatav2.GetSparkEngineOptions) + // Construct a second instance of the UpdateTableOptions model with no property values + updateTableOptionsModelNew := new(watsonxdatav3.UpdateTableOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetSparkEngine(getSparkEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdateTable(updateTableOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -22297,22 +23691,33 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateTable successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSparkEngineOptions model - getSparkEngineOptionsModel := new(watsonxdatav2.GetSparkEngineOptions) - getSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the TablePatch model + tablePatchModel := new(watsonxdatav3.TablePatch) + tablePatchModel.Name = core.StringPtr("updated_table_name") + tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateTableOptions model + updateTableOptionsModel := new(watsonxdatav3.UpdateTableOptions) + updateTableOptionsModel.CatalogName = core.StringPtr("testString") + updateTableOptionsModel.SchemaName = core.StringPtr("testString") + updateTableOptionsModel.TableName = core.StringPtr("testString") + updateTableOptionsModel.EngineID = core.StringPtr("testString") + updateTableOptionsModel.Body = tablePatchModelAsPatch + updateTableOptionsModel.Type = core.StringPtr("testString") + updateTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSparkEngine(getSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.UpdateTable(updateTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -22324,140 +23729,49 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteSparkEngine(deleteSparkEngineOptions *DeleteSparkEngineOptions)`, func() { - deleteSparkEnginePath := "/spark_engines/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSparkEnginePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteSparkEngine(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSparkEngineOptions model - deleteSparkEngineOptionsModel := new(watsonxdatav2.DeleteSparkEngineOptions) - deleteSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - deleteSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteSparkEngine(deleteSparkEngineOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSparkEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeleteSparkEngineOptions model - deleteSparkEngineOptionsModel := new(watsonxdatav2.DeleteSparkEngineOptions) - deleteSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - deleteSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteSparkEngine(deleteSparkEngineOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSparkEngineOptions model with no property values - deleteSparkEngineOptionsModelNew := new(watsonxdatav2.DeleteSparkEngineOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteSparkEngine(deleteSparkEngineOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateSparkEngine(updateSparkEngineOptions *UpdateSparkEngineOptions) - Operation response error`, func() { - updateSparkEnginePath := "/spark_engines/testString" + Describe(`ListColumns(listColumnsOptions *ListColumnsOptions) - Operation response error`, func() { + listColumnsPath := "/v3/catalogs/testString/schemas/testString/tables/testString/columns" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSparkEnginePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(listColumnsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateSparkEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListColumns with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SparkEngineResourceLimit model - sparkEngineResourceLimitModel := new(watsonxdatav2.SparkEngineResourceLimit) - sparkEngineResourceLimitModel.Cores = core.StringPtr("1") - sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") - - // Construct an instance of the UpdateSparkEngineBodyEngineDetails model - updateSparkEngineBodyEngineDetailsModel := new(watsonxdatav2.UpdateSparkEngineBodyEngineDetails) - updateSparkEngineBodyEngineDetailsModel.DefaultConfig = map[string]string{"key1": "testString"} - updateSparkEngineBodyEngineDetailsModel.DefaultVersion = core.StringPtr("3.4") - updateSparkEngineBodyEngineDetailsModel.EngineHomeBucketName = core.StringPtr("test-spark-bucket") - updateSparkEngineBodyEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) - updateSparkEngineBodyEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel - - // Construct an instance of the UpdateSparkEngineBody model - updateSparkEngineBodyModel := new(watsonxdatav2.UpdateSparkEngineBody) - updateSparkEngineBodyModel.Description = core.StringPtr("Updated Description") - updateSparkEngineBodyModel.EngineDetails = updateSparkEngineBodyEngineDetailsModel - updateSparkEngineBodyModel.EngineDisplayName = core.StringPtr("Updated Display Name") - updateSparkEngineBodyModel.Tags = []string{"tag1", "tag2"} - updateSparkEngineBodyModelAsPatch, asPatchErr := updateSparkEngineBodyModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSparkEngineOptions model - updateSparkEngineOptionsModel := new(watsonxdatav2.UpdateSparkEngineOptions) - updateSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - updateSparkEngineOptionsModel.Body = updateSparkEngineBodyModelAsPatch - updateSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListColumnsOptions model + listColumnsOptionsModel := new(watsonxdatav3.ListColumnsOptions) + listColumnsOptionsModel.EngineID = core.StringPtr("testString") + listColumnsOptionsModel.CatalogName = core.StringPtr("testString") + listColumnsOptionsModel.SchemaName = core.StringPtr("testString") + listColumnsOptionsModel.TableName = core.StringPtr("testString") + listColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListColumns(listColumnsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.ListColumns(listColumnsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -22467,46 +23781,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateSparkEngine(updateSparkEngineOptions *UpdateSparkEngineOptions)`, func() { - updateSparkEnginePath := "/spark_engines/testString" + Describe(`ListColumns(listColumnsOptions *ListColumnsOptions)`, func() { + listColumnsPath := "/v3/catalogs/testString/schemas/testString/tables/testString/columns" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSparkEnginePath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listColumnsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "spark engine for running sql queries", "engine_details": {"api_key": "apikey", "connection_string": "https://xyz..ae.cloud.123.com/v3/analytics-engines/", "default_config": {"config1": "Config1", "config2": "Config2"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home_bucket_display_name": "test-spark-bucket", "engine_home_bucket_name": "test-spark-bucket", "engine_home_path": "spark/spark1234", "engine_home_volume": "test-spark-volume", "engine_home_volume_id": "1704979825978585", "engine_home_volume_name": "my-volume", "engine_home_volume_storage_class": "nfs-client", "engine_home_volume_storage_size": "5Gi", "instance_id": "spark-id", "engine_sub_type": "java/cpp", "managed_by": "fully/self", "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "origin": "external", "status": "Registered", "tags": ["Tags"], "type": "spark"}`) + fmt.Fprintf(res, "%s", `{"columns": [{"comment": "Expenses column for each department", "extra": "AUTO_INCREMENT", "length": "30", "name": "expenses", "precision": "10", "scale": "2", "type": "varchar"}]}`) })) }) - It(`Invoke UpdateSparkEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListColumns successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -22514,45 +23813,25 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the SparkEngineResourceLimit model - sparkEngineResourceLimitModel := new(watsonxdatav2.SparkEngineResourceLimit) - sparkEngineResourceLimitModel.Cores = core.StringPtr("1") - sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") - - // Construct an instance of the UpdateSparkEngineBodyEngineDetails model - updateSparkEngineBodyEngineDetailsModel := new(watsonxdatav2.UpdateSparkEngineBodyEngineDetails) - updateSparkEngineBodyEngineDetailsModel.DefaultConfig = map[string]string{"key1": "testString"} - updateSparkEngineBodyEngineDetailsModel.DefaultVersion = core.StringPtr("3.4") - updateSparkEngineBodyEngineDetailsModel.EngineHomeBucketName = core.StringPtr("test-spark-bucket") - updateSparkEngineBodyEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) - updateSparkEngineBodyEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel - - // Construct an instance of the UpdateSparkEngineBody model - updateSparkEngineBodyModel := new(watsonxdatav2.UpdateSparkEngineBody) - updateSparkEngineBodyModel.Description = core.StringPtr("Updated Description") - updateSparkEngineBodyModel.EngineDetails = updateSparkEngineBodyEngineDetailsModel - updateSparkEngineBodyModel.EngineDisplayName = core.StringPtr("Updated Display Name") - updateSparkEngineBodyModel.Tags = []string{"tag1", "tag2"} - updateSparkEngineBodyModelAsPatch, asPatchErr := updateSparkEngineBodyModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSparkEngineOptions model - updateSparkEngineOptionsModel := new(watsonxdatav2.UpdateSparkEngineOptions) - updateSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - updateSparkEngineOptionsModel.Body = updateSparkEngineBodyModelAsPatch - updateSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListColumnsOptions model + listColumnsOptionsModel := new(watsonxdatav3.ListColumnsOptions) + listColumnsOptionsModel.EngineID = core.StringPtr("testString") + listColumnsOptionsModel.CatalogName = core.StringPtr("testString") + listColumnsOptionsModel.SchemaName = core.StringPtr("testString") + listColumnsOptionsModel.TableName = core.StringPtr("testString") + listColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateSparkEngineWithContext(ctx, updateSparkEngineOptionsModel) + _, _, operationErr := watsonxDataService.ListColumnsWithContext(ctx, listColumnsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListColumns(listColumnsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -22560,7 +23839,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateSparkEngineWithContext(ctx, updateSparkEngineOptionsModel) + _, _, operationErr = watsonxDataService.ListColumnsWithContext(ctx, listColumnsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -22574,35 +23853,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSparkEnginePath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listColumnsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_catalogs": ["AssociatedCatalogs"], "build_version": "1.0.3.0.0", "created_by": "@.com", "created_on": 9, "description": "spark engine for running sql queries", "engine_details": {"api_key": "apikey", "connection_string": "https://xyz..ae.cloud.123.com/v3/analytics-engines/", "default_config": {"config1": "Config1", "config2": "Config2"}, "default_version": "4.8.3", "endpoints": {"applications_api": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/", "history_server_endpoint": "$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server", "spark_access_endpoint": "$HOST/analytics-engine/details/spark-", "spark_jobs_v4_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications", "spark_kernel_endpoint": "$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels", "view_history_server": "ViewHistoryServer", "wxd_application_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications", "wxd_engine_endpoint": "$HOST/v1/1698311655308796/engines/spark817", "wxd_history_server_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server", "wxd_history_server_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/history_server/ui"}, "engine_home_bucket_display_name": "test-spark-bucket", "engine_home_bucket_name": "test-spark-bucket", "engine_home_path": "spark/spark1234", "engine_home_volume": "test-spark-volume", "engine_home_volume_id": "1704979825978585", "engine_home_volume_name": "my-volume", "engine_home_volume_storage_class": "nfs-client", "engine_home_volume_storage_size": "5Gi", "instance_id": "spark-id", "engine_sub_type": "java/cpp", "managed_by": "fully/self", "scale_config": {"auto_scale_enabled": true, "current_number_of_nodes": 2, "maximum_number_of_nodes": 5, "minimum_number_of_nodes": 1, "node_type": "medium", "number_of_nodes": 2}}, "engine_display_name": "sampleEngine", "engine_id": "sampleEngine123", "origin": "external", "status": "Registered", "tags": ["Tags"], "type": "spark"}`) + fmt.Fprintf(res, "%s", `{"columns": [{"comment": "Expenses column for each department", "extra": "AUTO_INCREMENT", "length": "30", "name": "expenses", "precision": "10", "scale": "2", "type": "varchar"}]}`) })) }) - It(`Invoke UpdateSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListColumns successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -22610,95 +23874,55 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateSparkEngine(nil) + result, response, operationErr := watsonxDataService.ListColumns(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SparkEngineResourceLimit model - sparkEngineResourceLimitModel := new(watsonxdatav2.SparkEngineResourceLimit) - sparkEngineResourceLimitModel.Cores = core.StringPtr("1") - sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") - - // Construct an instance of the UpdateSparkEngineBodyEngineDetails model - updateSparkEngineBodyEngineDetailsModel := new(watsonxdatav2.UpdateSparkEngineBodyEngineDetails) - updateSparkEngineBodyEngineDetailsModel.DefaultConfig = map[string]string{"key1": "testString"} - updateSparkEngineBodyEngineDetailsModel.DefaultVersion = core.StringPtr("3.4") - updateSparkEngineBodyEngineDetailsModel.EngineHomeBucketName = core.StringPtr("test-spark-bucket") - updateSparkEngineBodyEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) - updateSparkEngineBodyEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel - - // Construct an instance of the UpdateSparkEngineBody model - updateSparkEngineBodyModel := new(watsonxdatav2.UpdateSparkEngineBody) - updateSparkEngineBodyModel.Description = core.StringPtr("Updated Description") - updateSparkEngineBodyModel.EngineDetails = updateSparkEngineBodyEngineDetailsModel - updateSparkEngineBodyModel.EngineDisplayName = core.StringPtr("Updated Display Name") - updateSparkEngineBodyModel.Tags = []string{"tag1", "tag2"} - updateSparkEngineBodyModelAsPatch, asPatchErr := updateSparkEngineBodyModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSparkEngineOptions model - updateSparkEngineOptionsModel := new(watsonxdatav2.UpdateSparkEngineOptions) - updateSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - updateSparkEngineOptionsModel.Body = updateSparkEngineBodyModelAsPatch - updateSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListColumnsOptions model + listColumnsOptionsModel := new(watsonxdatav3.ListColumnsOptions) + listColumnsOptionsModel.EngineID = core.StringPtr("testString") + listColumnsOptionsModel.CatalogName = core.StringPtr("testString") + listColumnsOptionsModel.SchemaName = core.StringPtr("testString") + listColumnsOptionsModel.TableName = core.StringPtr("testString") + listColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.ListColumns(listColumnsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateSparkEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListColumns with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SparkEngineResourceLimit model - sparkEngineResourceLimitModel := new(watsonxdatav2.SparkEngineResourceLimit) - sparkEngineResourceLimitModel.Cores = core.StringPtr("1") - sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") - - // Construct an instance of the UpdateSparkEngineBodyEngineDetails model - updateSparkEngineBodyEngineDetailsModel := new(watsonxdatav2.UpdateSparkEngineBodyEngineDetails) - updateSparkEngineBodyEngineDetailsModel.DefaultConfig = map[string]string{"key1": "testString"} - updateSparkEngineBodyEngineDetailsModel.DefaultVersion = core.StringPtr("3.4") - updateSparkEngineBodyEngineDetailsModel.EngineHomeBucketName = core.StringPtr("test-spark-bucket") - updateSparkEngineBodyEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) - updateSparkEngineBodyEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel - - // Construct an instance of the UpdateSparkEngineBody model - updateSparkEngineBodyModel := new(watsonxdatav2.UpdateSparkEngineBody) - updateSparkEngineBodyModel.Description = core.StringPtr("Updated Description") - updateSparkEngineBodyModel.EngineDetails = updateSparkEngineBodyEngineDetailsModel - updateSparkEngineBodyModel.EngineDisplayName = core.StringPtr("Updated Display Name") - updateSparkEngineBodyModel.Tags = []string{"tag1", "tag2"} - updateSparkEngineBodyModelAsPatch, asPatchErr := updateSparkEngineBodyModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSparkEngineOptions model - updateSparkEngineOptionsModel := new(watsonxdatav2.UpdateSparkEngineOptions) - updateSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - updateSparkEngineOptionsModel.Body = updateSparkEngineBodyModelAsPatch - updateSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListColumnsOptions model + listColumnsOptionsModel := new(watsonxdatav3.ListColumnsOptions) + listColumnsOptionsModel.EngineID = core.StringPtr("testString") + listColumnsOptionsModel.CatalogName = core.StringPtr("testString") + listColumnsOptionsModel.SchemaName = core.StringPtr("testString") + listColumnsOptionsModel.TableName = core.StringPtr("testString") + listColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListColumns(listColumnsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateSparkEngineOptions model with no property values - updateSparkEngineOptionsModelNew := new(watsonxdatav2.UpdateSparkEngineOptions) + // Construct a second instance of the ListColumnsOptions model with no property values + listColumnsOptionsModelNew := new(watsonxdatav3.ListColumnsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.ListColumns(listColumnsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -22716,45 +23940,25 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListColumns successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SparkEngineResourceLimit model - sparkEngineResourceLimitModel := new(watsonxdatav2.SparkEngineResourceLimit) - sparkEngineResourceLimitModel.Cores = core.StringPtr("1") - sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") - - // Construct an instance of the UpdateSparkEngineBodyEngineDetails model - updateSparkEngineBodyEngineDetailsModel := new(watsonxdatav2.UpdateSparkEngineBodyEngineDetails) - updateSparkEngineBodyEngineDetailsModel.DefaultConfig = map[string]string{"key1": "testString"} - updateSparkEngineBodyEngineDetailsModel.DefaultVersion = core.StringPtr("3.4") - updateSparkEngineBodyEngineDetailsModel.EngineHomeBucketName = core.StringPtr("test-spark-bucket") - updateSparkEngineBodyEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) - updateSparkEngineBodyEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel - - // Construct an instance of the UpdateSparkEngineBody model - updateSparkEngineBodyModel := new(watsonxdatav2.UpdateSparkEngineBody) - updateSparkEngineBodyModel.Description = core.StringPtr("Updated Description") - updateSparkEngineBodyModel.EngineDetails = updateSparkEngineBodyEngineDetailsModel - updateSparkEngineBodyModel.EngineDisplayName = core.StringPtr("Updated Display Name") - updateSparkEngineBodyModel.Tags = []string{"tag1", "tag2"} - updateSparkEngineBodyModelAsPatch, asPatchErr := updateSparkEngineBodyModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSparkEngineOptions model - updateSparkEngineOptionsModel := new(watsonxdatav2.UpdateSparkEngineOptions) - updateSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - updateSparkEngineOptionsModel.Body = updateSparkEngineBodyModelAsPatch - updateSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListColumnsOptions model + listColumnsOptionsModel := new(watsonxdatav3.ListColumnsOptions) + listColumnsOptionsModel.EngineID = core.StringPtr("testString") + listColumnsOptionsModel.CatalogName = core.StringPtr("testString") + listColumnsOptionsModel.SchemaName = core.StringPtr("testString") + listColumnsOptionsModel.TableName = core.StringPtr("testString") + listColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdateSparkEngine(updateSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListColumns(listColumnsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -22766,46 +23970,60 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListSparkEngineApplications(listSparkEngineApplicationsOptions *ListSparkEngineApplicationsOptions) - Operation response error`, func() { - listSparkEngineApplicationsPath := "/spark_engines/testString/applications" + Describe(`CreateColumns(createColumnsOptions *CreateColumnsOptions) - Operation response error`, func() { + createColumnsPath := "/v3/catalogs/testString/schemas/testString/tables/testString/columns" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineApplicationsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createColumnsPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListSparkEngineApplications with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateColumns with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkEngineApplicationsOptions model - listSparkEngineApplicationsOptionsModel := new(watsonxdatav2.ListSparkEngineApplicationsOptions) - listSparkEngineApplicationsOptionsModel.EngineID = core.StringPtr("testString") - listSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEngineApplicationsOptionsModel.State = []string{"testString"} - listSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Column model + columnModel := new(watsonxdatav3.Column) + columnModel.Comment = core.StringPtr("Expenses column for each department") + columnModel.Extra = core.StringPtr("AUTO_INCREMENT") + columnModel.Length = core.StringPtr("30") + columnModel.Name = core.StringPtr("expenses") + columnModel.Precision = core.StringPtr("10") + columnModel.Scale = core.StringPtr("2") + columnModel.Type = core.StringPtr("varchar") + + // Construct an instance of the CreateColumnsOptions model + createColumnsOptionsModel := new(watsonxdatav3.CreateColumnsOptions) + createColumnsOptionsModel.EngineID = core.StringPtr("testString") + createColumnsOptionsModel.CatalogName = core.StringPtr("testString") + createColumnsOptionsModel.SchemaName = core.StringPtr("testString") + createColumnsOptionsModel.TableName = core.StringPtr("testString") + createColumnsOptionsModel.Columns = []watsonxdatav3.Column{*columnModel} + createColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) + result, response, operationErr := watsonxDataService.CreateColumns(createColumnsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) + result, response, operationErr = watsonxDataService.CreateColumns(createColumnsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -22815,30 +24033,47 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListSparkEngineApplications(listSparkEngineApplicationsOptions *ListSparkEngineApplicationsOptions)`, func() { - listSparkEngineApplicationsPath := "/spark_engines/testString/applications" + Describe(`CreateColumns(createColumnsOptions *CreateColumnsOptions)`, func() { + createColumnsPath := "/v3/catalogs/testString/schemas/testString/tables/testString/columns" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineApplicationsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createColumnsPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"applications": [{"application_details": {"application": "s3://mybucket/wordcount.py", "arguments": ["people.txt"], "class": "org.apache.spark.examples.SparkPi", "conf": {"spark_sample_config_properpty": "SparkSampleConfigProperpty"}, "env": {"sample_env_key": "SampleEnvKey"}, "files": "s3://mybucket/myfile.txt", "jars": "Jars", "name": "SparkApplicaton1", "packages": "org.apache.spark:example_1.2.3", "repositories": "https://repo1.maven.org/maven2/", "spark_version": "3.3"}, "application_id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "FailedTime", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "job_endpoint": "/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications", "return_code": "0", "runtime": {"spark_version": "3.3"}, "service_instance_id": "ServiceInstanceID", "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_version": "3.3", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "type": "iae", "volumes": [{"mount_path": "/mount/path", "name": "my-volume", "read_only": true, "source_sub_path": "/source/path"}], "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"columns": [{"comment": "Expenses column for each department", "extra": "AUTO_INCREMENT", "length": "30", "name": "expenses", "precision": "10", "scale": "2", "type": "varchar"}]}`) })) }) - It(`Invoke ListSparkEngineApplications successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateColumns successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -22846,23 +24081,36 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListSparkEngineApplicationsOptions model - listSparkEngineApplicationsOptionsModel := new(watsonxdatav2.ListSparkEngineApplicationsOptions) - listSparkEngineApplicationsOptionsModel.EngineID = core.StringPtr("testString") - listSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEngineApplicationsOptionsModel.State = []string{"testString"} - listSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Column model + columnModel := new(watsonxdatav3.Column) + columnModel.Comment = core.StringPtr("Expenses column for each department") + columnModel.Extra = core.StringPtr("AUTO_INCREMENT") + columnModel.Length = core.StringPtr("30") + columnModel.Name = core.StringPtr("expenses") + columnModel.Precision = core.StringPtr("10") + columnModel.Scale = core.StringPtr("2") + columnModel.Type = core.StringPtr("varchar") + + // Construct an instance of the CreateColumnsOptions model + createColumnsOptionsModel := new(watsonxdatav3.CreateColumnsOptions) + createColumnsOptionsModel.EngineID = core.StringPtr("testString") + createColumnsOptionsModel.CatalogName = core.StringPtr("testString") + createColumnsOptionsModel.SchemaName = core.StringPtr("testString") + createColumnsOptionsModel.TableName = core.StringPtr("testString") + createColumnsOptionsModel.Columns = []watsonxdatav3.Column{*columnModel} + createColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListSparkEngineApplicationsWithContext(ctx, listSparkEngineApplicationsOptionsModel) + _, _, operationErr := watsonxDataService.CreateColumnsWithContext(ctx, createColumnsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) + result, response, operationErr := watsonxDataService.CreateColumns(createColumnsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -22870,7 +24118,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListSparkEngineApplicationsWithContext(ctx, listSparkEngineApplicationsOptionsModel) + _, _, operationErr = watsonxDataService.CreateColumnsWithContext(ctx, createColumnsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -22884,19 +24132,36 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineApplicationsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createColumnsPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"applications": [{"application_details": {"application": "s3://mybucket/wordcount.py", "arguments": ["people.txt"], "class": "org.apache.spark.examples.SparkPi", "conf": {"spark_sample_config_properpty": "SparkSampleConfigProperpty"}, "env": {"sample_env_key": "SampleEnvKey"}, "files": "s3://mybucket/myfile.txt", "jars": "Jars", "name": "SparkApplicaton1", "packages": "org.apache.spark:example_1.2.3", "repositories": "https://repo1.maven.org/maven2/", "spark_version": "3.3"}, "application_id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "FailedTime", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "job_endpoint": "/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications", "return_code": "0", "runtime": {"spark_version": "3.3"}, "service_instance_id": "ServiceInstanceID", "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_version": "3.3", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "type": "iae", "volumes": [{"mount_path": "/mount/path", "name": "my-volume", "read_only": true, "source_sub_path": "/source/path"}], "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"columns": [{"comment": "Expenses column for each department", "extra": "AUTO_INCREMENT", "length": "30", "name": "expenses", "precision": "10", "scale": "2", "type": "varchar"}]}`) })) }) - It(`Invoke ListSparkEngineApplications successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateColumns successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -22904,51 +24169,77 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListSparkEngineApplications(nil) + result, response, operationErr := watsonxDataService.CreateColumns(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSparkEngineApplicationsOptions model - listSparkEngineApplicationsOptionsModel := new(watsonxdatav2.ListSparkEngineApplicationsOptions) - listSparkEngineApplicationsOptionsModel.EngineID = core.StringPtr("testString") - listSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEngineApplicationsOptionsModel.State = []string{"testString"} - listSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Column model + columnModel := new(watsonxdatav3.Column) + columnModel.Comment = core.StringPtr("Expenses column for each department") + columnModel.Extra = core.StringPtr("AUTO_INCREMENT") + columnModel.Length = core.StringPtr("30") + columnModel.Name = core.StringPtr("expenses") + columnModel.Precision = core.StringPtr("10") + columnModel.Scale = core.StringPtr("2") + columnModel.Type = core.StringPtr("varchar") + + // Construct an instance of the CreateColumnsOptions model + createColumnsOptionsModel := new(watsonxdatav3.CreateColumnsOptions) + createColumnsOptionsModel.EngineID = core.StringPtr("testString") + createColumnsOptionsModel.CatalogName = core.StringPtr("testString") + createColumnsOptionsModel.SchemaName = core.StringPtr("testString") + createColumnsOptionsModel.TableName = core.StringPtr("testString") + createColumnsOptionsModel.Columns = []watsonxdatav3.Column{*columnModel} + createColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) + result, response, operationErr = watsonxDataService.CreateColumns(createColumnsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListSparkEngineApplications with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateColumns with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkEngineApplicationsOptions model - listSparkEngineApplicationsOptionsModel := new(watsonxdatav2.ListSparkEngineApplicationsOptions) - listSparkEngineApplicationsOptionsModel.EngineID = core.StringPtr("testString") - listSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEngineApplicationsOptionsModel.State = []string{"testString"} - listSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Column model + columnModel := new(watsonxdatav3.Column) + columnModel.Comment = core.StringPtr("Expenses column for each department") + columnModel.Extra = core.StringPtr("AUTO_INCREMENT") + columnModel.Length = core.StringPtr("30") + columnModel.Name = core.StringPtr("expenses") + columnModel.Precision = core.StringPtr("10") + columnModel.Scale = core.StringPtr("2") + columnModel.Type = core.StringPtr("varchar") + + // Construct an instance of the CreateColumnsOptions model + createColumnsOptionsModel := new(watsonxdatav3.CreateColumnsOptions) + createColumnsOptionsModel.EngineID = core.StringPtr("testString") + createColumnsOptionsModel.CatalogName = core.StringPtr("testString") + createColumnsOptionsModel.SchemaName = core.StringPtr("testString") + createColumnsOptionsModel.TableName = core.StringPtr("testString") + createColumnsOptionsModel.Columns = []watsonxdatav3.Column{*columnModel} + createColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) + result, response, operationErr := watsonxDataService.CreateColumns(createColumnsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListSparkEngineApplicationsOptions model with no property values - listSparkEngineApplicationsOptionsModelNew := new(watsonxdatav2.ListSparkEngineApplicationsOptions) + // Construct a second instance of the CreateColumnsOptions model with no property values + createColumnsOptionsModelNew := new(watsonxdatav3.CreateColumnsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateColumns(createColumnsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -22963,26 +24254,39 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListSparkEngineApplications successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateColumns successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkEngineApplicationsOptions model - listSparkEngineApplicationsOptionsModel := new(watsonxdatav2.ListSparkEngineApplicationsOptions) - listSparkEngineApplicationsOptionsModel.EngineID = core.StringPtr("testString") - listSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEngineApplicationsOptionsModel.State = []string{"testString"} - listSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the Column model + columnModel := new(watsonxdatav3.Column) + columnModel.Comment = core.StringPtr("Expenses column for each department") + columnModel.Extra = core.StringPtr("AUTO_INCREMENT") + columnModel.Length = core.StringPtr("30") + columnModel.Name = core.StringPtr("expenses") + columnModel.Precision = core.StringPtr("10") + columnModel.Scale = core.StringPtr("2") + columnModel.Type = core.StringPtr("varchar") + + // Construct an instance of the CreateColumnsOptions model + createColumnsOptionsModel := new(watsonxdatav3.CreateColumnsOptions) + createColumnsOptionsModel.EngineID = core.StringPtr("testString") + createColumnsOptionsModel.CatalogName = core.StringPtr("testString") + createColumnsOptionsModel.SchemaName = core.StringPtr("testString") + createColumnsOptionsModel.TableName = core.StringPtr("testString") + createColumnsOptionsModel.Columns = []watsonxdatav3.Column{*columnModel} + createColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") + createColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListSparkEngineApplications(listSparkEngineApplicationsOptionsModel) + result, response, operationErr := watsonxDataService.CreateColumns(createColumnsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -22994,99 +24298,157 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSparkEngineApplication(createSparkEngineApplicationOptions *CreateSparkEngineApplicationOptions) - Operation response error`, func() { - createSparkEngineApplicationPath := "/spark_engines/testString/applications" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`DeleteColumn(deleteColumnOptions *DeleteColumnOptions)`, func() { + deleteColumnPath := "/v3/catalogs/testString/schemas/testString/tables/testString/columns/testString" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineApplicationPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(deleteColumnPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprint(res, `} this is not valid json {`) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + res.WriteHeader(204) })) }) - It(`Invoke CreateSparkEngineApplication with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteColumn successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SparkApplicationConfig model - sparkApplicationConfigModel := new(watsonxdatav2.SparkApplicationConfig) - sparkApplicationConfigModel.SparkSampleConfigProperpty = core.StringPtr("testString") - - // Construct an instance of the SparkApplicationEnv model - sparkApplicationEnvModel := new(watsonxdatav2.SparkApplicationEnv) - sparkApplicationEnvModel.SampleEnvKey = core.StringPtr("testString") - - // Construct an instance of the SparkApplicationDetails model - sparkApplicationDetailsModel := new(watsonxdatav2.SparkApplicationDetails) - sparkApplicationDetailsModel.Application = core.StringPtr("/opt/ibm/spark/examples/src/main/python/wordcount.py") - sparkApplicationDetailsModel.Arguments = []string{"/opt/ibm/spark/examples/src/main/resources/people.txt"} - sparkApplicationDetailsModel.Class = core.StringPtr("org.apache.spark.examples.SparkPi") - sparkApplicationDetailsModel.Conf = sparkApplicationConfigModel - sparkApplicationDetailsModel.Env = sparkApplicationEnvModel - sparkApplicationDetailsModel.Files = core.StringPtr("s3://mybucket/myfile.txt") - sparkApplicationDetailsModel.Jars = core.StringPtr("testString") - sparkApplicationDetailsModel.Name = core.StringPtr("SparkApplicaton1") - sparkApplicationDetailsModel.Packages = core.StringPtr("org.apache.spark:example_1.2.3") - sparkApplicationDetailsModel.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") - sparkApplicationDetailsModel.SparkVersion = core.StringPtr("3.3") + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteColumn(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Construct an instance of the SparkVolumeDetails model - sparkVolumeDetailsModel := new(watsonxdatav2.SparkVolumeDetails) - sparkVolumeDetailsModel.MountPath = core.StringPtr("/mount/path") - sparkVolumeDetailsModel.Name = core.StringPtr("my-volume") - sparkVolumeDetailsModel.ReadOnly = core.BoolPtr(true) - sparkVolumeDetailsModel.SourceSubPath = core.StringPtr("/source/path") + // Construct an instance of the DeleteColumnOptions model + deleteColumnOptionsModel := new(watsonxdatav3.DeleteColumnOptions) + deleteColumnOptionsModel.EngineID = core.StringPtr("testString") + deleteColumnOptionsModel.CatalogName = core.StringPtr("testString") + deleteColumnOptionsModel.SchemaName = core.StringPtr("testString") + deleteColumnOptionsModel.TableName = core.StringPtr("testString") + deleteColumnOptionsModel.ColumnName = core.StringPtr("testString") + deleteColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the CreateSparkEngineApplicationOptions model - createSparkEngineApplicationOptionsModel := new(watsonxdatav2.CreateSparkEngineApplicationOptions) - createSparkEngineApplicationOptionsModel.EngineID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.ApplicationDetails = sparkApplicationDetailsModel - createSparkEngineApplicationOptionsModel.JobEndpoint = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.ServiceInstanceID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.Type = core.StringPtr("iae") - createSparkEngineApplicationOptionsModel.Volumes = []watsonxdatav2.SparkVolumeDetails{*sparkVolumeDetailsModel} - createSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.State = []string{"testString"} - createSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteColumn(deleteColumnOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + }) + It(`Invoke DeleteColumn with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) - // Enable retries and test again - watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) + // Construct an instance of the DeleteColumnOptions model + deleteColumnOptionsModel := new(watsonxdatav3.DeleteColumnOptions) + deleteColumnOptionsModel.EngineID = core.StringPtr("testString") + deleteColumnOptionsModel.CatalogName = core.StringPtr("testString") + deleteColumnOptionsModel.SchemaName = core.StringPtr("testString") + deleteColumnOptionsModel.TableName = core.StringPtr("testString") + deleteColumnOptionsModel.ColumnName = core.StringPtr("testString") + deleteColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteColumn(deleteColumnOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteColumnOptions model with no property values + deleteColumnOptionsModelNew := new(watsonxdatav3.DeleteColumnOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteColumn(deleteColumnOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`CreateSparkEngineApplication(createSparkEngineApplicationOptions *CreateSparkEngineApplicationOptions)`, func() { - createSparkEngineApplicationPath := "/spark_engines/testString/applications" - Context(`Using mock server endpoint with timeout`, func() { + Describe(`UpdateColumn(updateColumnOptions *UpdateColumnOptions) - Operation response error`, func() { + updateColumnPath := "/v3/catalogs/testString/schemas/testString/tables/testString/columns/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineApplicationPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateColumnPath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateColumn with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the ColumnPatch model + columnPatchModel := new(watsonxdatav3.ColumnPatch) + columnPatchModel.Name = core.StringPtr("expenses") + columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateColumnOptions model + updateColumnOptionsModel := new(watsonxdatav3.UpdateColumnOptions) + updateColumnOptionsModel.EngineID = core.StringPtr("testString") + updateColumnOptionsModel.CatalogName = core.StringPtr("testString") + updateColumnOptionsModel.SchemaName = core.StringPtr("testString") + updateColumnOptionsModel.TableName = core.StringPtr("testString") + updateColumnOptionsModel.ColumnName = core.StringPtr("testString") + updateColumnOptionsModel.Body = columnPatchModelAsPatch + updateColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := watsonxDataService.UpdateColumn(updateColumnOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + watsonxDataService.EnableRetries(0, 0) + result, response, operationErr = watsonxDataService.UpdateColumn(updateColumnOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateColumn(updateColumnOptions *UpdateColumnOptions)`, func() { + updateColumnPath := "/v3/catalogs/testString/schemas/testString/tables/testString/columns/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateColumnPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -23106,17 +24468,18 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"application_details": {"application": "s3://mybucket/wordcount.py", "arguments": ["people.txt"], "class": "org.apache.spark.examples.SparkPi", "conf": {"spark_sample_config_properpty": "SparkSampleConfigProperpty"}, "env": {"sample_env_key": "SampleEnvKey"}, "files": "s3://mybucket/myfile.txt", "jars": "Jars", "name": "SparkApplicaton1", "packages": "org.apache.spark:example_1.2.3", "repositories": "https://repo1.maven.org/maven2/", "spark_version": "3.3"}, "application_id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "FailedTime", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "job_endpoint": "/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications", "return_code": "0", "runtime": {"spark_version": "3.3"}, "service_instance_id": "ServiceInstanceID", "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_version": "3.3", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "type": "iae", "volumes": [{"mount_path": "/mount/path", "name": "my-volume", "read_only": true, "source_sub_path": "/source/path"}], "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"comment": "Expenses column for each department", "extra": "AUTO_INCREMENT", "length": "30", "name": "expenses", "precision": "10", "scale": "2", "type": "varchar"}`) })) }) - It(`Invoke CreateSparkEngineApplication successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateColumn successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -23124,57 +24487,33 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the SparkApplicationConfig model - sparkApplicationConfigModel := new(watsonxdatav2.SparkApplicationConfig) - sparkApplicationConfigModel.SparkSampleConfigProperpty = core.StringPtr("testString") - - // Construct an instance of the SparkApplicationEnv model - sparkApplicationEnvModel := new(watsonxdatav2.SparkApplicationEnv) - sparkApplicationEnvModel.SampleEnvKey = core.StringPtr("testString") - - // Construct an instance of the SparkApplicationDetails model - sparkApplicationDetailsModel := new(watsonxdatav2.SparkApplicationDetails) - sparkApplicationDetailsModel.Application = core.StringPtr("/opt/ibm/spark/examples/src/main/python/wordcount.py") - sparkApplicationDetailsModel.Arguments = []string{"/opt/ibm/spark/examples/src/main/resources/people.txt"} - sparkApplicationDetailsModel.Class = core.StringPtr("org.apache.spark.examples.SparkPi") - sparkApplicationDetailsModel.Conf = sparkApplicationConfigModel - sparkApplicationDetailsModel.Env = sparkApplicationEnvModel - sparkApplicationDetailsModel.Files = core.StringPtr("s3://mybucket/myfile.txt") - sparkApplicationDetailsModel.Jars = core.StringPtr("testString") - sparkApplicationDetailsModel.Name = core.StringPtr("SparkApplicaton1") - sparkApplicationDetailsModel.Packages = core.StringPtr("org.apache.spark:example_1.2.3") - sparkApplicationDetailsModel.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") - sparkApplicationDetailsModel.SparkVersion = core.StringPtr("3.3") - - // Construct an instance of the SparkVolumeDetails model - sparkVolumeDetailsModel := new(watsonxdatav2.SparkVolumeDetails) - sparkVolumeDetailsModel.MountPath = core.StringPtr("/mount/path") - sparkVolumeDetailsModel.Name = core.StringPtr("my-volume") - sparkVolumeDetailsModel.ReadOnly = core.BoolPtr(true) - sparkVolumeDetailsModel.SourceSubPath = core.StringPtr("/source/path") + // Construct an instance of the ColumnPatch model + columnPatchModel := new(watsonxdatav3.ColumnPatch) + columnPatchModel.Name = core.StringPtr("expenses") + columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateSparkEngineApplicationOptions model - createSparkEngineApplicationOptionsModel := new(watsonxdatav2.CreateSparkEngineApplicationOptions) - createSparkEngineApplicationOptionsModel.EngineID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.ApplicationDetails = sparkApplicationDetailsModel - createSparkEngineApplicationOptionsModel.JobEndpoint = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.ServiceInstanceID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.Type = core.StringPtr("iae") - createSparkEngineApplicationOptionsModel.Volumes = []watsonxdatav2.SparkVolumeDetails{*sparkVolumeDetailsModel} - createSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.State = []string{"testString"} - createSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateColumnOptions model + updateColumnOptionsModel := new(watsonxdatav3.UpdateColumnOptions) + updateColumnOptionsModel.EngineID = core.StringPtr("testString") + updateColumnOptionsModel.CatalogName = core.StringPtr("testString") + updateColumnOptionsModel.SchemaName = core.StringPtr("testString") + updateColumnOptionsModel.TableName = core.StringPtr("testString") + updateColumnOptionsModel.ColumnName = core.StringPtr("testString") + updateColumnOptionsModel.Body = columnPatchModelAsPatch + updateColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateSparkEngineApplicationWithContext(ctx, createSparkEngineApplicationOptionsModel) + _, _, operationErr := watsonxDataService.UpdateColumnWithContext(ctx, updateColumnOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) + result, response, operationErr := watsonxDataService.UpdateColumn(updateColumnOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -23182,7 +24521,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateSparkEngineApplicationWithContext(ctx, createSparkEngineApplicationOptionsModel) + _, _, operationErr = watsonxDataService.UpdateColumnWithContext(ctx, updateColumnOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -23196,8 +24535,8 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineApplicationPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(updateColumnPath)) + Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) @@ -23217,14 +24556,15 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"application_details": {"application": "s3://mybucket/wordcount.py", "arguments": ["people.txt"], "class": "org.apache.spark.examples.SparkPi", "conf": {"spark_sample_config_properpty": "SparkSampleConfigProperpty"}, "env": {"sample_env_key": "SampleEnvKey"}, "files": "s3://mybucket/myfile.txt", "jars": "Jars", "name": "SparkApplicaton1", "packages": "org.apache.spark:example_1.2.3", "repositories": "https://repo1.maven.org/maven2/", "spark_version": "3.3"}, "application_id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "FailedTime", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "job_endpoint": "/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications", "return_code": "0", "runtime": {"spark_version": "3.3"}, "service_instance_id": "ServiceInstanceID", "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_version": "3.3", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "type": "iae", "volumes": [{"mount_path": "/mount/path", "name": "my-volume", "read_only": true, "source_sub_path": "/source/path"}], "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"comment": "Expenses column for each department", "extra": "AUTO_INCREMENT", "length": "30", "name": "expenses", "precision": "10", "scale": "2", "type": "varchar"}`) })) }) - It(`Invoke CreateSparkEngineApplication successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateColumn successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -23232,119 +24572,71 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateSparkEngineApplication(nil) + result, response, operationErr := watsonxDataService.UpdateColumn(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SparkApplicationConfig model - sparkApplicationConfigModel := new(watsonxdatav2.SparkApplicationConfig) - sparkApplicationConfigModel.SparkSampleConfigProperpty = core.StringPtr("testString") - - // Construct an instance of the SparkApplicationEnv model - sparkApplicationEnvModel := new(watsonxdatav2.SparkApplicationEnv) - sparkApplicationEnvModel.SampleEnvKey = core.StringPtr("testString") - - // Construct an instance of the SparkApplicationDetails model - sparkApplicationDetailsModel := new(watsonxdatav2.SparkApplicationDetails) - sparkApplicationDetailsModel.Application = core.StringPtr("/opt/ibm/spark/examples/src/main/python/wordcount.py") - sparkApplicationDetailsModel.Arguments = []string{"/opt/ibm/spark/examples/src/main/resources/people.txt"} - sparkApplicationDetailsModel.Class = core.StringPtr("org.apache.spark.examples.SparkPi") - sparkApplicationDetailsModel.Conf = sparkApplicationConfigModel - sparkApplicationDetailsModel.Env = sparkApplicationEnvModel - sparkApplicationDetailsModel.Files = core.StringPtr("s3://mybucket/myfile.txt") - sparkApplicationDetailsModel.Jars = core.StringPtr("testString") - sparkApplicationDetailsModel.Name = core.StringPtr("SparkApplicaton1") - sparkApplicationDetailsModel.Packages = core.StringPtr("org.apache.spark:example_1.2.3") - sparkApplicationDetailsModel.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") - sparkApplicationDetailsModel.SparkVersion = core.StringPtr("3.3") - - // Construct an instance of the SparkVolumeDetails model - sparkVolumeDetailsModel := new(watsonxdatav2.SparkVolumeDetails) - sparkVolumeDetailsModel.MountPath = core.StringPtr("/mount/path") - sparkVolumeDetailsModel.Name = core.StringPtr("my-volume") - sparkVolumeDetailsModel.ReadOnly = core.BoolPtr(true) - sparkVolumeDetailsModel.SourceSubPath = core.StringPtr("/source/path") + // Construct an instance of the ColumnPatch model + columnPatchModel := new(watsonxdatav3.ColumnPatch) + columnPatchModel.Name = core.StringPtr("expenses") + columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateSparkEngineApplicationOptions model - createSparkEngineApplicationOptionsModel := new(watsonxdatav2.CreateSparkEngineApplicationOptions) - createSparkEngineApplicationOptionsModel.EngineID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.ApplicationDetails = sparkApplicationDetailsModel - createSparkEngineApplicationOptionsModel.JobEndpoint = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.ServiceInstanceID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.Type = core.StringPtr("iae") - createSparkEngineApplicationOptionsModel.Volumes = []watsonxdatav2.SparkVolumeDetails{*sparkVolumeDetailsModel} - createSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.State = []string{"testString"} - createSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateColumnOptions model + updateColumnOptionsModel := new(watsonxdatav3.UpdateColumnOptions) + updateColumnOptionsModel.EngineID = core.StringPtr("testString") + updateColumnOptionsModel.CatalogName = core.StringPtr("testString") + updateColumnOptionsModel.SchemaName = core.StringPtr("testString") + updateColumnOptionsModel.TableName = core.StringPtr("testString") + updateColumnOptionsModel.ColumnName = core.StringPtr("testString") + updateColumnOptionsModel.Body = columnPatchModelAsPatch + updateColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) + result, response, operationErr = watsonxDataService.UpdateColumn(updateColumnOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSparkEngineApplication with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateColumn with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SparkApplicationConfig model - sparkApplicationConfigModel := new(watsonxdatav2.SparkApplicationConfig) - sparkApplicationConfigModel.SparkSampleConfigProperpty = core.StringPtr("testString") - - // Construct an instance of the SparkApplicationEnv model - sparkApplicationEnvModel := new(watsonxdatav2.SparkApplicationEnv) - sparkApplicationEnvModel.SampleEnvKey = core.StringPtr("testString") - - // Construct an instance of the SparkApplicationDetails model - sparkApplicationDetailsModel := new(watsonxdatav2.SparkApplicationDetails) - sparkApplicationDetailsModel.Application = core.StringPtr("/opt/ibm/spark/examples/src/main/python/wordcount.py") - sparkApplicationDetailsModel.Arguments = []string{"/opt/ibm/spark/examples/src/main/resources/people.txt"} - sparkApplicationDetailsModel.Class = core.StringPtr("org.apache.spark.examples.SparkPi") - sparkApplicationDetailsModel.Conf = sparkApplicationConfigModel - sparkApplicationDetailsModel.Env = sparkApplicationEnvModel - sparkApplicationDetailsModel.Files = core.StringPtr("s3://mybucket/myfile.txt") - sparkApplicationDetailsModel.Jars = core.StringPtr("testString") - sparkApplicationDetailsModel.Name = core.StringPtr("SparkApplicaton1") - sparkApplicationDetailsModel.Packages = core.StringPtr("org.apache.spark:example_1.2.3") - sparkApplicationDetailsModel.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") - sparkApplicationDetailsModel.SparkVersion = core.StringPtr("3.3") - - // Construct an instance of the SparkVolumeDetails model - sparkVolumeDetailsModel := new(watsonxdatav2.SparkVolumeDetails) - sparkVolumeDetailsModel.MountPath = core.StringPtr("/mount/path") - sparkVolumeDetailsModel.Name = core.StringPtr("my-volume") - sparkVolumeDetailsModel.ReadOnly = core.BoolPtr(true) - sparkVolumeDetailsModel.SourceSubPath = core.StringPtr("/source/path") + // Construct an instance of the ColumnPatch model + columnPatchModel := new(watsonxdatav3.ColumnPatch) + columnPatchModel.Name = core.StringPtr("expenses") + columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateSparkEngineApplicationOptions model - createSparkEngineApplicationOptionsModel := new(watsonxdatav2.CreateSparkEngineApplicationOptions) - createSparkEngineApplicationOptionsModel.EngineID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.ApplicationDetails = sparkApplicationDetailsModel - createSparkEngineApplicationOptionsModel.JobEndpoint = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.ServiceInstanceID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.Type = core.StringPtr("iae") - createSparkEngineApplicationOptionsModel.Volumes = []watsonxdatav2.SparkVolumeDetails{*sparkVolumeDetailsModel} - createSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.State = []string{"testString"} - createSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateColumnOptions model + updateColumnOptionsModel := new(watsonxdatav3.UpdateColumnOptions) + updateColumnOptionsModel.EngineID = core.StringPtr("testString") + updateColumnOptionsModel.CatalogName = core.StringPtr("testString") + updateColumnOptionsModel.SchemaName = core.StringPtr("testString") + updateColumnOptionsModel.TableName = core.StringPtr("testString") + updateColumnOptionsModel.ColumnName = core.StringPtr("testString") + updateColumnOptionsModel.Body = columnPatchModelAsPatch + updateColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) + result, response, operationErr := watsonxDataService.UpdateColumn(updateColumnOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateSparkEngineApplicationOptions model with no property values - createSparkEngineApplicationOptionsModelNew := new(watsonxdatav2.CreateSparkEngineApplicationOptions) + // Construct a second instance of the UpdateColumnOptions model with no property values + updateColumnOptionsModelNew := new(watsonxdatav3.UpdateColumnOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdateColumn(updateColumnOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -23359,60 +24651,36 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateSparkEngineApplication successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateColumn successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SparkApplicationConfig model - sparkApplicationConfigModel := new(watsonxdatav2.SparkApplicationConfig) - sparkApplicationConfigModel.SparkSampleConfigProperpty = core.StringPtr("testString") - - // Construct an instance of the SparkApplicationEnv model - sparkApplicationEnvModel := new(watsonxdatav2.SparkApplicationEnv) - sparkApplicationEnvModel.SampleEnvKey = core.StringPtr("testString") - - // Construct an instance of the SparkApplicationDetails model - sparkApplicationDetailsModel := new(watsonxdatav2.SparkApplicationDetails) - sparkApplicationDetailsModel.Application = core.StringPtr("/opt/ibm/spark/examples/src/main/python/wordcount.py") - sparkApplicationDetailsModel.Arguments = []string{"/opt/ibm/spark/examples/src/main/resources/people.txt"} - sparkApplicationDetailsModel.Class = core.StringPtr("org.apache.spark.examples.SparkPi") - sparkApplicationDetailsModel.Conf = sparkApplicationConfigModel - sparkApplicationDetailsModel.Env = sparkApplicationEnvModel - sparkApplicationDetailsModel.Files = core.StringPtr("s3://mybucket/myfile.txt") - sparkApplicationDetailsModel.Jars = core.StringPtr("testString") - sparkApplicationDetailsModel.Name = core.StringPtr("SparkApplicaton1") - sparkApplicationDetailsModel.Packages = core.StringPtr("org.apache.spark:example_1.2.3") - sparkApplicationDetailsModel.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") - sparkApplicationDetailsModel.SparkVersion = core.StringPtr("3.3") - - // Construct an instance of the SparkVolumeDetails model - sparkVolumeDetailsModel := new(watsonxdatav2.SparkVolumeDetails) - sparkVolumeDetailsModel.MountPath = core.StringPtr("/mount/path") - sparkVolumeDetailsModel.Name = core.StringPtr("my-volume") - sparkVolumeDetailsModel.ReadOnly = core.BoolPtr(true) - sparkVolumeDetailsModel.SourceSubPath = core.StringPtr("/source/path") + // Construct an instance of the ColumnPatch model + columnPatchModel := new(watsonxdatav3.ColumnPatch) + columnPatchModel.Name = core.StringPtr("expenses") + columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) - // Construct an instance of the CreateSparkEngineApplicationOptions model - createSparkEngineApplicationOptionsModel := new(watsonxdatav2.CreateSparkEngineApplicationOptions) - createSparkEngineApplicationOptionsModel.EngineID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.ApplicationDetails = sparkApplicationDetailsModel - createSparkEngineApplicationOptionsModel.JobEndpoint = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.ServiceInstanceID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.Type = core.StringPtr("iae") - createSparkEngineApplicationOptionsModel.Volumes = []watsonxdatav2.SparkVolumeDetails{*sparkVolumeDetailsModel} - createSparkEngineApplicationOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineApplicationOptionsModel.State = []string{"testString"} - createSparkEngineApplicationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateColumnOptions model + updateColumnOptionsModel := new(watsonxdatav3.UpdateColumnOptions) + updateColumnOptionsModel.EngineID = core.StringPtr("testString") + updateColumnOptionsModel.CatalogName = core.StringPtr("testString") + updateColumnOptionsModel.SchemaName = core.StringPtr("testString") + updateColumnOptionsModel.TableName = core.StringPtr("testString") + updateColumnOptionsModel.ColumnName = core.StringPtr("testString") + updateColumnOptionsModel.Body = columnPatchModelAsPatch + updateColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateSparkEngineApplication(createSparkEngineApplicationOptionsModel) + result, response, operationErr := watsonxDataService.UpdateColumn(updateColumnOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -23424,156 +24692,100 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteSparkEngineApplications(deleteSparkEngineApplicationsOptions *DeleteSparkEngineApplicationsOptions)`, func() { - deleteSparkEngineApplicationsPath := "/spark_engines/testString/applications" - Context(`Using mock server endpoint`, func() { + Describe(`RollbackTable(rollbackTableOptions *RollbackTableOptions) - Operation response error`, func() { + rollbackTablePath := "/v3/catalogs/testString/schemas/testString/tables/testString/rollback" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSparkEngineApplicationsPath)) - Expect(req.Method).To(Equal("DELETE")) - + Expect(req.URL.EscapedPath()).To(Equal(rollbackTablePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["application_id"]).To(Equal([]string{"testString"})) - res.WriteHeader(204) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke DeleteSparkEngineApplications successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RollbackTable with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteSparkEngineApplications(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSparkEngineApplicationsOptions model - deleteSparkEngineApplicationsOptionsModel := new(watsonxdatav2.DeleteSparkEngineApplicationsOptions) - deleteSparkEngineApplicationsOptionsModel.EngineID = core.StringPtr("testString") - deleteSparkEngineApplicationsOptionsModel.ApplicationID = core.StringPtr("testString") - deleteSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteSparkEngineApplicationsOptionsModel.State = []string{"testString"} - deleteSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteSparkEngineApplications(deleteSparkEngineApplicationsOptionsModel) - Expect(operationErr).To(BeNil()) + // Construct an instance of the RollbackTableOptions model + rollbackTableOptionsModel := new(watsonxdatav3.RollbackTableOptions) + rollbackTableOptionsModel.CatalogName = core.StringPtr("testString") + rollbackTableOptionsModel.SchemaName = core.StringPtr("testString") + rollbackTableOptionsModel.TableName = core.StringPtr("testString") + rollbackTableOptionsModel.SnapshotID = core.StringPtr("12357647") + rollbackTableOptionsModel.EngineID = core.StringPtr("testString") + rollbackTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + rollbackTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := watsonxDataService.RollbackTable(rollbackTableOptionsModel) + Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSparkEngineApplications with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) + Expect(result).To(BeNil()) - // Construct an instance of the DeleteSparkEngineApplicationsOptions model - deleteSparkEngineApplicationsOptionsModel := new(watsonxdatav2.DeleteSparkEngineApplicationsOptions) - deleteSparkEngineApplicationsOptionsModel.EngineID = core.StringPtr("testString") - deleteSparkEngineApplicationsOptionsModel.ApplicationID = core.StringPtr("testString") - deleteSparkEngineApplicationsOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteSparkEngineApplicationsOptionsModel.State = []string{"testString"} - deleteSparkEngineApplicationsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteSparkEngineApplications(deleteSparkEngineApplicationsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSparkEngineApplicationsOptions model with no property values - deleteSparkEngineApplicationsOptionsModelNew := new(watsonxdatav2.DeleteSparkEngineApplicationsOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteSparkEngineApplications(deleteSparkEngineApplicationsOptionsModelNew) + // Enable retries and test again + watsonxDataService.EnableRetries(0, 0) + result, response, operationErr = watsonxDataService.RollbackTable(rollbackTableOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptions *GetSparkEngineApplicationStatusOptions) - Operation response error`, func() { - getSparkEngineApplicationStatusPath := "/spark_engines/testString/applications/testString" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`RollbackTable(rollbackTableOptions *RollbackTableOptions)`, func() { + rollbackTablePath := "/v3/catalogs/testString/schemas/testString/tables/testString/rollback" + Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineApplicationStatusPath)) - Expect(req.Method).To(Equal("GET")) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) - })) - }) - It(`Invoke GetSparkEngineApplicationStatus with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the GetSparkEngineApplicationStatusOptions model - getSparkEngineApplicationStatusOptionsModel := new(watsonxdatav2.GetSparkEngineApplicationStatusOptions) - getSparkEngineApplicationStatusOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.ApplicationID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(req.URL.EscapedPath()).To(Equal(rollbackTablePath)) + Expect(req.Method).To(Equal("POST")) - // Enable retries and test again - watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptions *GetSparkEngineApplicationStatusOptions)`, func() { - getSparkEngineApplicationStatusPath := "/spark_engines/testString/applications/testString" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineApplicationStatusPath)) - Expect(req.Method).To(Equal("GET")) + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"application_details": {"application": "s3://mybucket/wordcount.py", "arguments": ["people.txt"], "class": "org.apache.spark.examples.SparkPi", "conf": {"spark_sample_config_properpty": "SparkSampleConfigProperpty"}, "env": {"sample_env_key": "SampleEnvKey"}, "files": "s3://mybucket/myfile.txt", "jars": "Jars", "name": "SparkApplicaton1", "packages": "org.apache.spark:example_1.2.3", "repositories": "https://repo1.maven.org/maven2/", "spark_version": "3.3"}, "application_id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "FailedTime", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "job_endpoint": "/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications", "return_code": "0", "runtime": {"spark_version": "3.3"}, "service_instance_id": "ServiceInstanceID", "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_version": "3.3", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "type": "iae", "volumes": [{"mount_path": "/mount/path", "name": "my-volume", "read_only": true, "source_sub_path": "/source/path"}], "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke GetSparkEngineApplicationStatus successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RollbackTable successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -23581,23 +24793,26 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSparkEngineApplicationStatusOptions model - getSparkEngineApplicationStatusOptionsModel := new(watsonxdatav2.GetSparkEngineApplicationStatusOptions) - getSparkEngineApplicationStatusOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.ApplicationID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RollbackTableOptions model + rollbackTableOptionsModel := new(watsonxdatav3.RollbackTableOptions) + rollbackTableOptionsModel.CatalogName = core.StringPtr("testString") + rollbackTableOptionsModel.SchemaName = core.StringPtr("testString") + rollbackTableOptionsModel.TableName = core.StringPtr("testString") + rollbackTableOptionsModel.SnapshotID = core.StringPtr("12357647") + rollbackTableOptionsModel.EngineID = core.StringPtr("testString") + rollbackTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + rollbackTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSparkEngineApplicationStatusWithContext(ctx, getSparkEngineApplicationStatusOptionsModel) + _, _, operationErr := watsonxDataService.RollbackTableWithContext(ctx, rollbackTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) + result, response, operationErr := watsonxDataService.RollbackTable(rollbackTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -23605,7 +24820,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSparkEngineApplicationStatusWithContext(ctx, getSparkEngineApplicationStatusOptionsModel) + _, _, operationErr = watsonxDataService.RollbackTableWithContext(ctx, rollbackTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -23619,19 +24834,36 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineApplicationStatusPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(rollbackTablePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"application_details": {"application": "s3://mybucket/wordcount.py", "arguments": ["people.txt"], "class": "org.apache.spark.examples.SparkPi", "conf": {"spark_sample_config_properpty": "SparkSampleConfigProperpty"}, "env": {"sample_env_key": "SampleEnvKey"}, "files": "s3://mybucket/myfile.txt", "jars": "Jars", "name": "SparkApplicaton1", "packages": "org.apache.spark:example_1.2.3", "repositories": "https://repo1.maven.org/maven2/", "spark_version": "3.3"}, "application_id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "auto_termination_time": "2020-12-08T10:00:00.000Z", "creation_time": "Saturday 28 October 2023 07:17:06.856+0000", "deploy_mode": "stand-alone", "end_time": "2020-12-08T10:00:00.000Z", "failed_time": "FailedTime", "finish_time": "Saturday 28 October 2023 07:17:38.966+0000", "id": "cd7cbf1f-8893-4c51-aa3d-d92729f05e99", "job_endpoint": "/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications", "return_code": "0", "runtime": {"spark_version": "3.3"}, "service_instance_id": "ServiceInstanceID", "spark_application_id": "app-20231028071726-0000", "spark_application_name": "PythonWordCount", "spark_version": "3.3", "start_time": "Saturday 28 October 2023 07:17:26.649+0000", "state": "FINISHED", "state_details": [{"code": "Code", "message": "Message", "type": "Type"}], "submission_time": "2023-11-01T11:18:49.758Z", "template_id": "spark-3.3-jaas-v2-cp4d-template", "type": "iae", "volumes": [{"mount_path": "/mount/path", "name": "my-volume", "read_only": true, "source_sub_path": "/source/path"}], "wxd_application_ui_endpoint": "$HOST/v1/1698311655308796/engines/spark817/applications/c7b3fccf-badb-46b0-b1ef-9b3154424021/ui"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke GetSparkEngineApplicationStatus successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RollbackTable successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -23639,51 +24871,57 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSparkEngineApplicationStatus(nil) + result, response, operationErr := watsonxDataService.RollbackTable(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSparkEngineApplicationStatusOptions model - getSparkEngineApplicationStatusOptionsModel := new(watsonxdatav2.GetSparkEngineApplicationStatusOptions) - getSparkEngineApplicationStatusOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.ApplicationID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RollbackTableOptions model + rollbackTableOptionsModel := new(watsonxdatav3.RollbackTableOptions) + rollbackTableOptionsModel.CatalogName = core.StringPtr("testString") + rollbackTableOptionsModel.SchemaName = core.StringPtr("testString") + rollbackTableOptionsModel.TableName = core.StringPtr("testString") + rollbackTableOptionsModel.SnapshotID = core.StringPtr("12357647") + rollbackTableOptionsModel.EngineID = core.StringPtr("testString") + rollbackTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + rollbackTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) + result, response, operationErr = watsonxDataService.RollbackTable(rollbackTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSparkEngineApplicationStatus with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RollbackTable with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSparkEngineApplicationStatusOptions model - getSparkEngineApplicationStatusOptionsModel := new(watsonxdatav2.GetSparkEngineApplicationStatusOptions) - getSparkEngineApplicationStatusOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.ApplicationID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RollbackTableOptions model + rollbackTableOptionsModel := new(watsonxdatav3.RollbackTableOptions) + rollbackTableOptionsModel.CatalogName = core.StringPtr("testString") + rollbackTableOptionsModel.SchemaName = core.StringPtr("testString") + rollbackTableOptionsModel.TableName = core.StringPtr("testString") + rollbackTableOptionsModel.SnapshotID = core.StringPtr("12357647") + rollbackTableOptionsModel.EngineID = core.StringPtr("testString") + rollbackTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + rollbackTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) + result, response, operationErr := watsonxDataService.RollbackTable(rollbackTableOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetSparkEngineApplicationStatusOptions model with no property values - getSparkEngineApplicationStatusOptionsModelNew := new(watsonxdatav2.GetSparkEngineApplicationStatusOptions) + // Construct a second instance of the RollbackTableOptions model with no property values + rollbackTableOptionsModelNew := new(watsonxdatav3.RollbackTableOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModelNew) + result, response, operationErr = watsonxDataService.RollbackTable(rollbackTableOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -23698,26 +24936,29 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetSparkEngineApplicationStatus successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke RollbackTable successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSparkEngineApplicationStatusOptions model - getSparkEngineApplicationStatusOptionsModel := new(watsonxdatav2.GetSparkEngineApplicationStatusOptions) - getSparkEngineApplicationStatusOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.ApplicationID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineApplicationStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RollbackTableOptions model + rollbackTableOptionsModel := new(watsonxdatav3.RollbackTableOptions) + rollbackTableOptionsModel.CatalogName = core.StringPtr("testString") + rollbackTableOptionsModel.SchemaName = core.StringPtr("testString") + rollbackTableOptionsModel.TableName = core.StringPtr("testString") + rollbackTableOptionsModel.SnapshotID = core.StringPtr("12357647") + rollbackTableOptionsModel.EngineID = core.StringPtr("testString") + rollbackTableOptionsModel.AuthInstanceID = core.StringPtr("testString") + rollbackTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSparkEngineApplicationStatus(getSparkEngineApplicationStatusOptionsModel) + result, response, operationErr := watsonxDataService.RollbackTable(rollbackTableOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -23729,45 +24970,49 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListSparkEngineCatalogs(listSparkEngineCatalogsOptions *ListSparkEngineCatalogsOptions) - Operation response error`, func() { - listSparkEngineCatalogsPath := "/spark_engines/testString/catalogs" + Describe(`ListTableSnapshots(listTableSnapshotsOptions *ListTableSnapshotsOptions) - Operation response error`, func() { + listTableSnapshotsPath := "/v3/catalogs/testString/schemas/testString/tables/testString/snapshots" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineCatalogsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listTableSnapshotsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListSparkEngineCatalogs with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListTableSnapshots with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkEngineCatalogsOptions model - listSparkEngineCatalogsOptionsModel := new(watsonxdatav2.ListSparkEngineCatalogsOptions) - listSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListTableSnapshotsOptions model + listTableSnapshotsOptionsModel := new(watsonxdatav3.ListTableSnapshotsOptions) + listTableSnapshotsOptionsModel.CatalogName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.SchemaName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.TableName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.EngineID = core.StringPtr("testString") + listTableSnapshotsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listTableSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -23777,30 +25022,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListSparkEngineCatalogs(listSparkEngineCatalogsOptions *ListSparkEngineCatalogsOptions)`, func() { - listSparkEngineCatalogsPath := "/spark_engines/testString/catalogs" + Describe(`ListTableSnapshots(listTableSnapshotsOptions *ListTableSnapshotsOptions)`, func() { + listTableSnapshotsPath := "/v3/catalogs/testString/schemas/testString/tables/testString/snapshots" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineCatalogsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listTableSnapshotsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}]}`) + fmt.Fprintf(res, "%s", `{"snapshots": [{"added_data_files": "1", "added_files_size": "17425", "added_records": "3277", "changed_partition_count": "1", "committed_at": "2025-01-29T08:36:21.717Z", "is_current_snapshot": true, "operation": "alter", "snapshot_id": "2332342122211222", "total_data_files": "2", "total_delete_files": "0", "total_equality_deletes": "0", "total_position_deletes": "0", "total_records": "5000"}]}`) })) }) - It(`Invoke ListSparkEngineCatalogs successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListTableSnapshots successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -23808,22 +25054,25 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListSparkEngineCatalogsOptions model - listSparkEngineCatalogsOptionsModel := new(watsonxdatav2.ListSparkEngineCatalogsOptions) - listSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListTableSnapshotsOptions model + listTableSnapshotsOptionsModel := new(watsonxdatav3.ListTableSnapshotsOptions) + listTableSnapshotsOptionsModel.CatalogName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.SchemaName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.TableName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.EngineID = core.StringPtr("testString") + listTableSnapshotsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listTableSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListSparkEngineCatalogsWithContext(ctx, listSparkEngineCatalogsOptionsModel) + _, _, operationErr := watsonxDataService.ListTableSnapshotsWithContext(ctx, listTableSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -23831,7 +25080,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListSparkEngineCatalogsWithContext(ctx, listSparkEngineCatalogsOptionsModel) + _, _, operationErr = watsonxDataService.ListTableSnapshotsWithContext(ctx, listTableSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -23845,19 +25094,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkEngineCatalogsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listTableSnapshotsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}]}`) + fmt.Fprintf(res, "%s", `{"snapshots": [{"added_data_files": "1", "added_files_size": "17425", "added_records": "3277", "changed_partition_count": "1", "committed_at": "2025-01-29T08:36:21.717Z", "is_current_snapshot": true, "operation": "alter", "snapshot_id": "2332342122211222", "total_data_files": "2", "total_delete_files": "0", "total_equality_deletes": "0", "total_position_deletes": "0", "total_records": "5000"}]}`) })) }) - It(`Invoke ListSparkEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListTableSnapshots successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -23865,49 +25115,55 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListSparkEngineCatalogs(nil) + result, response, operationErr := watsonxDataService.ListTableSnapshots(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSparkEngineCatalogsOptions model - listSparkEngineCatalogsOptionsModel := new(watsonxdatav2.ListSparkEngineCatalogsOptions) - listSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListTableSnapshotsOptions model + listTableSnapshotsOptionsModel := new(watsonxdatav3.ListTableSnapshotsOptions) + listTableSnapshotsOptionsModel.CatalogName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.SchemaName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.TableName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.EngineID = core.StringPtr("testString") + listTableSnapshotsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listTableSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListSparkEngineCatalogs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListTableSnapshots with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkEngineCatalogsOptions model - listSparkEngineCatalogsOptionsModel := new(watsonxdatav2.ListSparkEngineCatalogsOptions) - listSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListTableSnapshotsOptions model + listTableSnapshotsOptionsModel := new(watsonxdatav3.ListTableSnapshotsOptions) + listTableSnapshotsOptionsModel.CatalogName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.SchemaName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.TableName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.EngineID = core.StringPtr("testString") + listTableSnapshotsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listTableSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListSparkEngineCatalogsOptions model with no property values - listSparkEngineCatalogsOptionsModelNew := new(watsonxdatav2.ListSparkEngineCatalogsOptions) + // Construct a second instance of the ListTableSnapshotsOptions model with no property values + listTableSnapshotsOptionsModelNew := new(watsonxdatav3.ListTableSnapshotsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModelNew) + result, response, operationErr = watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -23925,22 +25181,25 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListSparkEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListTableSnapshots successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkEngineCatalogsOptions model - listSparkEngineCatalogsOptionsModel := new(watsonxdatav2.ListSparkEngineCatalogsOptions) - listSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - listSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListTableSnapshotsOptions model + listTableSnapshotsOptionsModel := new(watsonxdatav3.ListTableSnapshotsOptions) + listTableSnapshotsOptionsModel.CatalogName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.SchemaName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.TableName = core.StringPtr("testString") + listTableSnapshotsOptionsModel.EngineID = core.StringPtr("testString") + listTableSnapshotsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listTableSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListSparkEngineCatalogs(listSparkEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -23952,46 +25211,47 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSparkEngineCatalogs(createSparkEngineCatalogsOptions *CreateSparkEngineCatalogsOptions) - Operation response error`, func() { - createSparkEngineCatalogsPath := "/spark_engines/testString/catalogs" + Describe(`ListSchemas(listSchemasOptions *ListSchemasOptions) - Operation response error`, func() { + listSchemasPath := "/v3/catalogs/testString/schemas" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineCatalogsPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listSchemasPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSparkEngineCatalogs with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSchemas with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSparkEngineCatalogsOptions model - createSparkEngineCatalogsOptionsModel := new(watsonxdatav2.CreateSparkEngineCatalogsOptions) - createSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSchemasOptions model + listSchemasOptionsModel := new(watsonxdatav3.ListSchemasOptions) + listSchemasOptionsModel.EngineID = core.StringPtr("testString") + listSchemasOptionsModel.ID = core.StringPtr("testString") + listSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.ListSchemas(listSchemasOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.ListSchemas(listSchemasOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -24001,46 +25261,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSparkEngineCatalogs(createSparkEngineCatalogsOptions *CreateSparkEngineCatalogsOptions)`, func() { - createSparkEngineCatalogsPath := "/spark_engines/testString/catalogs" + Describe(`ListSchemas(listSchemasOptions *ListSchemasOptions)`, func() { + listSchemasPath := "/v3/catalogs/testString/schemas" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineCatalogsPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listSchemasPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"schemas": ["Schemas"]}`) })) }) - It(`Invoke CreateSparkEngineCatalogs successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSchemas successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -24048,23 +25293,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateSparkEngineCatalogsOptions model - createSparkEngineCatalogsOptionsModel := new(watsonxdatav2.CreateSparkEngineCatalogsOptions) - createSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSchemasOptions model + listSchemasOptionsModel := new(watsonxdatav3.ListSchemasOptions) + listSchemasOptionsModel.EngineID = core.StringPtr("testString") + listSchemasOptionsModel.ID = core.StringPtr("testString") + listSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateSparkEngineCatalogsWithContext(ctx, createSparkEngineCatalogsOptionsModel) + _, _, operationErr := watsonxDataService.ListSchemasWithContext(ctx, listSchemasOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.ListSchemas(listSchemasOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -24072,7 +25317,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateSparkEngineCatalogsWithContext(ctx, createSparkEngineCatalogsOptionsModel) + _, _, operationErr = watsonxDataService.ListSchemasWithContext(ctx, listSchemasOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -24086,35 +25331,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSparkEngineCatalogsPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listSchemasPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"schemas": ["Schemas"]}`) })) }) - It(`Invoke CreateSparkEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSchemas successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -24122,51 +25352,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateSparkEngineCatalogs(nil) + result, response, operationErr := watsonxDataService.ListSchemas(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateSparkEngineCatalogsOptions model - createSparkEngineCatalogsOptionsModel := new(watsonxdatav2.CreateSparkEngineCatalogsOptions) - createSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSchemasOptions model + listSchemasOptionsModel := new(watsonxdatav3.ListSchemasOptions) + listSchemasOptionsModel.EngineID = core.StringPtr("testString") + listSchemasOptionsModel.ID = core.StringPtr("testString") + listSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.ListSchemas(listSchemasOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSparkEngineCatalogs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSchemas with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSparkEngineCatalogsOptions model - createSparkEngineCatalogsOptionsModel := new(watsonxdatav2.CreateSparkEngineCatalogsOptions) - createSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSchemasOptions model + listSchemasOptionsModel := new(watsonxdatav3.ListSchemasOptions) + listSchemasOptionsModel.EngineID = core.StringPtr("testString") + listSchemasOptionsModel.ID = core.StringPtr("testString") + listSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.ListSchemas(listSchemasOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateSparkEngineCatalogsOptions model with no property values - createSparkEngineCatalogsOptionsModelNew := new(watsonxdatav2.CreateSparkEngineCatalogsOptions) + // Construct a second instance of the ListSchemasOptions model with no property values + listSchemasOptionsModelNew := new(watsonxdatav3.ListSchemasOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModelNew) + result, response, operationErr = watsonxDataService.ListSchemas(listSchemasOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -24181,26 +25411,26 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateSparkEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSchemas successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSparkEngineCatalogsOptions model - createSparkEngineCatalogsOptionsModel := new(watsonxdatav2.CreateSparkEngineCatalogsOptions) - createSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.CatalogName = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSchemasOptions model + listSchemasOptionsModel := new(watsonxdatav3.ListSchemasOptions) + listSchemasOptionsModel.EngineID = core.StringPtr("testString") + listSchemasOptionsModel.ID = core.StringPtr("testString") + listSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateSparkEngineCatalogs(createSparkEngineCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.ListSchemas(listSchemasOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -24212,121 +25442,52 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptions *DeleteSparkEngineCatalogsOptions)`, func() { - deleteSparkEngineCatalogsPath := "/spark_engines/testString/catalogs" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSparkEngineCatalogsPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_names"]).To(Equal([]string{"testString"})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteSparkEngineCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteSparkEngineCatalogs(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSparkEngineCatalogsOptions model - deleteSparkEngineCatalogsOptionsModel := new(watsonxdatav2.DeleteSparkEngineCatalogsOptions) - deleteSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - deleteSparkEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") - deleteSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSparkEngineCatalogs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeleteSparkEngineCatalogsOptions model - deleteSparkEngineCatalogsOptionsModel := new(watsonxdatav2.DeleteSparkEngineCatalogsOptions) - deleteSparkEngineCatalogsOptionsModel.EngineID = core.StringPtr("testString") - deleteSparkEngineCatalogsOptionsModel.CatalogNames = core.StringPtr("testString") - deleteSparkEngineCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteSparkEngineCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSparkEngineCatalogsOptions model with no property values - deleteSparkEngineCatalogsOptionsModelNew := new(watsonxdatav2.DeleteSparkEngineCatalogsOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteSparkEngineCatalogs(deleteSparkEngineCatalogsOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`GetSparkEngineCatalog(getSparkEngineCatalogOptions *GetSparkEngineCatalogOptions) - Operation response error`, func() { - getSparkEngineCatalogPath := "/spark_engines/testString/catalogs/testString" + Describe(`CreateSchema(createSchemaOptions *CreateSchemaOptions) - Operation response error`, func() { + createSchemaPath := "/v3/catalogs/testString/schemas" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSchemaPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSparkEngineCatalog with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSchema with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSparkEngineCatalogOptions model - getSparkEngineCatalogOptionsModel := new(watsonxdatav2.GetSparkEngineCatalogOptions) - getSparkEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSchemaOptions model + createSchemaOptionsModel := new(watsonxdatav3.CreateSchemaOptions) + createSchemaOptionsModel.EngineID = core.StringPtr("testString") + createSchemaOptionsModel.ID = core.StringPtr("testString") + createSchemaOptionsModel.CustomPath = core.StringPtr("sample-path") + createSchemaOptionsModel.Name = core.StringPtr("SampleSchema1") + createSchemaOptionsModel.Hostname = core.StringPtr("db2@hostname.com") + createSchemaOptionsModel.Port = core.Int64Ptr(int64(4553)) + createSchemaOptionsModel.StorageName = core.StringPtr("sample-bucket") + createSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.CreateSchema(createSchemaOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) + result, response, operationErr = watsonxDataService.CreateSchema(createSchemaOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -24336,30 +25497,47 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSparkEngineCatalog(getSparkEngineCatalogOptions *GetSparkEngineCatalogOptions)`, func() { - getSparkEngineCatalogPath := "/spark_engines/testString/catalogs/testString" + Describe(`CreateSchema(createSchemaOptions *CreateSchemaOptions)`, func() { + createSchemaPath := "/v3/catalogs/testString/schemas" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSchemaPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"custom_path": "sample-path", "hostname": "db2@hostname.com", "name": "SampleSchema1", "port": 4553, "storage_name": "sample-bucket"}`) })) }) - It(`Invoke GetSparkEngineCatalog successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSchema successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -24367,23 +25545,28 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSparkEngineCatalogOptions model - getSparkEngineCatalogOptionsModel := new(watsonxdatav2.GetSparkEngineCatalogOptions) - getSparkEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSchemaOptions model + createSchemaOptionsModel := new(watsonxdatav3.CreateSchemaOptions) + createSchemaOptionsModel.EngineID = core.StringPtr("testString") + createSchemaOptionsModel.ID = core.StringPtr("testString") + createSchemaOptionsModel.CustomPath = core.StringPtr("sample-path") + createSchemaOptionsModel.Name = core.StringPtr("SampleSchema1") + createSchemaOptionsModel.Hostname = core.StringPtr("db2@hostname.com") + createSchemaOptionsModel.Port = core.Int64Ptr(int64(4553)) + createSchemaOptionsModel.StorageName = core.StringPtr("sample-bucket") + createSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSparkEngineCatalogWithContext(ctx, getSparkEngineCatalogOptionsModel) + _, _, operationErr := watsonxDataService.CreateSchemaWithContext(ctx, createSchemaOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.CreateSchema(createSchemaOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -24391,7 +25574,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSparkEngineCatalogWithContext(ctx, getSparkEngineCatalogOptionsModel) + _, _, operationErr = watsonxDataService.CreateSchemaWithContext(ctx, createSchemaOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -24405,19 +25588,36 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSchemaPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"custom_path": "sample-path", "hostname": "db2@hostname.com", "name": "SampleSchema1", "port": 4553, "storage_name": "sample-bucket"}`) })) }) - It(`Invoke GetSparkEngineCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSchema successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -24425,51 +25625,61 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSparkEngineCatalog(nil) + result, response, operationErr := watsonxDataService.CreateSchema(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSparkEngineCatalogOptions model - getSparkEngineCatalogOptionsModel := new(watsonxdatav2.GetSparkEngineCatalogOptions) - getSparkEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSchemaOptions model + createSchemaOptionsModel := new(watsonxdatav3.CreateSchemaOptions) + createSchemaOptionsModel.EngineID = core.StringPtr("testString") + createSchemaOptionsModel.ID = core.StringPtr("testString") + createSchemaOptionsModel.CustomPath = core.StringPtr("sample-path") + createSchemaOptionsModel.Name = core.StringPtr("SampleSchema1") + createSchemaOptionsModel.Hostname = core.StringPtr("db2@hostname.com") + createSchemaOptionsModel.Port = core.Int64Ptr(int64(4553)) + createSchemaOptionsModel.StorageName = core.StringPtr("sample-bucket") + createSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) + result, response, operationErr = watsonxDataService.CreateSchema(createSchemaOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSparkEngineCatalog with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSchema with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSparkEngineCatalogOptions model - getSparkEngineCatalogOptionsModel := new(watsonxdatav2.GetSparkEngineCatalogOptions) - getSparkEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSchemaOptions model + createSchemaOptionsModel := new(watsonxdatav3.CreateSchemaOptions) + createSchemaOptionsModel.EngineID = core.StringPtr("testString") + createSchemaOptionsModel.ID = core.StringPtr("testString") + createSchemaOptionsModel.CustomPath = core.StringPtr("sample-path") + createSchemaOptionsModel.Name = core.StringPtr("SampleSchema1") + createSchemaOptionsModel.Hostname = core.StringPtr("db2@hostname.com") + createSchemaOptionsModel.Port = core.Int64Ptr(int64(4553)) + createSchemaOptionsModel.StorageName = core.StringPtr("sample-bucket") + createSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.CreateSchema(createSchemaOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetSparkEngineCatalogOptions model with no property values - getSparkEngineCatalogOptionsModelNew := new(watsonxdatav2.GetSparkEngineCatalogOptions) + // Construct a second instance of the CreateSchemaOptions model with no property values + createSchemaOptionsModelNew := new(watsonxdatav3.CreateSchemaOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateSchema(createSchemaOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -24484,26 +25694,31 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetSparkEngineCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSchema successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSparkEngineCatalogOptions model - getSparkEngineCatalogOptionsModel := new(watsonxdatav2.GetSparkEngineCatalogOptions) - getSparkEngineCatalogOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSchemaOptions model + createSchemaOptionsModel := new(watsonxdatav3.CreateSchemaOptions) + createSchemaOptionsModel.EngineID = core.StringPtr("testString") + createSchemaOptionsModel.ID = core.StringPtr("testString") + createSchemaOptionsModel.CustomPath = core.StringPtr("sample-path") + createSchemaOptionsModel.Name = core.StringPtr("SampleSchema1") + createSchemaOptionsModel.Hostname = core.StringPtr("db2@hostname.com") + createSchemaOptionsModel.Port = core.Int64Ptr(int64(4553)) + createSchemaOptionsModel.StorageName = core.StringPtr("sample-bucket") + createSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSparkEngineCatalog(getSparkEngineCatalogOptionsModel) + result, response, operationErr := watsonxDataService.CreateSchema(createSchemaOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -24515,16 +25730,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptions *GetSparkEngineHistoryServerOptions) - Operation response error`, func() { - getSparkEngineHistoryServerPath := "/spark_engines/testString/history_server" + Describe(`UpdateSyncCatalog(updateSyncCatalogOptions *UpdateSyncCatalogOptions) - Operation response error`, func() { + updateSyncCatalogPath := "/v3/catalogs/testString/sync" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineHistoryServerPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSyncCatalogPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -24532,28 +25747,33 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSparkEngineHistoryServer with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSyncCatalog with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSparkEngineHistoryServerOptions model - getSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.GetSparkEngineHistoryServerOptions) - getSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSyncCatalogOptions model + updateSyncCatalogOptionsModel := new(watsonxdatav3.UpdateSyncCatalogOptions) + updateSyncCatalogOptionsModel.ID = core.StringPtr("testString") + updateSyncCatalogOptionsModel.AutoAddNewTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.RegisterNewTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncExistingTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncIcebergMd = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncPath = core.StringPtr("sample-path") + updateSyncCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSyncCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) + result, response, operationErr = watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -24563,16 +25783,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptions *GetSparkEngineHistoryServerOptions)`, func() { - getSparkEngineHistoryServerPath := "/spark_engines/testString/history_server" + Describe(`UpdateSyncCatalog(updateSyncCatalogOptions *UpdateSyncCatalogOptions)`, func() { + updateSyncCatalogPath := "/v3/catalogs/testString/sync" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineHistoryServerPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSyncCatalogPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -24582,11 +25818,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_termination_time": "2022-02-24T07:37:47Z", "cores": "1", "memory": "4G", "start_time": "2022-02-21T07:37:47Z", "state": "started"}`) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke GetSparkEngineHistoryServer successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSyncCatalog successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -24594,22 +25830,27 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSparkEngineHistoryServerOptions model - getSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.GetSparkEngineHistoryServerOptions) - getSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSyncCatalogOptions model + updateSyncCatalogOptionsModel := new(watsonxdatav3.UpdateSyncCatalogOptions) + updateSyncCatalogOptionsModel.ID = core.StringPtr("testString") + updateSyncCatalogOptionsModel.AutoAddNewTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.RegisterNewTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncExistingTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncIcebergMd = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncPath = core.StringPtr("sample-path") + updateSyncCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSyncCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSparkEngineHistoryServerWithContext(ctx, getSparkEngineHistoryServerOptionsModel) + _, _, operationErr := watsonxDataService.UpdateSyncCatalogWithContext(ctx, updateSyncCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -24617,7 +25858,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSparkEngineHistoryServerWithContext(ctx, getSparkEngineHistoryServerOptionsModel) + _, _, operationErr = watsonxDataService.UpdateSyncCatalogWithContext(ctx, updateSyncCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -24631,19 +25872,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSparkEngineHistoryServerPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateSyncCatalogPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"auto_termination_time": "2022-02-24T07:37:47Z", "cores": "1", "memory": "4G", "start_time": "2022-02-21T07:37:47Z", "state": "started"}`) + fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) })) }) - It(`Invoke GetSparkEngineHistoryServer successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSyncCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -24651,49 +25908,59 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSparkEngineHistoryServer(nil) + result, response, operationErr := watsonxDataService.UpdateSyncCatalog(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSparkEngineHistoryServerOptions model - getSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.GetSparkEngineHistoryServerOptions) - getSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSyncCatalogOptions model + updateSyncCatalogOptionsModel := new(watsonxdatav3.UpdateSyncCatalogOptions) + updateSyncCatalogOptionsModel.ID = core.StringPtr("testString") + updateSyncCatalogOptionsModel.AutoAddNewTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.RegisterNewTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncExistingTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncIcebergMd = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncPath = core.StringPtr("sample-path") + updateSyncCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSyncCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) + result, response, operationErr = watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSparkEngineHistoryServer with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSyncCatalog with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSparkEngineHistoryServerOptions model - getSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.GetSparkEngineHistoryServerOptions) - getSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSyncCatalogOptions model + updateSyncCatalogOptionsModel := new(watsonxdatav3.UpdateSyncCatalogOptions) + updateSyncCatalogOptionsModel.ID = core.StringPtr("testString") + updateSyncCatalogOptionsModel.AutoAddNewTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.RegisterNewTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncExistingTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncIcebergMd = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncPath = core.StringPtr("sample-path") + updateSyncCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSyncCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetSparkEngineHistoryServerOptions model with no property values - getSparkEngineHistoryServerOptionsModelNew := new(watsonxdatav2.GetSparkEngineHistoryServerOptions) + // Construct a second instance of the UpdateSyncCatalogOptions model with no property values + updateSyncCatalogOptionsModelNew := new(watsonxdatav3.UpdateSyncCatalogOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -24711,22 +25978,27 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSparkEngineHistoryServer successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSyncCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSparkEngineHistoryServerOptions model - getSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.GetSparkEngineHistoryServerOptions) - getSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - getSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSyncCatalogOptions model + updateSyncCatalogOptionsModel := new(watsonxdatav3.UpdateSyncCatalogOptions) + updateSyncCatalogOptionsModel.ID = core.StringPtr("testString") + updateSyncCatalogOptionsModel.AutoAddNewTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.RegisterNewTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncExistingTables = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncIcebergMd = core.BoolPtr(true) + updateSyncCatalogOptionsModel.SyncPath = core.StringPtr("sample-path") + updateSyncCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSyncCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSparkEngineHistoryServer(getSparkEngineHistoryServerOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -24738,47 +26010,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptions *StartSparkEngineHistoryServerOptions) - Operation response error`, func() { - startSparkEngineHistoryServerPath := "/spark_engines/testString/history_server" + Describe(`GetCatalog(getCatalogOptions *GetCatalogOptions) - Operation response error`, func() { + getCatalogPath := "/v3/catalogs/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(startSparkEngineHistoryServerPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getCatalogPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke StartSparkEngineHistoryServer with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetCatalog with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the StartSparkEngineHistoryServerOptions model - startSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.StartSparkEngineHistoryServerOptions) - startSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - startSparkEngineHistoryServerOptionsModel.Cores = core.StringPtr("1") - startSparkEngineHistoryServerOptionsModel.Memory = core.StringPtr("4G") - startSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - startSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogOptions model + getCatalogOptionsModel := new(watsonxdatav3.GetCatalogOptions) + getCatalogOptionsModel.Name = core.StringPtr("testString") + getCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) + result, response, operationErr := watsonxDataService.GetCatalog(getCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) + result, response, operationErr = watsonxDataService.GetCatalog(getCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -24788,32 +26058,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptions *StartSparkEngineHistoryServerOptions)`, func() { - startSparkEngineHistoryServerPath := "/spark_engines/testString/history_server" + Describe(`GetCatalog(getCatalogOptions *GetCatalogOptions)`, func() { + getCatalogPath := "/v3/catalogs/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(startSparkEngineHistoryServerPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getCatalogPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -24822,12 +26076,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"auto_termination_time": "2022-02-24T07:37:47Z", "cores": "1", "memory": "4G", "start_time": "2022-02-21T07:37:47Z", "state": "started"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}`) })) }) - It(`Invoke StartSparkEngineHistoryServer successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetCatalog successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -24835,24 +26089,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the StartSparkEngineHistoryServerOptions model - startSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.StartSparkEngineHistoryServerOptions) - startSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - startSparkEngineHistoryServerOptionsModel.Cores = core.StringPtr("1") - startSparkEngineHistoryServerOptionsModel.Memory = core.StringPtr("4G") - startSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - startSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogOptions model + getCatalogOptionsModel := new(watsonxdatav3.GetCatalogOptions) + getCatalogOptionsModel.Name = core.StringPtr("testString") + getCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.StartSparkEngineHistoryServerWithContext(ctx, startSparkEngineHistoryServerOptionsModel) + _, _, operationErr := watsonxDataService.GetCatalogWithContext(ctx, getCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) + result, response, operationErr := watsonxDataService.GetCatalog(getCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -24860,7 +26112,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.StartSparkEngineHistoryServerWithContext(ctx, startSparkEngineHistoryServerOptionsModel) + _, _, operationErr = watsonxDataService.GetCatalogWithContext(ctx, getCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -24874,35 +26126,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(startSparkEngineHistoryServerPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getCatalogPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"auto_termination_time": "2022-02-24T07:37:47Z", "cores": "1", "memory": "4G", "start_time": "2022-02-21T07:37:47Z", "state": "started"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"actions": ["select"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "associated_storage": ["AssociatedStorage"], "base_path": "/abc/def", "catalog_sync_metadata": {"last_sync_at": "1602839833", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS"}, "created_at": "1602839833", "created_by": "@.com", "days_left": "30", "description": "Iceberg catalog description", "location_uri": "s3a://testbucket", "managed_by": "ibm", "mds_connection_information": {"external_metastore_rest_uri": "https://samplehost-catalog:4352", "external_metastore_thrift_uri": "https://samplehost-catalog:4352", "hostname": "example.example.lakehouse.dev.appdomain.cloud", "port": "3232", "rest_uri": "https://samplehost-catalog:4352", "thrift_uri": "thrift://samplehost-catalog:4354"}, "metastore": "glue", "name": "sampleCatalog", "status": "running", "tags": ["Tags"], "catalog_names": ["iceberg_catalog"], "type": "iceberg"}`) })) }) - It(`Invoke StartSparkEngineHistoryServer successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -24910,53 +26146,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.StartSparkEngineHistoryServer(nil) + result, response, operationErr := watsonxDataService.GetCatalog(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the StartSparkEngineHistoryServerOptions model - startSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.StartSparkEngineHistoryServerOptions) - startSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - startSparkEngineHistoryServerOptionsModel.Cores = core.StringPtr("1") - startSparkEngineHistoryServerOptionsModel.Memory = core.StringPtr("4G") - startSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - startSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogOptions model + getCatalogOptionsModel := new(watsonxdatav3.GetCatalogOptions) + getCatalogOptionsModel.Name = core.StringPtr("testString") + getCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) + result, response, operationErr = watsonxDataService.GetCatalog(getCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke StartSparkEngineHistoryServer with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetCatalog with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the StartSparkEngineHistoryServerOptions model - startSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.StartSparkEngineHistoryServerOptions) - startSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - startSparkEngineHistoryServerOptionsModel.Cores = core.StringPtr("1") - startSparkEngineHistoryServerOptionsModel.Memory = core.StringPtr("4G") - startSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - startSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogOptions model + getCatalogOptionsModel := new(watsonxdatav3.GetCatalogOptions) + getCatalogOptionsModel.Name = core.StringPtr("testString") + getCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) + result, response, operationErr := watsonxDataService.GetCatalog(getCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the StartSparkEngineHistoryServerOptions model with no property values - startSparkEngineHistoryServerOptionsModelNew := new(watsonxdatav2.StartSparkEngineHistoryServerOptions) + // Construct a second instance of the GetCatalogOptions model with no property values + getCatalogOptionsModelNew := new(watsonxdatav3.GetCatalogOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModelNew) + result, response, operationErr = watsonxDataService.GetCatalog(getCatalogOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -24971,27 +26203,25 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke StartSparkEngineHistoryServer successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the StartSparkEngineHistoryServerOptions model - startSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.StartSparkEngineHistoryServerOptions) - startSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - startSparkEngineHistoryServerOptionsModel.Cores = core.StringPtr("1") - startSparkEngineHistoryServerOptionsModel.Memory = core.StringPtr("4G") - startSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - startSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetCatalogOptions model + getCatalogOptionsModel := new(watsonxdatav3.GetCatalogOptions) + getCatalogOptionsModel.Name = core.StringPtr("testString") + getCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + getCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.StartSparkEngineHistoryServer(startSparkEngineHistoryServerOptionsModel) + result, response, operationErr := watsonxDataService.GetCatalog(getCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -25003,24 +26233,25 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptions *DeleteSparkEngineHistoryServerOptions)`, func() { - deleteSparkEngineHistoryServerPath := "/spark_engines/testString/history_server" + Describe(`DeleteCatalog(deleteCatalogOptions *DeleteCatalogOptions)`, func() { + deleteCatalogPath := "/v3/catalogs/testString" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSparkEngineHistoryServerPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteCatalogPath)) Expect(req.Method).To(Equal("DELETE")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // TODO: Add check for skip_mds_call query parameter res.WriteHeader(204) })) }) - It(`Invoke DeleteSparkEngineHistoryServer successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteCatalog successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -25028,45 +26259,47 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteSparkEngineHistoryServer(nil) + response, operationErr := watsonxDataService.DeleteCatalog(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteSparkEngineHistoryServerOptions model - deleteSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.DeleteSparkEngineHistoryServerOptions) - deleteSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - deleteSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteCatalogOptions model + deleteCatalogOptionsModel := new(watsonxdatav3.DeleteCatalogOptions) + deleteCatalogOptionsModel.Name = core.StringPtr("testString") + deleteCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteCatalogOptionsModel.SkipMdsCall = core.BoolPtr(false) + deleteCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptionsModel) + response, operationErr = watsonxDataService.DeleteCatalog(deleteCatalogOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteSparkEngineHistoryServer with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteCatalog with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DeleteSparkEngineHistoryServerOptions model - deleteSparkEngineHistoryServerOptionsModel := new(watsonxdatav2.DeleteSparkEngineHistoryServerOptions) - deleteSparkEngineHistoryServerOptionsModel.EngineID = core.StringPtr("testString") - deleteSparkEngineHistoryServerOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteSparkEngineHistoryServerOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteCatalogOptions model + deleteCatalogOptionsModel := new(watsonxdatav3.DeleteCatalogOptions) + deleteCatalogOptionsModel.Name = core.StringPtr("testString") + deleteCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteCatalogOptionsModel.SkipMdsCall = core.BoolPtr(false) + deleteCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptionsModel) + response, operationErr := watsonxDataService.DeleteCatalog(deleteCatalogOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSparkEngineHistoryServerOptions model with no property values - deleteSparkEngineHistoryServerOptionsModelNew := new(watsonxdatav2.DeleteSparkEngineHistoryServerOptions) + // Construct a second instance of the DeleteCatalogOptions model with no property values + deleteCatalogOptionsModelNew := new(watsonxdatav3.DeleteCatalogOptions) // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteSparkEngineHistoryServer(deleteSparkEngineHistoryServerOptionsModelNew) + response, operationErr = watsonxDataService.DeleteCatalog(deleteCatalogOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) }) @@ -25075,16 +26308,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`PauseSparkEngine(pauseSparkEngineOptions *PauseSparkEngineOptions) - Operation response error`, func() { - pauseSparkEnginePath := "/spark_engines/testString/pause" + Describe(`ListMilvusServices(listMilvusServicesOptions *ListMilvusServicesOptions) - Operation response error`, func() { + listMilvusServicesPath := "/v3/milvus_services" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(pauseSparkEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusServicesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -25092,29 +26325,27 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke PauseSparkEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusServices with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PauseSparkEngineOptions model - pauseSparkEngineOptionsModel := new(watsonxdatav2.PauseSparkEngineOptions) - pauseSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - pauseSparkEngineOptionsModel.Force = core.BoolPtr(true) - pauseSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pauseSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusServicesOptions model + listMilvusServicesOptionsModel := new(watsonxdatav3.ListMilvusServicesOptions) + listMilvusServicesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusServicesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -25124,32 +26355,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`PauseSparkEngine(pauseSparkEngineOptions *PauseSparkEngineOptions)`, func() { - pauseSparkEnginePath := "/spark_engines/testString/pause" + Describe(`ListMilvusServices(listMilvusServicesOptions *ListMilvusServicesOptions)`, func() { + listMilvusServicesPath := "/v3/milvus_services" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(pauseSparkEnginePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusServicesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -25159,11 +26374,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + fmt.Fprintf(res, "%s", `{"milvus_services": [{"access_key": "Sample storage access key", "actions": ["Actions"], "created_at": 1, "created_by": "@.com", "dc_cpu": 0.01, "dc_memory": 0.01, "dc_replicas": 1, "description": "milvus service for running sql queries", "display_name": "sampleService", "dw_cpu": 0.01, "dw_memory": 0.01, "dw_replicas": 1, "endpoint": "Endpoint", "etcd_cpu": 0.01, "etcd_memory": 0.01, "failure_message": "Failed to start engine", "grpc_host": "example.grpc.host", "grpc_port": 1, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 1, "id": "milvus123", "index_type": "hnsw", "iw_cpu": 0.01, "iw_memory": 0.01, "iw_replicas": 1, "kafka_cpu": 0.01, "kafka_memory": 0.01, "managed_by": "customer", "origin": "native", "proxy_cpu": 0.01, "proxy_host": "example.proxy.host", "proxy_memory": 0.01, "proxy_port": 1, "proxy_replicas": 1, "qc_cpu": 0.01, "qc_memory": 0.01, "qc_replicas": 1, "qw_cpu": 0.01, "qw_memory": 0.01, "qw_replicas": 1, "rc_cpu": 0.01, "rc_memory": 0.01, "rc_replicas": 1, "root_path": "Sample/path", "secret_key": "Sample storage secret access key", "status": "running", "status_code": 1, "storage_name": "Sample_storage_name", "tags": ["Tags"], "tshirt_size": "small", "type": "milvus", "vector": 1, "vector_dimension": 384, "version": "3.5"}]}`) })) }) - It(`Invoke PauseSparkEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusServices successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -25171,23 +26386,21 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the PauseSparkEngineOptions model - pauseSparkEngineOptionsModel := new(watsonxdatav2.PauseSparkEngineOptions) - pauseSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - pauseSparkEngineOptionsModel.Force = core.BoolPtr(true) - pauseSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pauseSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusServicesOptions model + listMilvusServicesOptionsModel := new(watsonxdatav3.ListMilvusServicesOptions) + listMilvusServicesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusServicesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.PauseSparkEngineWithContext(ctx, pauseSparkEngineOptionsModel) + _, _, operationErr := watsonxDataService.ListMilvusServicesWithContext(ctx, listMilvusServicesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -25195,7 +26408,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.PauseSparkEngineWithContext(ctx, pauseSparkEngineOptionsModel) + _, _, operationErr = watsonxDataService.ListMilvusServicesWithContext(ctx, listMilvusServicesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -25209,35 +26422,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(pauseSparkEnginePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusServicesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + fmt.Fprintf(res, "%s", `{"milvus_services": [{"access_key": "Sample storage access key", "actions": ["Actions"], "created_at": 1, "created_by": "@.com", "dc_cpu": 0.01, "dc_memory": 0.01, "dc_replicas": 1, "description": "milvus service for running sql queries", "display_name": "sampleService", "dw_cpu": 0.01, "dw_memory": 0.01, "dw_replicas": 1, "endpoint": "Endpoint", "etcd_cpu": 0.01, "etcd_memory": 0.01, "failure_message": "Failed to start engine", "grpc_host": "example.grpc.host", "grpc_port": 1, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 1, "id": "milvus123", "index_type": "hnsw", "iw_cpu": 0.01, "iw_memory": 0.01, "iw_replicas": 1, "kafka_cpu": 0.01, "kafka_memory": 0.01, "managed_by": "customer", "origin": "native", "proxy_cpu": 0.01, "proxy_host": "example.proxy.host", "proxy_memory": 0.01, "proxy_port": 1, "proxy_replicas": 1, "qc_cpu": 0.01, "qc_memory": 0.01, "qc_replicas": 1, "qw_cpu": 0.01, "qw_memory": 0.01, "qw_replicas": 1, "rc_cpu": 0.01, "rc_memory": 0.01, "rc_replicas": 1, "root_path": "Sample/path", "secret_key": "Sample storage secret access key", "status": "running", "status_code": 1, "storage_name": "Sample_storage_name", "tags": ["Tags"], "tshirt_size": "small", "type": "milvus", "vector": 1, "vector_dimension": 384, "version": "3.5"}]}`) })) }) - It(`Invoke PauseSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusServices successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -25245,54 +26442,43 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.PauseSparkEngine(nil) + result, response, operationErr := watsonxDataService.ListMilvusServices(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the PauseSparkEngineOptions model - pauseSparkEngineOptionsModel := new(watsonxdatav2.PauseSparkEngineOptions) - pauseSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - pauseSparkEngineOptionsModel.Force = core.BoolPtr(true) - pauseSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pauseSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusServicesOptions model + listMilvusServicesOptionsModel := new(watsonxdatav3.ListMilvusServicesOptions) + listMilvusServicesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusServicesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke PauseSparkEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusServices with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PauseSparkEngineOptions model - pauseSparkEngineOptionsModel := new(watsonxdatav2.PauseSparkEngineOptions) - pauseSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - pauseSparkEngineOptionsModel.Force = core.BoolPtr(true) - pauseSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pauseSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusServicesOptions model + listMilvusServicesOptionsModel := new(watsonxdatav3.ListMilvusServicesOptions) + listMilvusServicesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusServicesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the PauseSparkEngineOptions model with no property values - pauseSparkEngineOptionsModelNew := new(watsonxdatav2.PauseSparkEngineOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -25307,23 +26493,21 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke PauseSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusServices successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PauseSparkEngineOptions model - pauseSparkEngineOptionsModel := new(watsonxdatav2.PauseSparkEngineOptions) - pauseSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - pauseSparkEngineOptionsModel.Force = core.BoolPtr(true) - pauseSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - pauseSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusServicesOptions model + listMilvusServicesOptionsModel := new(watsonxdatav3.ListMilvusServicesOptions) + listMilvusServicesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusServicesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.PauseSparkEngine(pauseSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -25335,45 +26519,80 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ResumeSparkEngine(resumeSparkEngineOptions *ResumeSparkEngineOptions) - Operation response error`, func() { - resumeSparkEnginePath := "/spark_engines/testString/resume" + Describe(`CreateMilvusService(createMilvusServiceOptions *CreateMilvusServiceOptions) - Operation response error`, func() { + createMilvusServicePath := "/v3/milvus_services" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(resumeSparkEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(202) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ResumeSparkEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusService with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ResumeSparkEngineOptions model - resumeSparkEngineOptionsModel := new(watsonxdatav2.ResumeSparkEngineOptions) - resumeSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - resumeSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumeSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceOptions model + createMilvusServiceOptionsModel := new(watsonxdatav3.CreateMilvusServiceOptions) + createMilvusServiceOptionsModel.DisplayName = core.StringPtr("sampleService") + createMilvusServiceOptionsModel.Origin = core.StringPtr("native") + createMilvusServiceOptionsModel.RootPath = core.StringPtr("Sample/path") + createMilvusServiceOptionsModel.TshirtSize = core.StringPtr("small") + createMilvusServiceOptionsModel.DcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.Description = core.StringPtr("milvus service for running sql queries") + createMilvusServiceOptionsModel.DwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.EtcdCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.EtcdMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ID = core.StringPtr("milvus123") + createMilvusServiceOptionsModel.IndexType = core.StringPtr("ivf_sq8") + createMilvusServiceOptionsModel.IwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.IwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.IwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.KafkaCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.KafkaMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.QcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.QwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.RcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.RcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.RcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.StorageName = core.StringPtr("Sample_storage_name") + createMilvusServiceOptionsModel.Tags = []string{"tag1", "tag2"} + createMilvusServiceOptionsModel.Vector = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.VectorDimension = core.Int64Ptr(int64(384)) + createMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -25383,17 +26602,33 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ResumeSparkEngine(resumeSparkEngineOptions *ResumeSparkEngineOptions)`, func() { - resumeSparkEnginePath := "/spark_engines/testString/resume" + Describe(`CreateMilvusService(createMilvusServiceOptions *CreateMilvusServiceOptions)`, func() { + createMilvusServicePath := "/v3/milvus_services" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(resumeSparkEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePath)) Expect(req.Method).To(Equal("POST")) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Sleep a short time to support a timeout test @@ -25401,12 +26636,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"access_key": "Sample storage access key", "actions": ["Actions"], "created_at": 1, "created_by": "@.com", "dc_cpu": 0.01, "dc_memory": 0.01, "dc_replicas": 1, "description": "milvus service for running sql queries", "display_name": "sampleService", "dw_cpu": 0.01, "dw_memory": 0.01, "dw_replicas": 1, "endpoint": "Endpoint", "etcd_cpu": 0.01, "etcd_memory": 0.01, "failure_message": "Failed to start engine", "grpc_host": "example.grpc.host", "grpc_port": 1, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 1, "id": "milvus123", "index_type": "hnsw", "iw_cpu": 0.01, "iw_memory": 0.01, "iw_replicas": 1, "kafka_cpu": 0.01, "kafka_memory": 0.01, "managed_by": "customer", "origin": "native", "proxy_cpu": 0.01, "proxy_host": "example.proxy.host", "proxy_memory": 0.01, "proxy_port": 1, "proxy_replicas": 1, "qc_cpu": 0.01, "qc_memory": 0.01, "qc_replicas": 1, "qw_cpu": 0.01, "qw_memory": 0.01, "qw_replicas": 1, "rc_cpu": 0.01, "rc_memory": 0.01, "rc_replicas": 1, "root_path": "Sample/path", "secret_key": "Sample storage secret access key", "status": "running", "status_code": 1, "storage_name": "Sample_storage_name", "tags": ["Tags"], "tshirt_size": "small", "type": "milvus", "vector": 1, "vector_dimension": 384, "version": "3.5"}`) })) }) - It(`Invoke ResumeSparkEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusService successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -25414,22 +26649,57 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ResumeSparkEngineOptions model - resumeSparkEngineOptionsModel := new(watsonxdatav2.ResumeSparkEngineOptions) - resumeSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - resumeSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumeSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceOptions model + createMilvusServiceOptionsModel := new(watsonxdatav3.CreateMilvusServiceOptions) + createMilvusServiceOptionsModel.DisplayName = core.StringPtr("sampleService") + createMilvusServiceOptionsModel.Origin = core.StringPtr("native") + createMilvusServiceOptionsModel.RootPath = core.StringPtr("Sample/path") + createMilvusServiceOptionsModel.TshirtSize = core.StringPtr("small") + createMilvusServiceOptionsModel.DcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.Description = core.StringPtr("milvus service for running sql queries") + createMilvusServiceOptionsModel.DwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.EtcdCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.EtcdMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ID = core.StringPtr("milvus123") + createMilvusServiceOptionsModel.IndexType = core.StringPtr("ivf_sq8") + createMilvusServiceOptionsModel.IwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.IwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.IwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.KafkaCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.KafkaMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.QcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.QwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.RcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.RcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.RcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.StorageName = core.StringPtr("Sample_storage_name") + createMilvusServiceOptionsModel.Tags = []string{"tag1", "tag2"} + createMilvusServiceOptionsModel.Vector = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.VectorDimension = core.Int64Ptr(int64(384)) + createMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ResumeSparkEngineWithContext(ctx, resumeSparkEngineOptionsModel) + _, _, operationErr := watsonxDataService.CreateMilvusServiceWithContext(ctx, createMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -25437,7 +26707,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ResumeSparkEngineWithContext(ctx, resumeSparkEngineOptionsModel) + _, _, operationErr = watsonxDataService.CreateMilvusServiceWithContext(ctx, createMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -25451,69 +26721,155 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(resumeSparkEnginePath)) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePath)) Expect(req.Method).To(Equal("POST")) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) - })) - }) - It(`Invoke ResumeSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(202) + fmt.Fprintf(res, "%s", `{"access_key": "Sample storage access key", "actions": ["Actions"], "created_at": 1, "created_by": "@.com", "dc_cpu": 0.01, "dc_memory": 0.01, "dc_replicas": 1, "description": "milvus service for running sql queries", "display_name": "sampleService", "dw_cpu": 0.01, "dw_memory": 0.01, "dw_replicas": 1, "endpoint": "Endpoint", "etcd_cpu": 0.01, "etcd_memory": 0.01, "failure_message": "Failed to start engine", "grpc_host": "example.grpc.host", "grpc_port": 1, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 1, "id": "milvus123", "index_type": "hnsw", "iw_cpu": 0.01, "iw_memory": 0.01, "iw_replicas": 1, "kafka_cpu": 0.01, "kafka_memory": 0.01, "managed_by": "customer", "origin": "native", "proxy_cpu": 0.01, "proxy_host": "example.proxy.host", "proxy_memory": 0.01, "proxy_port": 1, "proxy_replicas": 1, "qc_cpu": 0.01, "qc_memory": 0.01, "qc_replicas": 1, "qw_cpu": 0.01, "qw_memory": 0.01, "qw_replicas": 1, "rc_cpu": 0.01, "rc_memory": 0.01, "rc_replicas": 1, "root_path": "Sample/path", "secret_key": "Sample storage secret access key", "status": "running", "status_code": 1, "storage_name": "Sample_storage_name", "tags": ["Tags"], "tshirt_size": "small", "type": "milvus", "vector": 1, "vector_dimension": 384, "version": "3.5"}`) + })) + }) + It(`Invoke CreateMilvusService successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ResumeSparkEngine(nil) + result, response, operationErr := watsonxDataService.CreateMilvusService(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ResumeSparkEngineOptions model - resumeSparkEngineOptionsModel := new(watsonxdatav2.ResumeSparkEngineOptions) - resumeSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - resumeSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumeSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceOptions model + createMilvusServiceOptionsModel := new(watsonxdatav3.CreateMilvusServiceOptions) + createMilvusServiceOptionsModel.DisplayName = core.StringPtr("sampleService") + createMilvusServiceOptionsModel.Origin = core.StringPtr("native") + createMilvusServiceOptionsModel.RootPath = core.StringPtr("Sample/path") + createMilvusServiceOptionsModel.TshirtSize = core.StringPtr("small") + createMilvusServiceOptionsModel.DcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.Description = core.StringPtr("milvus service for running sql queries") + createMilvusServiceOptionsModel.DwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.EtcdCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.EtcdMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ID = core.StringPtr("milvus123") + createMilvusServiceOptionsModel.IndexType = core.StringPtr("ivf_sq8") + createMilvusServiceOptionsModel.IwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.IwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.IwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.KafkaCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.KafkaMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.QcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.QwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.RcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.RcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.RcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.StorageName = core.StringPtr("Sample_storage_name") + createMilvusServiceOptionsModel.Tags = []string{"tag1", "tag2"} + createMilvusServiceOptionsModel.Vector = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.VectorDimension = core.Int64Ptr(int64(384)) + createMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ResumeSparkEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusService with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ResumeSparkEngineOptions model - resumeSparkEngineOptionsModel := new(watsonxdatav2.ResumeSparkEngineOptions) - resumeSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - resumeSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumeSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceOptions model + createMilvusServiceOptionsModel := new(watsonxdatav3.CreateMilvusServiceOptions) + createMilvusServiceOptionsModel.DisplayName = core.StringPtr("sampleService") + createMilvusServiceOptionsModel.Origin = core.StringPtr("native") + createMilvusServiceOptionsModel.RootPath = core.StringPtr("Sample/path") + createMilvusServiceOptionsModel.TshirtSize = core.StringPtr("small") + createMilvusServiceOptionsModel.DcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.Description = core.StringPtr("milvus service for running sql queries") + createMilvusServiceOptionsModel.DwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.EtcdCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.EtcdMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ID = core.StringPtr("milvus123") + createMilvusServiceOptionsModel.IndexType = core.StringPtr("ivf_sq8") + createMilvusServiceOptionsModel.IwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.IwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.IwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.KafkaCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.KafkaMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.QcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.QwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.RcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.RcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.RcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.StorageName = core.StringPtr("Sample_storage_name") + createMilvusServiceOptionsModel.Tags = []string{"tag1", "tag2"} + createMilvusServiceOptionsModel.Vector = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.VectorDimension = core.Int64Ptr(int64(384)) + createMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ResumeSparkEngineOptions model with no property values - resumeSparkEngineOptionsModelNew := new(watsonxdatav2.ResumeSparkEngineOptions) + // Construct a second instance of the CreateMilvusServiceOptions model with no property values + createMilvusServiceOptionsModelNew := new(watsonxdatav3.CreateMilvusServiceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -25528,25 +26884,60 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(202) })) }) - It(`Invoke ResumeSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusService successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ResumeSparkEngineOptions model - resumeSparkEngineOptionsModel := new(watsonxdatav2.ResumeSparkEngineOptions) - resumeSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - resumeSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - resumeSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceOptions model + createMilvusServiceOptionsModel := new(watsonxdatav3.CreateMilvusServiceOptions) + createMilvusServiceOptionsModel.DisplayName = core.StringPtr("sampleService") + createMilvusServiceOptionsModel.Origin = core.StringPtr("native") + createMilvusServiceOptionsModel.RootPath = core.StringPtr("Sample/path") + createMilvusServiceOptionsModel.TshirtSize = core.StringPtr("small") + createMilvusServiceOptionsModel.DcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.Description = core.StringPtr("milvus service for running sql queries") + createMilvusServiceOptionsModel.DwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.DwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.EtcdCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.EtcdMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ID = core.StringPtr("milvus123") + createMilvusServiceOptionsModel.IndexType = core.StringPtr("ivf_sq8") + createMilvusServiceOptionsModel.IwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.IwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.IwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.KafkaCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.KafkaMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.ProxyReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.QcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.QwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.QwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.RcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.RcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceOptionsModel.RcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.StorageName = core.StringPtr("Sample_storage_name") + createMilvusServiceOptionsModel.Tags = []string{"tag1", "tag2"} + createMilvusServiceOptionsModel.Vector = core.Int64Ptr(int64(1)) + createMilvusServiceOptionsModel.VectorDimension = core.Int64Ptr(int64(384)) + createMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ResumeSparkEngine(resumeSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -25558,46 +26949,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ScaleSparkEngine(scaleSparkEngineOptions *ScaleSparkEngineOptions) - Operation response error`, func() { - scaleSparkEnginePath := "/spark_engines/testString/scale" + Describe(`GetMilvusService(getMilvusServiceOptions *GetMilvusServiceOptions) - Operation response error`, func() { + getMilvusServicePath := "/v3/milvus_services/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(scaleSparkEnginePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getMilvusServicePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ScaleSparkEngine with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetMilvusService with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ScaleSparkEngineOptions model - scaleSparkEngineOptionsModel := new(watsonxdatav2.ScaleSparkEngineOptions) - scaleSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - scaleSparkEngineOptionsModel.NumberOfNodes = core.Int64Ptr(int64(2)) - scaleSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scaleSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetMilvusServiceOptions model + getMilvusServiceOptionsModel := new(watsonxdatav3.GetMilvusServiceOptions) + getMilvusServiceOptionsModel.ID = core.StringPtr("testString") + getMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + getMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -25607,32 +26997,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ScaleSparkEngine(scaleSparkEngineOptions *ScaleSparkEngineOptions)`, func() { - scaleSparkEnginePath := "/spark_engines/testString/scale" + Describe(`GetMilvusService(getMilvusServiceOptions *GetMilvusServiceOptions)`, func() { + getMilvusServicePath := "/v3/milvus_services/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(scaleSparkEnginePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getMilvusServicePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -25641,12 +27015,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"access_key": "Sample storage access key", "actions": ["Actions"], "created_at": 1, "created_by": "@.com", "dc_cpu": 0.01, "dc_memory": 0.01, "dc_replicas": 1, "description": "milvus service for running sql queries", "display_name": "sampleService", "dw_cpu": 0.01, "dw_memory": 0.01, "dw_replicas": 1, "endpoint": "Endpoint", "etcd_cpu": 0.01, "etcd_memory": 0.01, "failure_message": "Failed to start engine", "grpc_host": "example.grpc.host", "grpc_port": 1, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 1, "id": "milvus123", "index_type": "hnsw", "iw_cpu": 0.01, "iw_memory": 0.01, "iw_replicas": 1, "kafka_cpu": 0.01, "kafka_memory": 0.01, "managed_by": "customer", "origin": "native", "proxy_cpu": 0.01, "proxy_host": "example.proxy.host", "proxy_memory": 0.01, "proxy_port": 1, "proxy_replicas": 1, "qc_cpu": 0.01, "qc_memory": 0.01, "qc_replicas": 1, "qw_cpu": 0.01, "qw_memory": 0.01, "qw_replicas": 1, "rc_cpu": 0.01, "rc_memory": 0.01, "rc_replicas": 1, "root_path": "Sample/path", "secret_key": "Sample storage secret access key", "status": "running", "status_code": 1, "storage_name": "Sample_storage_name", "tags": ["Tags"], "tshirt_size": "small", "type": "milvus", "vector": 1, "vector_dimension": 384, "version": "3.5"}`) })) }) - It(`Invoke ScaleSparkEngine successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetMilvusService successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -25654,23 +27028,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ScaleSparkEngineOptions model - scaleSparkEngineOptionsModel := new(watsonxdatav2.ScaleSparkEngineOptions) - scaleSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - scaleSparkEngineOptionsModel.NumberOfNodes = core.Int64Ptr(int64(2)) - scaleSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scaleSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetMilvusServiceOptions model + getMilvusServiceOptionsModel := new(watsonxdatav3.GetMilvusServiceOptions) + getMilvusServiceOptionsModel.ID = core.StringPtr("testString") + getMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + getMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ScaleSparkEngineWithContext(ctx, scaleSparkEngineOptionsModel) + _, _, operationErr := watsonxDataService.GetMilvusServiceWithContext(ctx, getMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -25678,7 +27051,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ScaleSparkEngineWithContext(ctx, scaleSparkEngineOptionsModel) + _, _, operationErr = watsonxDataService.GetMilvusServiceWithContext(ctx, getMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -25692,35 +27065,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(scaleSparkEnginePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getMilvusServicePath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"access_key": "Sample storage access key", "actions": ["Actions"], "created_at": 1, "created_by": "@.com", "dc_cpu": 0.01, "dc_memory": 0.01, "dc_replicas": 1, "description": "milvus service for running sql queries", "display_name": "sampleService", "dw_cpu": 0.01, "dw_memory": 0.01, "dw_replicas": 1, "endpoint": "Endpoint", "etcd_cpu": 0.01, "etcd_memory": 0.01, "failure_message": "Failed to start engine", "grpc_host": "example.grpc.host", "grpc_port": 1, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 1, "id": "milvus123", "index_type": "hnsw", "iw_cpu": 0.01, "iw_memory": 0.01, "iw_replicas": 1, "kafka_cpu": 0.01, "kafka_memory": 0.01, "managed_by": "customer", "origin": "native", "proxy_cpu": 0.01, "proxy_host": "example.proxy.host", "proxy_memory": 0.01, "proxy_port": 1, "proxy_replicas": 1, "qc_cpu": 0.01, "qc_memory": 0.01, "qc_replicas": 1, "qw_cpu": 0.01, "qw_memory": 0.01, "qw_replicas": 1, "rc_cpu": 0.01, "rc_memory": 0.01, "rc_replicas": 1, "root_path": "Sample/path", "secret_key": "Sample storage secret access key", "status": "running", "status_code": 1, "storage_name": "Sample_storage_name", "tags": ["Tags"], "tshirt_size": "small", "type": "milvus", "vector": 1, "vector_dimension": 384, "version": "3.5"}`) })) }) - It(`Invoke ScaleSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetMilvusService successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -25728,51 +27085,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ScaleSparkEngine(nil) + result, response, operationErr := watsonxDataService.GetMilvusService(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ScaleSparkEngineOptions model - scaleSparkEngineOptionsModel := new(watsonxdatav2.ScaleSparkEngineOptions) - scaleSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - scaleSparkEngineOptionsModel.NumberOfNodes = core.Int64Ptr(int64(2)) - scaleSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scaleSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetMilvusServiceOptions model + getMilvusServiceOptionsModel := new(watsonxdatav3.GetMilvusServiceOptions) + getMilvusServiceOptionsModel.ID = core.StringPtr("testString") + getMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + getMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) + result, response, operationErr = watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ScaleSparkEngine with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetMilvusService with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ScaleSparkEngineOptions model - scaleSparkEngineOptionsModel := new(watsonxdatav2.ScaleSparkEngineOptions) - scaleSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - scaleSparkEngineOptionsModel.NumberOfNodes = core.Int64Ptr(int64(2)) - scaleSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scaleSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetMilvusServiceOptions model + getMilvusServiceOptionsModel := new(watsonxdatav3.GetMilvusServiceOptions) + getMilvusServiceOptionsModel.ID = core.StringPtr("testString") + getMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + getMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ScaleSparkEngineOptions model with no property values - scaleSparkEngineOptionsModelNew := new(watsonxdatav2.ScaleSparkEngineOptions) + // Construct a second instance of the GetMilvusServiceOptions model with no property values + getMilvusServiceOptionsModelNew := new(watsonxdatav3.GetMilvusServiceOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModelNew) + result, response, operationErr = watsonxDataService.GetMilvusService(getMilvusServiceOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -25787,26 +27142,25 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke ScaleSparkEngine successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetMilvusService successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ScaleSparkEngineOptions model - scaleSparkEngineOptionsModel := new(watsonxdatav2.ScaleSparkEngineOptions) - scaleSparkEngineOptionsModel.EngineID = core.StringPtr("testString") - scaleSparkEngineOptionsModel.NumberOfNodes = core.Int64Ptr(int64(2)) - scaleSparkEngineOptionsModel.AuthInstanceID = core.StringPtr("testString") - scaleSparkEngineOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetMilvusServiceOptions model + getMilvusServiceOptionsModel := new(watsonxdatav3.GetMilvusServiceOptions) + getMilvusServiceOptionsModel.ID = core.StringPtr("testString") + getMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + getMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ScaleSparkEngine(scaleSparkEngineOptionsModel) + result, response, operationErr := watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -25818,63 +27172,161 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListSparkVersions(listSparkVersionsOptions *ListSparkVersionsOptions) - Operation response error`, func() { - listSparkVersionsPath := "/spark_versions" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`DeleteMilvusService(deleteMilvusServiceOptions *DeleteMilvusServiceOptions)`, func() { + deleteMilvusServicePath := "/v3/milvus_services/testString" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkVersionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteMilvusServicePath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(204) })) }) - It(`Invoke ListSparkVersions with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteMilvusService successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkVersionsOptions model - listSparkVersionsOptionsModel := new(watsonxdatav2.ListSparkVersionsOptions) - listSparkVersionsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkVersionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListSparkVersions(listSparkVersionsOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteMilvusService(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteMilvusServiceOptions model + deleteMilvusServiceOptionsModel := new(watsonxdatav3.DeleteMilvusServiceOptions) + deleteMilvusServiceOptionsModel.ID = core.StringPtr("testString") + deleteMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteMilvusService(deleteMilvusServiceOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + }) + It(`Invoke DeleteMilvusService with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) - // Enable retries and test again - watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListSparkVersions(listSparkVersionsOptionsModel) + // Construct an instance of the DeleteMilvusServiceOptions model + deleteMilvusServiceOptionsModel := new(watsonxdatav3.DeleteMilvusServiceOptions) + deleteMilvusServiceOptionsModel.ID = core.StringPtr("testString") + deleteMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteMilvusService(deleteMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteMilvusServiceOptions model with no property values + deleteMilvusServiceOptionsModelNew := new(watsonxdatav3.DeleteMilvusServiceOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteMilvusService(deleteMilvusServiceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`ListSparkVersions(listSparkVersionsOptions *ListSparkVersionsOptions)`, func() { - listSparkVersionsPath := "/spark_versions" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { + Describe(`UpdateMilvusService(updateMilvusServiceOptions *UpdateMilvusServiceOptions) - Operation response error`, func() { + updateMilvusServicePath := "/v3/milvus_services/testString" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkVersionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServicePath)) + Expect(req.Method).To(Equal("PATCH")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke UpdateMilvusService with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the MilvusServicePatch model + milvusServicePatchModel := new(watsonxdatav3.MilvusServicePatch) + milvusServicePatchModel.Description = core.StringPtr("updated description for milvus service") + milvusServicePatchModel.DisplayName = core.StringPtr("sampleService") + milvusServicePatchModel.Tags = []string{"tag1", "tag2"} + milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateMilvusServiceOptions model + updateMilvusServiceOptionsModel := new(watsonxdatav3.UpdateMilvusServiceOptions) + updateMilvusServiceOptionsModel.ID = core.StringPtr("testString") + updateMilvusServiceOptionsModel.Body = milvusServicePatchModelAsPatch + updateMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + watsonxDataService.EnableRetries(0, 0) + result, response, operationErr = watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateMilvusService(updateMilvusServiceOptions *UpdateMilvusServiceOptions)`, func() { + updateMilvusServicePath := "/v3/milvus_services/testString" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServicePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -25884,11 +27336,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "spark_versions": [{"display_name": "Instance Name"}]}`) + fmt.Fprintf(res, "%s", `{"access_key": "Sample storage access key", "actions": ["Actions"], "created_at": 1, "created_by": "@.com", "dc_cpu": 0.01, "dc_memory": 0.01, "dc_replicas": 1, "description": "milvus service for running sql queries", "display_name": "sampleService", "dw_cpu": 0.01, "dw_memory": 0.01, "dw_replicas": 1, "endpoint": "Endpoint", "etcd_cpu": 0.01, "etcd_memory": 0.01, "failure_message": "Failed to start engine", "grpc_host": "example.grpc.host", "grpc_port": 1, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 1, "id": "milvus123", "index_type": "hnsw", "iw_cpu": 0.01, "iw_memory": 0.01, "iw_replicas": 1, "kafka_cpu": 0.01, "kafka_memory": 0.01, "managed_by": "customer", "origin": "native", "proxy_cpu": 0.01, "proxy_host": "example.proxy.host", "proxy_memory": 0.01, "proxy_port": 1, "proxy_replicas": 1, "qc_cpu": 0.01, "qc_memory": 0.01, "qc_replicas": 1, "qw_cpu": 0.01, "qw_memory": 0.01, "qw_replicas": 1, "rc_cpu": 0.01, "rc_memory": 0.01, "rc_replicas": 1, "root_path": "Sample/path", "secret_key": "Sample storage secret access key", "status": "running", "status_code": 1, "storage_name": "Sample_storage_name", "tags": ["Tags"], "tshirt_size": "small", "type": "milvus", "vector": 1, "vector_dimension": 384, "version": "3.5"}`) })) }) - It(`Invoke ListSparkVersions successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateMilvusService successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -25896,21 +27348,31 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListSparkVersionsOptions model - listSparkVersionsOptionsModel := new(watsonxdatav2.ListSparkVersionsOptions) - listSparkVersionsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkVersionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the MilvusServicePatch model + milvusServicePatchModel := new(watsonxdatav3.MilvusServicePatch) + milvusServicePatchModel.Description = core.StringPtr("updated description for milvus service") + milvusServicePatchModel.DisplayName = core.StringPtr("sampleService") + milvusServicePatchModel.Tags = []string{"tag1", "tag2"} + milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateMilvusServiceOptions model + updateMilvusServiceOptionsModel := new(watsonxdatav3.UpdateMilvusServiceOptions) + updateMilvusServiceOptionsModel.ID = core.StringPtr("testString") + updateMilvusServiceOptionsModel.Body = milvusServicePatchModelAsPatch + updateMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListSparkVersionsWithContext(ctx, listSparkVersionsOptionsModel) + _, _, operationErr := watsonxDataService.UpdateMilvusServiceWithContext(ctx, updateMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListSparkVersions(listSparkVersionsOptionsModel) + result, response, operationErr := watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -25918,7 +27380,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListSparkVersionsWithContext(ctx, listSparkVersionsOptionsModel) + _, _, operationErr = watsonxDataService.UpdateMilvusServiceWithContext(ctx, updateMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -25932,19 +27394,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSparkVersionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServicePath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "spark_versions": [{"display_name": "Instance Name"}]}`) + fmt.Fprintf(res, "%s", `{"access_key": "Sample storage access key", "actions": ["Actions"], "created_at": 1, "created_by": "@.com", "dc_cpu": 0.01, "dc_memory": 0.01, "dc_replicas": 1, "description": "milvus service for running sql queries", "display_name": "sampleService", "dw_cpu": 0.01, "dw_memory": 0.01, "dw_replicas": 1, "endpoint": "Endpoint", "etcd_cpu": 0.01, "etcd_memory": 0.01, "failure_message": "Failed to start engine", "grpc_host": "example.grpc.host", "grpc_port": 1, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 1, "id": "milvus123", "index_type": "hnsw", "iw_cpu": 0.01, "iw_memory": 0.01, "iw_replicas": 1, "kafka_cpu": 0.01, "kafka_memory": 0.01, "managed_by": "customer", "origin": "native", "proxy_cpu": 0.01, "proxy_host": "example.proxy.host", "proxy_memory": 0.01, "proxy_port": 1, "proxy_replicas": 1, "qc_cpu": 0.01, "qc_memory": 0.01, "qc_replicas": 1, "qw_cpu": 0.01, "qw_memory": 0.01, "qw_replicas": 1, "rc_cpu": 0.01, "rc_memory": 0.01, "rc_replicas": 1, "root_path": "Sample/path", "secret_key": "Sample storage secret access key", "status": "running", "status_code": 1, "storage_name": "Sample_storage_name", "tags": ["Tags"], "tshirt_size": "small", "type": "milvus", "vector": 1, "vector_dimension": 384, "version": "3.5"}`) })) }) - It(`Invoke ListSparkVersions successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateMilvusService successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -25952,43 +27430,70 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListSparkVersions(nil) + result, response, operationErr := watsonxDataService.UpdateMilvusService(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSparkVersionsOptions model - listSparkVersionsOptionsModel := new(watsonxdatav2.ListSparkVersionsOptions) - listSparkVersionsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkVersionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the MilvusServicePatch model + milvusServicePatchModel := new(watsonxdatav3.MilvusServicePatch) + milvusServicePatchModel.Description = core.StringPtr("updated description for milvus service") + milvusServicePatchModel.DisplayName = core.StringPtr("sampleService") + milvusServicePatchModel.Tags = []string{"tag1", "tag2"} + milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateMilvusServiceOptions model + updateMilvusServiceOptionsModel := new(watsonxdatav3.UpdateMilvusServiceOptions) + updateMilvusServiceOptionsModel.ID = core.StringPtr("testString") + updateMilvusServiceOptionsModel.Body = milvusServicePatchModelAsPatch + updateMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListSparkVersions(listSparkVersionsOptionsModel) + result, response, operationErr = watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListSparkVersions with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateMilvusService with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkVersionsOptions model - listSparkVersionsOptionsModel := new(watsonxdatav2.ListSparkVersionsOptions) - listSparkVersionsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkVersionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the MilvusServicePatch model + milvusServicePatchModel := new(watsonxdatav3.MilvusServicePatch) + milvusServicePatchModel.Description = core.StringPtr("updated description for milvus service") + milvusServicePatchModel.DisplayName = core.StringPtr("sampleService") + milvusServicePatchModel.Tags = []string{"tag1", "tag2"} + milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateMilvusServiceOptions model + updateMilvusServiceOptionsModel := new(watsonxdatav3.UpdateMilvusServiceOptions) + updateMilvusServiceOptionsModel.ID = core.StringPtr("testString") + updateMilvusServiceOptionsModel.Body = milvusServicePatchModelAsPatch + updateMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListSparkVersions(listSparkVersionsOptionsModel) + result, response, operationErr := watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the UpdateMilvusServiceOptions model with no property values + updateMilvusServiceOptionsModelNew := new(watsonxdatav3.UpdateMilvusServiceOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -26003,21 +27508,31 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListSparkVersions successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateMilvusService successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSparkVersionsOptions model - listSparkVersionsOptionsModel := new(watsonxdatav2.ListSparkVersionsOptions) - listSparkVersionsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSparkVersionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the MilvusServicePatch model + milvusServicePatchModel := new(watsonxdatav3.MilvusServicePatch) + milvusServicePatchModel.Description = core.StringPtr("updated description for milvus service") + milvusServicePatchModel.DisplayName = core.StringPtr("sampleService") + milvusServicePatchModel.Tags = []string{"tag1", "tag2"} + milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() + Expect(asPatchErr).To(BeNil()) + + // Construct an instance of the UpdateMilvusServiceOptions model + updateMilvusServiceOptionsModel := new(watsonxdatav3.UpdateMilvusServiceOptions) + updateMilvusServiceOptionsModel.ID = core.StringPtr("testString") + updateMilvusServiceOptionsModel.Body = milvusServicePatchModelAsPatch + updateMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListSparkVersions(listSparkVersionsOptionsModel) + result, response, operationErr := watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26029,44 +27544,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListCatalogs(listCatalogsOptions *ListCatalogsOptions) - Operation response error`, func() { - listCatalogsPath := "/catalogs" + Describe(`CreateMilvusServicePause(createMilvusServicePauseOptions *CreateMilvusServicePauseOptions) - Operation response error`, func() { + createMilvusServicePausePath := "/v3/milvus_services/testString/pause" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listCatalogsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePausePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListCatalogs with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServicePause with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListCatalogsOptions model - listCatalogsOptionsModel := new(watsonxdatav2.ListCatalogsOptions) - listCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServicePauseOptions model + createMilvusServicePauseOptionsModel := new(watsonxdatav3.CreateMilvusServicePauseOptions) + createMilvusServicePauseOptionsModel.ID = core.StringPtr("testString") + createMilvusServicePauseOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServicePauseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListCatalogs(listCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListCatalogs(listCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26076,16 +27592,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListCatalogs(listCatalogsOptions *ListCatalogsOptions)`, func() { - listCatalogsPath := "/catalogs" + Describe(`CreateMilvusServicePause(createMilvusServicePauseOptions *CreateMilvusServicePauseOptions)`, func() { + createMilvusServicePausePath := "/v3/milvus_services/testString/pause" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listCatalogsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePausePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -26094,12 +27610,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke ListCatalogs successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServicePause successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -26107,21 +27623,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListCatalogsOptions model - listCatalogsOptionsModel := new(watsonxdatav2.ListCatalogsOptions) - listCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServicePauseOptions model + createMilvusServicePauseOptionsModel := new(watsonxdatav3.CreateMilvusServicePauseOptions) + createMilvusServicePauseOptionsModel.ID = core.StringPtr("testString") + createMilvusServicePauseOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServicePauseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListCatalogsWithContext(ctx, listCatalogsOptionsModel) + _, _, operationErr := watsonxDataService.CreateMilvusServicePauseWithContext(ctx, createMilvusServicePauseOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListCatalogs(listCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26129,7 +27646,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListCatalogsWithContext(ctx, listCatalogsOptionsModel) + _, _, operationErr = watsonxDataService.CreateMilvusServicePauseWithContext(ctx, createMilvusServicePauseOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -26143,19 +27660,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listCatalogsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePausePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"catalogs": [{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke ListCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServicePause successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -26163,43 +27680,52 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListCatalogs(nil) + result, response, operationErr := watsonxDataService.CreateMilvusServicePause(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListCatalogsOptions model - listCatalogsOptionsModel := new(watsonxdatav2.ListCatalogsOptions) - listCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServicePauseOptions model + createMilvusServicePauseOptionsModel := new(watsonxdatav3.CreateMilvusServicePauseOptions) + createMilvusServicePauseOptionsModel.ID = core.StringPtr("testString") + createMilvusServicePauseOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServicePauseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListCatalogs(listCatalogsOptionsModel) + result, response, operationErr = watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListCatalogs with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServicePause with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListCatalogsOptions model - listCatalogsOptionsModel := new(watsonxdatav2.ListCatalogsOptions) - listCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServicePauseOptions model + createMilvusServicePauseOptionsModel := new(watsonxdatav3.CreateMilvusServicePauseOptions) + createMilvusServicePauseOptionsModel.ID = core.StringPtr("testString") + createMilvusServicePauseOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServicePauseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListCatalogs(listCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the CreateMilvusServicePauseOptions model with no property values + createMilvusServicePauseOptionsModelNew := new(watsonxdatav3.CreateMilvusServicePauseOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -26211,24 +27737,25 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListCatalogs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServicePause successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListCatalogsOptions model - listCatalogsOptionsModel := new(watsonxdatav2.ListCatalogsOptions) - listCatalogsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listCatalogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServicePauseOptions model + createMilvusServicePauseOptionsModel := new(watsonxdatav3.CreateMilvusServicePauseOptions) + createMilvusServicePauseOptionsModel.ID = core.StringPtr("testString") + createMilvusServicePauseOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServicePauseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListCatalogs(listCatalogsOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26240,45 +27767,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetCatalog(getCatalogOptions *GetCatalogOptions) - Operation response error`, func() { - getCatalogPath := "/catalogs/testString" + Describe(`CreateMilvusServiceResume(createMilvusServiceResumeOptions *CreateMilvusServiceResumeOptions) - Operation response error`, func() { + createMilvusServiceResumePath := "/v3/milvus_services/testString/resume" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceResumePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetCatalog with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServiceResume with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetCatalogOptions model - getCatalogOptionsModel := new(watsonxdatav2.GetCatalogOptions) - getCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceResumeOptions model + createMilvusServiceResumeOptionsModel := new(watsonxdatav3.CreateMilvusServiceResumeOptions) + createMilvusServiceResumeOptionsModel.ID = core.StringPtr("testString") + createMilvusServiceResumeOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceResumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetCatalog(getCatalogOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetCatalog(getCatalogOptionsModel) + result, response, operationErr = watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26288,16 +27815,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetCatalog(getCatalogOptions *GetCatalogOptions)`, func() { - getCatalogPath := "/catalogs/testString" + Describe(`CreateMilvusServiceResume(createMilvusServiceResumeOptions *CreateMilvusServiceResumeOptions)`, func() { + createMilvusServiceResumePath := "/v3/milvus_services/testString/resume" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceResumePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -26306,12 +27833,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke GetCatalog successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServiceResume successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -26319,22 +27846,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetCatalogOptions model - getCatalogOptionsModel := new(watsonxdatav2.GetCatalogOptions) - getCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceResumeOptions model + createMilvusServiceResumeOptionsModel := new(watsonxdatav3.CreateMilvusServiceResumeOptions) + createMilvusServiceResumeOptionsModel.ID = core.StringPtr("testString") + createMilvusServiceResumeOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceResumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetCatalogWithContext(ctx, getCatalogOptionsModel) + _, _, operationErr := watsonxDataService.CreateMilvusServiceResumeWithContext(ctx, createMilvusServiceResumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetCatalog(getCatalogOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26342,7 +27869,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetCatalogWithContext(ctx, getCatalogOptionsModel) + _, _, operationErr = watsonxDataService.CreateMilvusServiceResumeWithContext(ctx, createMilvusServiceResumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -26356,19 +27883,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getCatalogPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceResumePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"actions": ["Actions"], "associated_buckets": ["AssociatedBuckets"], "associated_databases": ["AssociatedDatabases"], "associated_engines": ["AssociatedEngines"], "catalog_name": "sampleCatalog", "catalog_type": "iceberg", "created_by": "@.com", "created_on": "1602839833", "description": "Iceberg catalog description", "hostname": "s3a://samplehost.com", "last_sync_at": "1602839833", "managed_by": "ibm", "metastore": "glue", "port": "3232", "status": "running", "sync_description": "Table registration was successful", "sync_exception": ["SyncException"], "sync_status": "SUCCESS", "tags": ["Tags"], "thrift_uri": "thrift://samplehost-catalog:4354"}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke GetCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServiceResume successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -26376,49 +27903,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetCatalog(nil) + result, response, operationErr := watsonxDataService.CreateMilvusServiceResume(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetCatalogOptions model - getCatalogOptionsModel := new(watsonxdatav2.GetCatalogOptions) - getCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceResumeOptions model + createMilvusServiceResumeOptionsModel := new(watsonxdatav3.CreateMilvusServiceResumeOptions) + createMilvusServiceResumeOptionsModel.ID = core.StringPtr("testString") + createMilvusServiceResumeOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceResumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetCatalog(getCatalogOptionsModel) + result, response, operationErr = watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetCatalog with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServiceResume with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetCatalogOptions model - getCatalogOptionsModel := new(watsonxdatav2.GetCatalogOptions) - getCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceResumeOptions model + createMilvusServiceResumeOptionsModel := new(watsonxdatav3.CreateMilvusServiceResumeOptions) + createMilvusServiceResumeOptionsModel.ID = core.StringPtr("testString") + createMilvusServiceResumeOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceResumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetCatalog(getCatalogOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetCatalogOptions model with no property values - getCatalogOptionsModelNew := new(watsonxdatav2.GetCatalogOptions) + // Construct a second instance of the CreateMilvusServiceResumeOptions model with no property values + createMilvusServiceResumeOptionsModelNew := new(watsonxdatav3.CreateMilvusServiceResumeOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetCatalog(getCatalogOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -26433,25 +27960,25 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServiceResume successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetCatalogOptions model - getCatalogOptionsModel := new(watsonxdatav2.GetCatalogOptions) - getCatalogOptionsModel.CatalogID = core.StringPtr("testString") - getCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - getCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceResumeOptions model + createMilvusServiceResumeOptionsModel := new(watsonxdatav3.CreateMilvusServiceResumeOptions) + createMilvusServiceResumeOptionsModel.ID = core.StringPtr("testString") + createMilvusServiceResumeOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceResumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetCatalog(getCatalogOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26463,47 +27990,74 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListSchemas(listSchemasOptions *ListSchemasOptions) - Operation response error`, func() { - listSchemasPath := "/catalogs/testString/schemas" + Describe(`CreateMilvusServiceScale(createMilvusServiceScaleOptions *CreateMilvusServiceScaleOptions) - Operation response error`, func() { + createMilvusServiceScalePath := "/v3/milvus_services/testString/scale" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSchemasPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceScalePath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListSchemas with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServiceScale with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSchemasOptions model - listSchemasOptionsModel := new(watsonxdatav2.ListSchemasOptions) - listSchemasOptionsModel.EngineID = core.StringPtr("testString") - listSchemasOptionsModel.CatalogID = core.StringPtr("testString") - listSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceScaleOptions model + createMilvusServiceScaleOptionsModel := new(watsonxdatav3.CreateMilvusServiceScaleOptions) + createMilvusServiceScaleOptionsModel.ID = core.StringPtr("testString") + createMilvusServiceScaleOptionsModel.TshirtSize = core.StringPtr("small") + createMilvusServiceScaleOptionsModel.DcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.DwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.EtcdCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.EtcdMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IndexType = core.StringPtr("flat") + createMilvusServiceScaleOptionsModel.IwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.KafkaCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.KafkaMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.QcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.QwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.RcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.RcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.RcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.Vector = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.VectorDimension = core.Int64Ptr(int64(384)) + createMilvusServiceScaleOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceScaleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListSchemas(listSchemasOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListSchemas(listSchemasOptionsModel) + result, response, operationErr = watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26513,31 +28067,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListSchemas(listSchemasOptions *ListSchemasOptions)`, func() { - listSchemasPath := "/catalogs/testString/schemas" + Describe(`CreateMilvusServiceScale(createMilvusServiceScaleOptions *CreateMilvusServiceScaleOptions)`, func() { + createMilvusServiceScalePath := "/v3/milvus_services/testString/scale" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSchemasPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceScalePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "schemas": ["Schemas"]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke ListSchemas successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServiceScale successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -26545,23 +28114,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListSchemasOptions model - listSchemasOptionsModel := new(watsonxdatav2.ListSchemasOptions) - listSchemasOptionsModel.EngineID = core.StringPtr("testString") - listSchemasOptionsModel.CatalogID = core.StringPtr("testString") - listSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceScaleOptions model + createMilvusServiceScaleOptionsModel := new(watsonxdatav3.CreateMilvusServiceScaleOptions) + createMilvusServiceScaleOptionsModel.ID = core.StringPtr("testString") + createMilvusServiceScaleOptionsModel.TshirtSize = core.StringPtr("small") + createMilvusServiceScaleOptionsModel.DcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.DwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.EtcdCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.EtcdMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IndexType = core.StringPtr("flat") + createMilvusServiceScaleOptionsModel.IwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.KafkaCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.KafkaMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.QcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.QwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.RcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.RcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.RcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.Vector = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.VectorDimension = core.Int64Ptr(int64(384)) + createMilvusServiceScaleOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceScaleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListSchemasWithContext(ctx, listSchemasOptionsModel) + _, _, operationErr := watsonxDataService.CreateMilvusServiceScaleWithContext(ctx, createMilvusServiceScaleOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListSchemas(listSchemasOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26569,7 +28166,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListSchemasWithContext(ctx, listSchemasOptionsModel) + _, _, operationErr = watsonxDataService.CreateMilvusServiceScaleWithContext(ctx, createMilvusServiceScaleOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -26583,20 +28180,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listSchemasPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceScalePath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}, "schemas": ["Schemas"]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) })) }) - It(`Invoke ListSchemas successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServiceScale successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -26604,51 +28216,107 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListSchemas(nil) + result, response, operationErr := watsonxDataService.CreateMilvusServiceScale(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListSchemasOptions model - listSchemasOptionsModel := new(watsonxdatav2.ListSchemasOptions) - listSchemasOptionsModel.EngineID = core.StringPtr("testString") - listSchemasOptionsModel.CatalogID = core.StringPtr("testString") - listSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceScaleOptions model + createMilvusServiceScaleOptionsModel := new(watsonxdatav3.CreateMilvusServiceScaleOptions) + createMilvusServiceScaleOptionsModel.ID = core.StringPtr("testString") + createMilvusServiceScaleOptionsModel.TshirtSize = core.StringPtr("small") + createMilvusServiceScaleOptionsModel.DcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.DwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.EtcdCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.EtcdMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IndexType = core.StringPtr("flat") + createMilvusServiceScaleOptionsModel.IwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.KafkaCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.KafkaMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.QcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.QwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.RcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.RcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.RcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.Vector = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.VectorDimension = core.Int64Ptr(int64(384)) + createMilvusServiceScaleOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceScaleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListSchemas(listSchemasOptionsModel) + result, response, operationErr = watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListSchemas with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServiceScale with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSchemasOptions model - listSchemasOptionsModel := new(watsonxdatav2.ListSchemasOptions) - listSchemasOptionsModel.EngineID = core.StringPtr("testString") - listSchemasOptionsModel.CatalogID = core.StringPtr("testString") - listSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceScaleOptions model + createMilvusServiceScaleOptionsModel := new(watsonxdatav3.CreateMilvusServiceScaleOptions) + createMilvusServiceScaleOptionsModel.ID = core.StringPtr("testString") + createMilvusServiceScaleOptionsModel.TshirtSize = core.StringPtr("small") + createMilvusServiceScaleOptionsModel.DcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.DwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.EtcdCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.EtcdMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IndexType = core.StringPtr("flat") + createMilvusServiceScaleOptionsModel.IwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.KafkaCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.KafkaMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.QcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.QwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.RcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.RcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.RcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.Vector = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.VectorDimension = core.Int64Ptr(int64(384)) + createMilvusServiceScaleOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceScaleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListSchemas(listSchemasOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListSchemasOptions model with no property values - listSchemasOptionsModelNew := new(watsonxdatav2.ListSchemasOptions) + // Construct a second instance of the CreateMilvusServiceScaleOptions model with no property values + createMilvusServiceScaleOptionsModelNew := new(watsonxdatav3.CreateMilvusServiceScaleOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListSchemas(listSchemasOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -26663,26 +28331,54 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListSchemas successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateMilvusServiceScale successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListSchemasOptions model - listSchemasOptionsModel := new(watsonxdatav2.ListSchemasOptions) - listSchemasOptionsModel.EngineID = core.StringPtr("testString") - listSchemasOptionsModel.CatalogID = core.StringPtr("testString") - listSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") - listSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateMilvusServiceScaleOptions model + createMilvusServiceScaleOptionsModel := new(watsonxdatav3.CreateMilvusServiceScaleOptions) + createMilvusServiceScaleOptionsModel.ID = core.StringPtr("testString") + createMilvusServiceScaleOptionsModel.TshirtSize = core.StringPtr("small") + createMilvusServiceScaleOptionsModel.DcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.DwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.DwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.EtcdCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.EtcdMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IndexType = core.StringPtr("flat") + createMilvusServiceScaleOptionsModel.IwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.IwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.KafkaCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.KafkaMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.ProxyReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.QcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.QwCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QwMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.QwReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.RcCpu = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.RcMemory = core.Float64Ptr(float64(0.01)) + createMilvusServiceScaleOptionsModel.RcReplicas = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.Vector = core.Int64Ptr(int64(1)) + createMilvusServiceScaleOptionsModel.VectorDimension = core.Int64Ptr(int64(384)) + createMilvusServiceScaleOptionsModel.AuthInstanceID = core.StringPtr("testString") + createMilvusServiceScaleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListSchemas(listSchemasOptionsModel) + result, response, operationErr := watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26694,52 +28390,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSchema(createSchemaOptions *CreateSchemaOptions) - Operation response error`, func() { - createSchemaPath := "/catalogs/testString/schemas" + Describe(`ListMilvusServiceDatabases(listMilvusServiceDatabasesOptions *ListMilvusServiceDatabasesOptions) - Operation response error`, func() { + listMilvusServiceDatabasesPath := "/v3/milvus_services/testString/databases" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSchemaPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusServiceDatabasesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateSchema with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusServiceDatabases with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSchemaOptions model - createSchemaOptionsModel := new(watsonxdatav2.CreateSchemaOptions) - createSchemaOptionsModel.EngineID = core.StringPtr("testString") - createSchemaOptionsModel.CatalogID = core.StringPtr("testString") - createSchemaOptionsModel.CustomPath = core.StringPtr("sample-path") - createSchemaOptionsModel.SchemaName = core.StringPtr("SampleSchema1") - createSchemaOptionsModel.BucketName = core.StringPtr("sample-bucket") - createSchemaOptionsModel.Hostname = core.StringPtr("db2@hostname.com") - createSchemaOptionsModel.Port = core.Int64Ptr(int64(4553)) - createSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusServiceDatabasesOptions model + listMilvusServiceDatabasesOptionsModel := new(watsonxdatav3.ListMilvusServiceDatabasesOptions) + listMilvusServiceDatabasesOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusServiceDatabasesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusServiceDatabasesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateSchema(createSchemaOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateSchema(createSchemaOptionsModel) + result, response, operationErr = watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -26749,47 +28438,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateSchema(createSchemaOptions *CreateSchemaOptions)`, func() { - createSchemaPath := "/catalogs/testString/schemas" + Describe(`ListMilvusServiceDatabases(listMilvusServiceDatabasesOptions *ListMilvusServiceDatabasesOptions)`, func() { + listMilvusServiceDatabasesPath := "/v3/milvus_services/testString/databases" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSchemaPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusServiceDatabasesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"databases": [{"id": "ID"}]}`) })) }) - It(`Invoke CreateSchema successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusServiceDatabases successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -26797,28 +28469,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateSchemaOptions model - createSchemaOptionsModel := new(watsonxdatav2.CreateSchemaOptions) - createSchemaOptionsModel.EngineID = core.StringPtr("testString") - createSchemaOptionsModel.CatalogID = core.StringPtr("testString") - createSchemaOptionsModel.CustomPath = core.StringPtr("sample-path") - createSchemaOptionsModel.SchemaName = core.StringPtr("SampleSchema1") - createSchemaOptionsModel.BucketName = core.StringPtr("sample-bucket") - createSchemaOptionsModel.Hostname = core.StringPtr("db2@hostname.com") - createSchemaOptionsModel.Port = core.Int64Ptr(int64(4553)) - createSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusServiceDatabasesOptions model + listMilvusServiceDatabasesOptionsModel := new(watsonxdatav3.ListMilvusServiceDatabasesOptions) + listMilvusServiceDatabasesOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusServiceDatabasesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusServiceDatabasesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateSchemaWithContext(ctx, createSchemaOptionsModel) + _, _, operationErr := watsonxDataService.ListMilvusServiceDatabasesWithContext(ctx, listMilvusServiceDatabasesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateSchema(createSchemaOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -26826,7 +28492,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateSchemaWithContext(ctx, createSchemaOptionsModel) + _, _, operationErr = watsonxDataService.ListMilvusServiceDatabasesWithContext(ctx, listMilvusServiceDatabasesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -26840,36 +28506,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createSchemaPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusServiceDatabasesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"databases": [{"id": "ID"}]}`) })) }) - It(`Invoke CreateSchema successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusServiceDatabases successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -26877,61 +28526,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateSchema(nil) + result, response, operationErr := watsonxDataService.ListMilvusServiceDatabases(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateSchemaOptions model - createSchemaOptionsModel := new(watsonxdatav2.CreateSchemaOptions) - createSchemaOptionsModel.EngineID = core.StringPtr("testString") - createSchemaOptionsModel.CatalogID = core.StringPtr("testString") - createSchemaOptionsModel.CustomPath = core.StringPtr("sample-path") - createSchemaOptionsModel.SchemaName = core.StringPtr("SampleSchema1") - createSchemaOptionsModel.BucketName = core.StringPtr("sample-bucket") - createSchemaOptionsModel.Hostname = core.StringPtr("db2@hostname.com") - createSchemaOptionsModel.Port = core.Int64Ptr(int64(4553)) - createSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusServiceDatabasesOptions model + listMilvusServiceDatabasesOptionsModel := new(watsonxdatav3.ListMilvusServiceDatabasesOptions) + listMilvusServiceDatabasesOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusServiceDatabasesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusServiceDatabasesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateSchema(createSchemaOptionsModel) + result, response, operationErr = watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateSchema with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusServiceDatabases with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSchemaOptions model - createSchemaOptionsModel := new(watsonxdatav2.CreateSchemaOptions) - createSchemaOptionsModel.EngineID = core.StringPtr("testString") - createSchemaOptionsModel.CatalogID = core.StringPtr("testString") - createSchemaOptionsModel.CustomPath = core.StringPtr("sample-path") - createSchemaOptionsModel.SchemaName = core.StringPtr("SampleSchema1") - createSchemaOptionsModel.BucketName = core.StringPtr("sample-bucket") - createSchemaOptionsModel.Hostname = core.StringPtr("db2@hostname.com") - createSchemaOptionsModel.Port = core.Int64Ptr(int64(4553)) - createSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusServiceDatabasesOptions model + listMilvusServiceDatabasesOptionsModel := new(watsonxdatav3.ListMilvusServiceDatabasesOptions) + listMilvusServiceDatabasesOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusServiceDatabasesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusServiceDatabasesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateSchema(createSchemaOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateSchemaOptions model with no property values - createSchemaOptionsModelNew := new(watsonxdatav2.CreateSchemaOptions) + // Construct a second instance of the ListMilvusServiceDatabasesOptions model with no property values + listMilvusServiceDatabasesOptionsModelNew := new(watsonxdatav3.ListMilvusServiceDatabasesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateSchema(createSchemaOptionsModelNew) + result, response, operationErr = watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -26946,31 +28583,25 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateSchema successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusServiceDatabases successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateSchemaOptions model - createSchemaOptionsModel := new(watsonxdatav2.CreateSchemaOptions) - createSchemaOptionsModel.EngineID = core.StringPtr("testString") - createSchemaOptionsModel.CatalogID = core.StringPtr("testString") - createSchemaOptionsModel.CustomPath = core.StringPtr("sample-path") - createSchemaOptionsModel.SchemaName = core.StringPtr("SampleSchema1") - createSchemaOptionsModel.BucketName = core.StringPtr("sample-bucket") - createSchemaOptionsModel.Hostname = core.StringPtr("db2@hostname.com") - createSchemaOptionsModel.Port = core.Int64Ptr(int64(4553)) - createSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") - createSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusServiceDatabasesOptions model + listMilvusServiceDatabasesOptionsModel := new(watsonxdatav3.ListMilvusServiceDatabasesOptions) + listMilvusServiceDatabasesOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusServiceDatabasesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusServiceDatabasesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateSchema(createSchemaOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -26982,125 +28613,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteSchema(deleteSchemaOptions *DeleteSchemaOptions)`, func() { - deleteSchemaPath := "/catalogs/testString/schemas/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteSchemaPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteSchema successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteSchema(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteSchemaOptions model - deleteSchemaOptionsModel := new(watsonxdatav2.DeleteSchemaOptions) - deleteSchemaOptionsModel.EngineID = core.StringPtr("testString") - deleteSchemaOptionsModel.CatalogID = core.StringPtr("testString") - deleteSchemaOptionsModel.SchemaID = core.StringPtr("testString") - deleteSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteSchema(deleteSchemaOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteSchema with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeleteSchemaOptions model - deleteSchemaOptionsModel := new(watsonxdatav2.DeleteSchemaOptions) - deleteSchemaOptionsModel.EngineID = core.StringPtr("testString") - deleteSchemaOptionsModel.CatalogID = core.StringPtr("testString") - deleteSchemaOptionsModel.SchemaID = core.StringPtr("testString") - deleteSchemaOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteSchemaOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteSchema(deleteSchemaOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteSchemaOptions model with no property values - deleteSchemaOptionsModelNew := new(watsonxdatav2.DeleteSchemaOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteSchema(deleteSchemaOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListTables(listTablesOptions *ListTablesOptions) - Operation response error`, func() { - listTablesPath := "/catalogs/testString/schemas/testString/tables" + Describe(`ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptions *ListMilvusDatabaseCollectionsOptions) - Operation response error`, func() { + listMilvusDatabaseCollectionsPath := "/v3/milvus_services/testString/databases/testString/collections" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listTablesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusDatabaseCollectionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListTables with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusDatabaseCollections with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListTablesOptions model - listTablesOptionsModel := new(watsonxdatav2.ListTablesOptions) - listTablesOptionsModel.CatalogID = core.StringPtr("testString") - listTablesOptionsModel.SchemaID = core.StringPtr("testString") - listTablesOptionsModel.EngineID = core.StringPtr("testString") - listTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusDatabaseCollectionsOptions model + listMilvusDatabaseCollectionsOptionsModel := new(watsonxdatav3.ListMilvusDatabaseCollectionsOptions) + listMilvusDatabaseCollectionsOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.DatabaseID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListTables(listTablesOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListTables(listTablesOptionsModel) + result, response, operationErr = watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -27110,31 +28662,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListTables(listTablesOptions *ListTablesOptions)`, func() { - listTablesPath := "/catalogs/testString/schemas/testString/tables" + Describe(`ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptions *ListMilvusDatabaseCollectionsOptions)`, func() { + listMilvusDatabaseCollectionsPath := "/v3/milvus_services/testString/databases/testString/collections" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listTablesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusDatabaseCollectionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"tables": ["Tables"]}`) + fmt.Fprintf(res, "%s", `{"collections": [{"id": 1, "name": "col1", "physical_channels": ["PhysicalChannels"], "virtual_channels": ["VirtualChannels"]}]}`) })) }) - It(`Invoke ListTables successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusDatabaseCollections successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -27142,24 +28693,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListTablesOptions model - listTablesOptionsModel := new(watsonxdatav2.ListTablesOptions) - listTablesOptionsModel.CatalogID = core.StringPtr("testString") - listTablesOptionsModel.SchemaID = core.StringPtr("testString") - listTablesOptionsModel.EngineID = core.StringPtr("testString") - listTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusDatabaseCollectionsOptions model + listMilvusDatabaseCollectionsOptionsModel := new(watsonxdatav3.ListMilvusDatabaseCollectionsOptions) + listMilvusDatabaseCollectionsOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.DatabaseID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListTablesWithContext(ctx, listTablesOptionsModel) + _, _, operationErr := watsonxDataService.ListMilvusDatabaseCollectionsWithContext(ctx, listMilvusDatabaseCollectionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListTables(listTablesOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -27167,7 +28717,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListTablesWithContext(ctx, listTablesOptionsModel) + _, _, operationErr = watsonxDataService.ListMilvusDatabaseCollectionsWithContext(ctx, listMilvusDatabaseCollectionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -27181,20 +28731,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listTablesPath)) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusDatabaseCollectionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"tables": ["Tables"]}`) + fmt.Fprintf(res, "%s", `{"collections": [{"id": 1, "name": "col1", "physical_channels": ["PhysicalChannels"], "virtual_channels": ["VirtualChannels"]}]}`) })) }) - It(`Invoke ListTables successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusDatabaseCollections successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -27202,53 +28751,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListTables(nil) + result, response, operationErr := watsonxDataService.ListMilvusDatabaseCollections(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListTablesOptions model - listTablesOptionsModel := new(watsonxdatav2.ListTablesOptions) - listTablesOptionsModel.CatalogID = core.StringPtr("testString") - listTablesOptionsModel.SchemaID = core.StringPtr("testString") - listTablesOptionsModel.EngineID = core.StringPtr("testString") - listTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusDatabaseCollectionsOptions model + listMilvusDatabaseCollectionsOptionsModel := new(watsonxdatav3.ListMilvusDatabaseCollectionsOptions) + listMilvusDatabaseCollectionsOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.DatabaseID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListTables(listTablesOptionsModel) + result, response, operationErr = watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListTables with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusDatabaseCollections with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListTablesOptions model - listTablesOptionsModel := new(watsonxdatav2.ListTablesOptions) - listTablesOptionsModel.CatalogID = core.StringPtr("testString") - listTablesOptionsModel.SchemaID = core.StringPtr("testString") - listTablesOptionsModel.EngineID = core.StringPtr("testString") - listTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusDatabaseCollectionsOptions model + listMilvusDatabaseCollectionsOptionsModel := new(watsonxdatav3.ListMilvusDatabaseCollectionsOptions) + listMilvusDatabaseCollectionsOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.DatabaseID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListTables(listTablesOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListTablesOptions model with no property values - listTablesOptionsModelNew := new(watsonxdatav2.ListTablesOptions) + // Construct a second instance of the ListMilvusDatabaseCollectionsOptions model with no property values + listMilvusDatabaseCollectionsOptionsModelNew := new(watsonxdatav3.ListMilvusDatabaseCollectionsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListTables(listTablesOptionsModelNew) + result, response, operationErr = watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -27266,24 +28813,23 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListTables successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusDatabaseCollections successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListTablesOptions model - listTablesOptionsModel := new(watsonxdatav2.ListTablesOptions) - listTablesOptionsModel.CatalogID = core.StringPtr("testString") - listTablesOptionsModel.SchemaID = core.StringPtr("testString") - listTablesOptionsModel.EngineID = core.StringPtr("testString") - listTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusDatabaseCollectionsOptions model + listMilvusDatabaseCollectionsOptionsModel := new(watsonxdatav3.ListMilvusDatabaseCollectionsOptions) + listMilvusDatabaseCollectionsOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.DatabaseID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusDatabaseCollectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListTables(listTablesOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -27295,51 +28841,47 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetTable(getTableOptions *GetTableOptions) - Operation response error`, func() { - getTablePath := "/catalogs/testString/schemas/testString/tables/testString" + Describe(`ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptions *ListMilvusDatabasePartitionsOptions) - Operation response error`, func() { + listMilvusDatabasePartitionsPath := "/v3/milvus_services/testString/databases/testString/collections/testString/partitions" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getTablePath)) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusDatabasePartitionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetTable with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusDatabasePartitions with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetTableOptions model - getTableOptionsModel := new(watsonxdatav2.GetTableOptions) - getTableOptionsModel.CatalogID = core.StringPtr("testString") - getTableOptionsModel.SchemaID = core.StringPtr("testString") - getTableOptionsModel.TableID = core.StringPtr("testString") - getTableOptionsModel.EngineID = core.StringPtr("testString") - getTableOptionsModel.Type = core.StringPtr("testString") - getTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - getTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusDatabasePartitionsOptions model + listMilvusDatabasePartitionsOptionsModel := new(watsonxdatav3.ListMilvusDatabasePartitionsOptions) + listMilvusDatabasePartitionsOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.DatabaseID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.CollectionName = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetTable(getTableOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetTable(getTableOptionsModel) + result, response, operationErr = watsonxDataService.ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -27349,32 +28891,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetTable(getTableOptions *GetTableOptions)`, func() { - getTablePath := "/catalogs/testString/schemas/testString/tables/testString" + Describe(`ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptions *ListMilvusDatabasePartitionsOptions)`, func() { + listMilvusDatabasePartitionsPath := "/v3/milvus_services/testString/databases/testString/collections/testString/partitions" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getTablePath)) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusDatabasePartitionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"columns": [{"column_name": "expenses", "comment": "expenses column", "extra": "varchar", "length": "30", "scale": "2", "precision": "10", "type": "varchar"}], "table_name": "TableName"}`) + fmt.Fprintf(res, "%s", `{"partitions": [{"id": 1, "name": "partition1"}]}`) })) }) - It(`Invoke GetTable successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusDatabasePartitions successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -27382,26 +28922,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetTableOptions model - getTableOptionsModel := new(watsonxdatav2.GetTableOptions) - getTableOptionsModel.CatalogID = core.StringPtr("testString") - getTableOptionsModel.SchemaID = core.StringPtr("testString") - getTableOptionsModel.TableID = core.StringPtr("testString") - getTableOptionsModel.EngineID = core.StringPtr("testString") - getTableOptionsModel.Type = core.StringPtr("testString") - getTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - getTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusDatabasePartitionsOptions model + listMilvusDatabasePartitionsOptionsModel := new(watsonxdatav3.ListMilvusDatabasePartitionsOptions) + listMilvusDatabasePartitionsOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.DatabaseID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.CollectionName = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetTableWithContext(ctx, getTableOptionsModel) + _, _, operationErr := watsonxDataService.ListMilvusDatabasePartitionsWithContext(ctx, listMilvusDatabasePartitionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetTable(getTableOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -27409,7 +28947,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetTableWithContext(ctx, getTableOptionsModel) + _, _, operationErr = watsonxDataService.ListMilvusDatabasePartitionsWithContext(ctx, listMilvusDatabasePartitionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -27423,21 +28961,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getTablePath)) + Expect(req.URL.EscapedPath()).To(Equal(listMilvusDatabasePartitionsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"columns": [{"column_name": "expenses", "comment": "expenses column", "extra": "varchar", "length": "30", "scale": "2", "precision": "10", "type": "varchar"}], "table_name": "TableName"}`) + fmt.Fprintf(res, "%s", `{"partitions": [{"id": 1, "name": "partition1"}]}`) })) }) - It(`Invoke GetTable successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusDatabasePartitions successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -27445,57 +28981,53 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetTable(nil) + result, response, operationErr := watsonxDataService.ListMilvusDatabasePartitions(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetTableOptions model - getTableOptionsModel := new(watsonxdatav2.GetTableOptions) - getTableOptionsModel.CatalogID = core.StringPtr("testString") - getTableOptionsModel.SchemaID = core.StringPtr("testString") - getTableOptionsModel.TableID = core.StringPtr("testString") - getTableOptionsModel.EngineID = core.StringPtr("testString") - getTableOptionsModel.Type = core.StringPtr("testString") - getTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - getTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusDatabasePartitionsOptions model + listMilvusDatabasePartitionsOptionsModel := new(watsonxdatav3.ListMilvusDatabasePartitionsOptions) + listMilvusDatabasePartitionsOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.DatabaseID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.CollectionName = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetTable(getTableOptionsModel) + result, response, operationErr = watsonxDataService.ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetTable with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusDatabasePartitions with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetTableOptions model - getTableOptionsModel := new(watsonxdatav2.GetTableOptions) - getTableOptionsModel.CatalogID = core.StringPtr("testString") - getTableOptionsModel.SchemaID = core.StringPtr("testString") - getTableOptionsModel.TableID = core.StringPtr("testString") - getTableOptionsModel.EngineID = core.StringPtr("testString") - getTableOptionsModel.Type = core.StringPtr("testString") - getTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - getTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusDatabasePartitionsOptions model + listMilvusDatabasePartitionsOptionsModel := new(watsonxdatav3.ListMilvusDatabasePartitionsOptions) + listMilvusDatabasePartitionsOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.DatabaseID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.CollectionName = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetTable(getTableOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetTableOptions model with no property values - getTableOptionsModelNew := new(watsonxdatav2.GetTableOptions) + // Construct a second instance of the ListMilvusDatabasePartitionsOptions model with no property values + listMilvusDatabasePartitionsOptionsModelNew := new(watsonxdatav3.ListMilvusDatabasePartitionsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetTable(getTableOptionsModelNew) + result, response, operationErr = watsonxDataService.ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -27513,26 +29045,24 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetTable successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListMilvusDatabasePartitions successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetTableOptions model - getTableOptionsModel := new(watsonxdatav2.GetTableOptions) - getTableOptionsModel.CatalogID = core.StringPtr("testString") - getTableOptionsModel.SchemaID = core.StringPtr("testString") - getTableOptionsModel.TableID = core.StringPtr("testString") - getTableOptionsModel.EngineID = core.StringPtr("testString") - getTableOptionsModel.Type = core.StringPtr("testString") - getTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - getTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListMilvusDatabasePartitionsOptions model + listMilvusDatabasePartitionsOptionsModel := new(watsonxdatav3.ListMilvusDatabasePartitionsOptions) + listMilvusDatabasePartitionsOptionsModel.ServiceID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.DatabaseID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.CollectionName = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listMilvusDatabasePartitionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetTable(getTableOptionsModel) + result, response, operationErr := watsonxDataService.ListMilvusDatabasePartitions(listMilvusDatabasePartitionsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -27544,140 +29074,53 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteTable(deleteTableOptions *DeleteTableOptions)`, func() { - deleteTablePath := "/catalogs/testString/schemas/testString/tables/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteTablePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteTable successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteTable(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteTableOptions model - deleteTableOptionsModel := new(watsonxdatav2.DeleteTableOptions) - deleteTableOptionsModel.CatalogID = core.StringPtr("testString") - deleteTableOptionsModel.SchemaID = core.StringPtr("testString") - deleteTableOptionsModel.TableID = core.StringPtr("testString") - deleteTableOptionsModel.EngineID = core.StringPtr("testString") - deleteTableOptionsModel.Type = core.StringPtr("testString") - deleteTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteTable(deleteTableOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteTable with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeleteTableOptions model - deleteTableOptionsModel := new(watsonxdatav2.DeleteTableOptions) - deleteTableOptionsModel.CatalogID = core.StringPtr("testString") - deleteTableOptionsModel.SchemaID = core.StringPtr("testString") - deleteTableOptionsModel.TableID = core.StringPtr("testString") - deleteTableOptionsModel.EngineID = core.StringPtr("testString") - deleteTableOptionsModel.Type = core.StringPtr("testString") - deleteTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteTable(deleteTableOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteTableOptions model with no property values - deleteTableOptionsModelNew := new(watsonxdatav2.DeleteTableOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteTable(deleteTableOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateTable(updateTableOptions *UpdateTableOptions) - Operation response error`, func() { - updateTablePath := "/catalogs/testString/schemas/testString/tables/testString" + Describe(`UpdateMilvusServiceBucket(updateMilvusServiceBucketOptions *UpdateMilvusServiceBucketOptions) - Operation response error`, func() { + updateMilvusServiceBucketPath := "/v3/milvus_services/testString/storage" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateTablePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServiceBucketPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateTable with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateMilvusServiceBucket with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the TablePatch model - tablePatchModel := new(watsonxdatav2.TablePatch) - tablePatchModel.TableName = core.StringPtr("updated_table_name") - tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" - // Construct an instance of the UpdateTableOptions model - updateTableOptionsModel := new(watsonxdatav2.UpdateTableOptions) - updateTableOptionsModel.CatalogID = core.StringPtr("testString") - updateTableOptionsModel.SchemaID = core.StringPtr("testString") - updateTableOptionsModel.TableID = core.StringPtr("testString") - updateTableOptionsModel.EngineID = core.StringPtr("testString") - updateTableOptionsModel.Body = tablePatchModelAsPatch - updateTableOptionsModel.Type = core.StringPtr("testString") - updateTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateMilvusServiceBucketOptions model + updateMilvusServiceBucketOptionsModel := new(watsonxdatav3.UpdateMilvusServiceBucketOptions) + updateMilvusServiceBucketOptionsModel.ServiceID = core.StringPtr("testString") + updateMilvusServiceBucketOptionsModel.Body = []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel} + updateMilvusServiceBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateMilvusServiceBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateTable(updateTableOptionsModel) + result, response, operationErr := watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateTable(updateTableOptionsModel) + result, response, operationErr = watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -27687,15 +29130,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateTable(updateTableOptions *UpdateTableOptions)`, func() { - updateTablePath := "/catalogs/testString/schemas/testString/tables/testString" + Describe(`UpdateMilvusServiceBucket(updateMilvusServiceBucketOptions *UpdateMilvusServiceBucketOptions)`, func() { + updateMilvusServiceBucketPath := "/v3/milvus_services/testString/storage" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateTablePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServiceBucketPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -27716,19 +29159,17 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"columns": [{"column_name": "expenses", "comment": "expenses column", "extra": "varchar", "length": "30", "scale": "2", "precision": "10", "type": "varchar"}], "table_name": "TableName"}`) + fmt.Fprintf(res, "%s", `{"access_key": "Sample storage access key", "actions": ["Actions"], "created_at": 1, "created_by": "@.com", "dc_cpu": 0.01, "dc_memory": 0.01, "dc_replicas": 1, "description": "milvus service for running sql queries", "display_name": "sampleService", "dw_cpu": 0.01, "dw_memory": 0.01, "dw_replicas": 1, "endpoint": "Endpoint", "etcd_cpu": 0.01, "etcd_memory": 0.01, "failure_message": "Failed to start engine", "grpc_host": "example.grpc.host", "grpc_port": 1, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 1, "id": "milvus123", "index_type": "hnsw", "iw_cpu": 0.01, "iw_memory": 0.01, "iw_replicas": 1, "kafka_cpu": 0.01, "kafka_memory": 0.01, "managed_by": "customer", "origin": "native", "proxy_cpu": 0.01, "proxy_host": "example.proxy.host", "proxy_memory": 0.01, "proxy_port": 1, "proxy_replicas": 1, "qc_cpu": 0.01, "qc_memory": 0.01, "qc_replicas": 1, "qw_cpu": 0.01, "qw_memory": 0.01, "qw_replicas": 1, "rc_cpu": 0.01, "rc_memory": 0.01, "rc_replicas": 1, "root_path": "Sample/path", "secret_key": "Sample storage secret access key", "status": "running", "status_code": 1, "storage_name": "Sample_storage_name", "tags": ["Tags"], "tshirt_size": "small", "type": "milvus", "vector": 1, "vector_dimension": 384, "version": "3.5"}`) })) }) - It(`Invoke UpdateTable successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateMilvusServiceBucket successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -27736,33 +29177,30 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the TablePatch model - tablePatchModel := new(watsonxdatav2.TablePatch) - tablePatchModel.TableName = core.StringPtr("updated_table_name") - tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" - // Construct an instance of the UpdateTableOptions model - updateTableOptionsModel := new(watsonxdatav2.UpdateTableOptions) - updateTableOptionsModel.CatalogID = core.StringPtr("testString") - updateTableOptionsModel.SchemaID = core.StringPtr("testString") - updateTableOptionsModel.TableID = core.StringPtr("testString") - updateTableOptionsModel.EngineID = core.StringPtr("testString") - updateTableOptionsModel.Body = tablePatchModelAsPatch - updateTableOptionsModel.Type = core.StringPtr("testString") - updateTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateMilvusServiceBucketOptions model + updateMilvusServiceBucketOptionsModel := new(watsonxdatav3.UpdateMilvusServiceBucketOptions) + updateMilvusServiceBucketOptionsModel.ServiceID = core.StringPtr("testString") + updateMilvusServiceBucketOptionsModel.Body = []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel} + updateMilvusServiceBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateMilvusServiceBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateTableWithContext(ctx, updateTableOptionsModel) + _, _, operationErr := watsonxDataService.UpdateMilvusServiceBucketWithContext(ctx, updateMilvusServiceBucketOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateTable(updateTableOptionsModel) + result, response, operationErr := watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -27770,7 +29208,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateTableWithContext(ctx, updateTableOptionsModel) + _, _, operationErr = watsonxDataService.UpdateMilvusServiceBucketWithContext(ctx, updateMilvusServiceBucketOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -27784,7 +29222,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateTablePath)) + Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServiceBucketPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -27805,16 +29243,14 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["type"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"columns": [{"column_name": "expenses", "comment": "expenses column", "extra": "varchar", "length": "30", "scale": "2", "precision": "10", "type": "varchar"}], "table_name": "TableName"}`) + fmt.Fprintf(res, "%s", `{"access_key": "Sample storage access key", "actions": ["Actions"], "created_at": 1, "created_by": "@.com", "dc_cpu": 0.01, "dc_memory": 0.01, "dc_replicas": 1, "description": "milvus service for running sql queries", "display_name": "sampleService", "dw_cpu": 0.01, "dw_memory": 0.01, "dw_replicas": 1, "endpoint": "Endpoint", "etcd_cpu": 0.01, "etcd_memory": 0.01, "failure_message": "Failed to start engine", "grpc_host": "example.grpc.host", "grpc_port": 1, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 1, "id": "milvus123", "index_type": "hnsw", "iw_cpu": 0.01, "iw_memory": 0.01, "iw_replicas": 1, "kafka_cpu": 0.01, "kafka_memory": 0.01, "managed_by": "customer", "origin": "native", "proxy_cpu": 0.01, "proxy_host": "example.proxy.host", "proxy_memory": 0.01, "proxy_port": 1, "proxy_replicas": 1, "qc_cpu": 0.01, "qc_memory": 0.01, "qc_replicas": 1, "qw_cpu": 0.01, "qw_memory": 0.01, "qw_replicas": 1, "rc_cpu": 0.01, "rc_memory": 0.01, "rc_replicas": 1, "root_path": "Sample/path", "secret_key": "Sample storage secret access key", "status": "running", "status_code": 1, "storage_name": "Sample_storage_name", "tags": ["Tags"], "tshirt_size": "small", "type": "milvus", "vector": 1, "vector_dimension": 384, "version": "3.5"}`) })) }) - It(`Invoke UpdateTable successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateMilvusServiceBucket successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -27822,71 +29258,65 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateTable(nil) + result, response, operationErr := watsonxDataService.UpdateMilvusServiceBucket(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the TablePatch model - tablePatchModel := new(watsonxdatav2.TablePatch) - tablePatchModel.TableName = core.StringPtr("updated_table_name") - tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" - // Construct an instance of the UpdateTableOptions model - updateTableOptionsModel := new(watsonxdatav2.UpdateTableOptions) - updateTableOptionsModel.CatalogID = core.StringPtr("testString") - updateTableOptionsModel.SchemaID = core.StringPtr("testString") - updateTableOptionsModel.TableID = core.StringPtr("testString") - updateTableOptionsModel.EngineID = core.StringPtr("testString") - updateTableOptionsModel.Body = tablePatchModelAsPatch - updateTableOptionsModel.Type = core.StringPtr("testString") - updateTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateMilvusServiceBucketOptions model + updateMilvusServiceBucketOptionsModel := new(watsonxdatav3.UpdateMilvusServiceBucketOptions) + updateMilvusServiceBucketOptionsModel.ServiceID = core.StringPtr("testString") + updateMilvusServiceBucketOptionsModel.Body = []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel} + updateMilvusServiceBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateMilvusServiceBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateTable(updateTableOptionsModel) + result, response, operationErr = watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateTable with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateMilvusServiceBucket with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the TablePatch model - tablePatchModel := new(watsonxdatav2.TablePatch) - tablePatchModel.TableName = core.StringPtr("updated_table_name") - tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" - // Construct an instance of the UpdateTableOptions model - updateTableOptionsModel := new(watsonxdatav2.UpdateTableOptions) - updateTableOptionsModel.CatalogID = core.StringPtr("testString") - updateTableOptionsModel.SchemaID = core.StringPtr("testString") - updateTableOptionsModel.TableID = core.StringPtr("testString") - updateTableOptionsModel.EngineID = core.StringPtr("testString") - updateTableOptionsModel.Body = tablePatchModelAsPatch - updateTableOptionsModel.Type = core.StringPtr("testString") - updateTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateMilvusServiceBucketOptions model + updateMilvusServiceBucketOptionsModel := new(watsonxdatav3.UpdateMilvusServiceBucketOptions) + updateMilvusServiceBucketOptionsModel.ServiceID = core.StringPtr("testString") + updateMilvusServiceBucketOptionsModel.Body = []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel} + updateMilvusServiceBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateMilvusServiceBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateTable(updateTableOptionsModel) + result, response, operationErr := watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateTableOptions model with no property values - updateTableOptionsModelNew := new(watsonxdatav2.UpdateTableOptions) + // Construct a second instance of the UpdateMilvusServiceBucketOptions model with no property values + updateMilvusServiceBucketOptionsModelNew := new(watsonxdatav3.UpdateMilvusServiceBucketOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateTable(updateTableOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -27904,33 +29334,30 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateTable successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateMilvusServiceBucket successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the TablePatch model - tablePatchModel := new(watsonxdatav2.TablePatch) - tablePatchModel.TableName = core.StringPtr("updated_table_name") - tablePatchModelAsPatch, asPatchErr := tablePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" - // Construct an instance of the UpdateTableOptions model - updateTableOptionsModel := new(watsonxdatav2.UpdateTableOptions) - updateTableOptionsModel.CatalogID = core.StringPtr("testString") - updateTableOptionsModel.SchemaID = core.StringPtr("testString") - updateTableOptionsModel.TableID = core.StringPtr("testString") - updateTableOptionsModel.EngineID = core.StringPtr("testString") - updateTableOptionsModel.Body = tablePatchModelAsPatch - updateTableOptionsModel.Type = core.StringPtr("testString") - updateTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateMilvusServiceBucketOptions model + updateMilvusServiceBucketOptionsModel := new(watsonxdatav3.UpdateMilvusServiceBucketOptions) + updateMilvusServiceBucketOptionsModel.ServiceID = core.StringPtr("testString") + updateMilvusServiceBucketOptionsModel.Body = []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel} + updateMilvusServiceBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateMilvusServiceBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdateTable(updateTableOptionsModel) + result, response, operationErr := watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -27942,49 +29369,44 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListColumns(listColumnsOptions *ListColumnsOptions) - Operation response error`, func() { - listColumnsPath := "/catalogs/testString/schemas/testString/tables/testString/columns" + Describe(`GetSalIntegration(getSalIntegrationOptions *GetSalIntegrationOptions) - Operation response error`, func() { + getSalIntegrationPath := "/v3/sal_integration" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listColumnsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListColumns with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegration with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListColumnsOptions model - listColumnsOptionsModel := new(watsonxdatav2.ListColumnsOptions) - listColumnsOptionsModel.EngineID = core.StringPtr("testString") - listColumnsOptionsModel.CatalogID = core.StringPtr("testString") - listColumnsOptionsModel.SchemaID = core.StringPtr("testString") - listColumnsOptionsModel.TableID = core.StringPtr("testString") - listColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationOptions model + getSalIntegrationOptionsModel := new(watsonxdatav3.GetSalIntegrationOptions) + getSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListColumns(listColumnsOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListColumns(listColumnsOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -27994,31 +29416,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListColumns(listColumnsOptions *ListColumnsOptions)`, func() { - listColumnsPath := "/catalogs/testString/schemas/testString/tables/testString/columns" + Describe(`GetSalIntegration(getSalIntegrationOptions *GetSalIntegrationOptions)`, func() { + getSalIntegrationPath := "/v3/sal_integration" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listColumnsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"columns": [{"column_name": "expenses", "comment": "expenses column", "extra": "varchar", "length": "30", "scale": "2", "precision": "10", "type": "varchar"}]}`) + fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "created_at_epoch": "1715056266", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "trial_plan": false, "username": "xyz@abc.com"}`) })) }) - It(`Invoke ListColumns successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegration successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -28026,25 +29447,21 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListColumnsOptions model - listColumnsOptionsModel := new(watsonxdatav2.ListColumnsOptions) - listColumnsOptionsModel.EngineID = core.StringPtr("testString") - listColumnsOptionsModel.CatalogID = core.StringPtr("testString") - listColumnsOptionsModel.SchemaID = core.StringPtr("testString") - listColumnsOptionsModel.TableID = core.StringPtr("testString") - listColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationOptions model + getSalIntegrationOptionsModel := new(watsonxdatav3.GetSalIntegrationOptions) + getSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListColumnsWithContext(ctx, listColumnsOptionsModel) + _, _, operationErr := watsonxDataService.GetSalIntegrationWithContext(ctx, getSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListColumns(listColumnsOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -28052,7 +29469,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListColumnsWithContext(ctx, listColumnsOptionsModel) + _, _, operationErr = watsonxDataService.GetSalIntegrationWithContext(ctx, getSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -28066,20 +29483,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listColumnsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"columns": [{"column_name": "expenses", "comment": "expenses column", "extra": "varchar", "length": "30", "scale": "2", "precision": "10", "type": "varchar"}]}`) + fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "created_at_epoch": "1715056266", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "trial_plan": false, "username": "xyz@abc.com"}`) })) }) - It(`Invoke ListColumns successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -28087,58 +29503,43 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListColumns(nil) + result, response, operationErr := watsonxDataService.GetSalIntegration(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListColumnsOptions model - listColumnsOptionsModel := new(watsonxdatav2.ListColumnsOptions) - listColumnsOptionsModel.EngineID = core.StringPtr("testString") - listColumnsOptionsModel.CatalogID = core.StringPtr("testString") - listColumnsOptionsModel.SchemaID = core.StringPtr("testString") - listColumnsOptionsModel.TableID = core.StringPtr("testString") - listColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationOptions model + getSalIntegrationOptionsModel := new(watsonxdatav3.GetSalIntegrationOptions) + getSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListColumns(listColumnsOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListColumns with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegration with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListColumnsOptions model - listColumnsOptionsModel := new(watsonxdatav2.ListColumnsOptions) - listColumnsOptionsModel.EngineID = core.StringPtr("testString") - listColumnsOptionsModel.CatalogID = core.StringPtr("testString") - listColumnsOptionsModel.SchemaID = core.StringPtr("testString") - listColumnsOptionsModel.TableID = core.StringPtr("testString") - listColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationOptions model + getSalIntegrationOptionsModel := new(watsonxdatav3.GetSalIntegrationOptions) + getSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListColumns(listColumnsOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListColumnsOptions model with no property values - listColumnsOptionsModelNew := new(watsonxdatav2.ListColumnsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListColumns(listColumnsOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -28153,25 +29554,21 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListColumns successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListColumnsOptions model - listColumnsOptionsModel := new(watsonxdatav2.ListColumnsOptions) - listColumnsOptionsModel.EngineID = core.StringPtr("testString") - listColumnsOptionsModel.CatalogID = core.StringPtr("testString") - listColumnsOptionsModel.SchemaID = core.StringPtr("testString") - listColumnsOptionsModel.TableID = core.StringPtr("testString") - listColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationOptions model + getSalIntegrationOptionsModel := new(watsonxdatav3.GetSalIntegrationOptions) + getSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListColumns(listColumnsOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegration(getSalIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -28183,60 +29580,49 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateColumns(createColumnsOptions *CreateColumnsOptions) - Operation response error`, func() { - createColumnsPath := "/catalogs/testString/schemas/testString/tables/testString/columns" + Describe(`CreateSalIntegration(createSalIntegrationOptions *CreateSalIntegrationOptions) - Operation response error`, func() { + createSalIntegrationPath := "/v3/sal_integration" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createColumnsPath)) + Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationPath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateColumns with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSalIntegration with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the Column model - columnModel := new(watsonxdatav2.Column) - columnModel.ColumnName = core.StringPtr("expenses") - columnModel.Comment = core.StringPtr("expenses column") - columnModel.Extra = core.StringPtr("varchar") - columnModel.Length = core.StringPtr("30") - columnModel.Scale = core.StringPtr("2") - columnModel.Precision = core.StringPtr("10") - columnModel.Type = core.StringPtr("varchar") - - // Construct an instance of the CreateColumnsOptions model - createColumnsOptionsModel := new(watsonxdatav2.CreateColumnsOptions) - createColumnsOptionsModel.EngineID = core.StringPtr("testString") - createColumnsOptionsModel.CatalogID = core.StringPtr("testString") - createColumnsOptionsModel.SchemaID = core.StringPtr("testString") - createColumnsOptionsModel.TableID = core.StringPtr("testString") - createColumnsOptionsModel.Columns = []watsonxdatav2.Column{*columnModel} - createColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSalIntegrationOptions model + createSalIntegrationOptionsModel := new(watsonxdatav3.CreateSalIntegrationOptions) + createSalIntegrationOptionsModel.Apikey = core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") + createSalIntegrationOptionsModel.EngineID = core.StringPtr("presto-01") + createSalIntegrationOptionsModel.StorageResourceCrn = core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161") + createSalIntegrationOptionsModel.StorageType = core.StringPtr("bmcos_object_storage") + createSalIntegrationOptionsModel.TrialPlan = core.BoolPtr(true) + createSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateColumns(createColumnsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateColumns(createColumnsOptionsModel) + result, response, operationErr = watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -28246,15 +29632,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateColumns(createColumnsOptions *CreateColumnsOptions)`, func() { - createColumnsPath := "/catalogs/testString/schemas/testString/tables/testString/columns" + Describe(`CreateSalIntegration(createSalIntegrationOptions *CreateSalIntegrationOptions)`, func() { + createSalIntegrationPath := "/v3/sal_integration" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createColumnsPath)) + Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -28275,18 +29661,17 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"columns": [{"column_name": "expenses", "comment": "expenses column", "extra": "varchar", "length": "30", "scale": "2", "precision": "10", "type": "varchar"}]}`) + fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "created_at_epoch": "1715056266", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "trial_plan": false, "username": "xyz@abc.com"}`) })) }) - It(`Invoke CreateColumns successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSalIntegration successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -28294,36 +29679,26 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the Column model - columnModel := new(watsonxdatav2.Column) - columnModel.ColumnName = core.StringPtr("expenses") - columnModel.Comment = core.StringPtr("expenses column") - columnModel.Extra = core.StringPtr("varchar") - columnModel.Length = core.StringPtr("30") - columnModel.Scale = core.StringPtr("2") - columnModel.Precision = core.StringPtr("10") - columnModel.Type = core.StringPtr("varchar") - - // Construct an instance of the CreateColumnsOptions model - createColumnsOptionsModel := new(watsonxdatav2.CreateColumnsOptions) - createColumnsOptionsModel.EngineID = core.StringPtr("testString") - createColumnsOptionsModel.CatalogID = core.StringPtr("testString") - createColumnsOptionsModel.SchemaID = core.StringPtr("testString") - createColumnsOptionsModel.TableID = core.StringPtr("testString") - createColumnsOptionsModel.Columns = []watsonxdatav2.Column{*columnModel} - createColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSalIntegrationOptions model + createSalIntegrationOptionsModel := new(watsonxdatav3.CreateSalIntegrationOptions) + createSalIntegrationOptionsModel.Apikey = core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") + createSalIntegrationOptionsModel.EngineID = core.StringPtr("presto-01") + createSalIntegrationOptionsModel.StorageResourceCrn = core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161") + createSalIntegrationOptionsModel.StorageType = core.StringPtr("bmcos_object_storage") + createSalIntegrationOptionsModel.TrialPlan = core.BoolPtr(true) + createSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateColumnsWithContext(ctx, createColumnsOptionsModel) + _, _, operationErr := watsonxDataService.CreateSalIntegrationWithContext(ctx, createSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateColumns(createColumnsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -28331,7 +29706,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateColumnsWithContext(ctx, createColumnsOptionsModel) + _, _, operationErr = watsonxDataService.CreateSalIntegrationWithContext(ctx, createSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -28345,7 +29720,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createColumnsPath)) + Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -28366,15 +29741,14 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"columns": [{"column_name": "expenses", "comment": "expenses column", "extra": "varchar", "length": "30", "scale": "2", "precision": "10", "type": "varchar"}]}`) + fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "created_at_epoch": "1715056266", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "trial_plan": false, "username": "xyz@abc.com"}`) })) }) - It(`Invoke CreateColumns successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSalIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -28382,77 +29756,57 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateColumns(nil) + result, response, operationErr := watsonxDataService.CreateSalIntegration(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the Column model - columnModel := new(watsonxdatav2.Column) - columnModel.ColumnName = core.StringPtr("expenses") - columnModel.Comment = core.StringPtr("expenses column") - columnModel.Extra = core.StringPtr("varchar") - columnModel.Length = core.StringPtr("30") - columnModel.Scale = core.StringPtr("2") - columnModel.Precision = core.StringPtr("10") - columnModel.Type = core.StringPtr("varchar") - - // Construct an instance of the CreateColumnsOptions model - createColumnsOptionsModel := new(watsonxdatav2.CreateColumnsOptions) - createColumnsOptionsModel.EngineID = core.StringPtr("testString") - createColumnsOptionsModel.CatalogID = core.StringPtr("testString") - createColumnsOptionsModel.SchemaID = core.StringPtr("testString") - createColumnsOptionsModel.TableID = core.StringPtr("testString") - createColumnsOptionsModel.Columns = []watsonxdatav2.Column{*columnModel} - createColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSalIntegrationOptions model + createSalIntegrationOptionsModel := new(watsonxdatav3.CreateSalIntegrationOptions) + createSalIntegrationOptionsModel.Apikey = core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") + createSalIntegrationOptionsModel.EngineID = core.StringPtr("presto-01") + createSalIntegrationOptionsModel.StorageResourceCrn = core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161") + createSalIntegrationOptionsModel.StorageType = core.StringPtr("bmcos_object_storage") + createSalIntegrationOptionsModel.TrialPlan = core.BoolPtr(true) + createSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateColumns(createColumnsOptionsModel) + result, response, operationErr = watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateColumns with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSalIntegration with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the Column model - columnModel := new(watsonxdatav2.Column) - columnModel.ColumnName = core.StringPtr("expenses") - columnModel.Comment = core.StringPtr("expenses column") - columnModel.Extra = core.StringPtr("varchar") - columnModel.Length = core.StringPtr("30") - columnModel.Scale = core.StringPtr("2") - columnModel.Precision = core.StringPtr("10") - columnModel.Type = core.StringPtr("varchar") - - // Construct an instance of the CreateColumnsOptions model - createColumnsOptionsModel := new(watsonxdatav2.CreateColumnsOptions) - createColumnsOptionsModel.EngineID = core.StringPtr("testString") - createColumnsOptionsModel.CatalogID = core.StringPtr("testString") - createColumnsOptionsModel.SchemaID = core.StringPtr("testString") - createColumnsOptionsModel.TableID = core.StringPtr("testString") - createColumnsOptionsModel.Columns = []watsonxdatav2.Column{*columnModel} - createColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSalIntegrationOptions model + createSalIntegrationOptionsModel := new(watsonxdatav3.CreateSalIntegrationOptions) + createSalIntegrationOptionsModel.Apikey = core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") + createSalIntegrationOptionsModel.EngineID = core.StringPtr("presto-01") + createSalIntegrationOptionsModel.StorageResourceCrn = core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161") + createSalIntegrationOptionsModel.StorageType = core.StringPtr("bmcos_object_storage") + createSalIntegrationOptionsModel.TrialPlan = core.BoolPtr(true) + createSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateColumns(createColumnsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateColumnsOptions model with no property values - createColumnsOptionsModelNew := new(watsonxdatav2.CreateColumnsOptions) + // Construct a second instance of the CreateSalIntegrationOptions model with no property values + createSalIntegrationOptionsModelNew := new(watsonxdatav3.CreateSalIntegrationOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateColumns(createColumnsOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -28470,36 +29824,26 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(201) })) }) - It(`Invoke CreateColumns successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSalIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the Column model - columnModel := new(watsonxdatav2.Column) - columnModel.ColumnName = core.StringPtr("expenses") - columnModel.Comment = core.StringPtr("expenses column") - columnModel.Extra = core.StringPtr("varchar") - columnModel.Length = core.StringPtr("30") - columnModel.Scale = core.StringPtr("2") - columnModel.Precision = core.StringPtr("10") - columnModel.Type = core.StringPtr("varchar") - - // Construct an instance of the CreateColumnsOptions model - createColumnsOptionsModel := new(watsonxdatav2.CreateColumnsOptions) - createColumnsOptionsModel.EngineID = core.StringPtr("testString") - createColumnsOptionsModel.CatalogID = core.StringPtr("testString") - createColumnsOptionsModel.SchemaID = core.StringPtr("testString") - createColumnsOptionsModel.TableID = core.StringPtr("testString") - createColumnsOptionsModel.Columns = []watsonxdatav2.Column{*columnModel} - createColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSalIntegrationOptions model + createSalIntegrationOptionsModel := new(watsonxdatav3.CreateSalIntegrationOptions) + createSalIntegrationOptionsModel.Apikey = core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") + createSalIntegrationOptionsModel.EngineID = core.StringPtr("presto-01") + createSalIntegrationOptionsModel.StorageResourceCrn = core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161") + createSalIntegrationOptionsModel.StorageType = core.StringPtr("bmcos_object_storage") + createSalIntegrationOptionsModel.TrialPlan = core.BoolPtr(true) + createSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateColumns(createColumnsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSalIntegration(createSalIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -28511,25 +29855,22 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteColumn(deleteColumnOptions *DeleteColumnOptions)`, func() { - deleteColumnPath := "/catalogs/testString/schemas/testString/tables/testString/columns/testString" + Describe(`DeleteSalIntegration(deleteSalIntegrationOptions *DeleteSalIntegrationOptions)`, func() { + deleteSalIntegrationPath := "/v3/sal_integration" Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteColumnPath)) + Expect(req.URL.EscapedPath()).To(Equal(deleteSalIntegrationPath)) Expect(req.Method).To(Equal("DELETE")) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.WriteHeader(204) })) }) - It(`Invoke DeleteColumn successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSalIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -28537,112 +29878,89 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteColumn(nil) + response, operationErr := watsonxDataService.DeleteSalIntegration(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) - // Construct an instance of the DeleteColumnOptions model - deleteColumnOptionsModel := new(watsonxdatav2.DeleteColumnOptions) - deleteColumnOptionsModel.EngineID = core.StringPtr("testString") - deleteColumnOptionsModel.CatalogID = core.StringPtr("testString") - deleteColumnOptionsModel.SchemaID = core.StringPtr("testString") - deleteColumnOptionsModel.TableID = core.StringPtr("testString") - deleteColumnOptionsModel.ColumnID = core.StringPtr("testString") - deleteColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSalIntegrationOptions model + deleteSalIntegrationOptionsModel := new(watsonxdatav3.DeleteSalIntegrationOptions) + deleteSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteColumn(deleteColumnOptionsModel) + response, operationErr = watsonxDataService.DeleteSalIntegration(deleteSalIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) }) - It(`Invoke DeleteColumn with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSalIntegration with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the DeleteColumnOptions model - deleteColumnOptionsModel := new(watsonxdatav2.DeleteColumnOptions) - deleteColumnOptionsModel.EngineID = core.StringPtr("testString") - deleteColumnOptionsModel.CatalogID = core.StringPtr("testString") - deleteColumnOptionsModel.SchemaID = core.StringPtr("testString") - deleteColumnOptionsModel.TableID = core.StringPtr("testString") - deleteColumnOptionsModel.ColumnID = core.StringPtr("testString") - deleteColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the DeleteSalIntegrationOptions model + deleteSalIntegrationOptionsModel := new(watsonxdatav3.DeleteSalIntegrationOptions) + deleteSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteColumn(deleteColumnOptionsModel) + response, operationErr := watsonxDataService.DeleteSalIntegration(deleteSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) - // Construct a second instance of the DeleteColumnOptions model with no property values - deleteColumnOptionsModelNew := new(watsonxdatav2.DeleteColumnOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteColumn(deleteColumnOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`UpdateColumn(updateColumnOptions *UpdateColumnOptions) - Operation response error`, func() { - updateColumnPath := "/catalogs/testString/schemas/testString/tables/testString/columns/testString" + Describe(`UpdateSalIntegration(updateSalIntegrationOptions *UpdateSalIntegrationOptions) - Operation response error`, func() { + updateSalIntegrationPath := "/v3/sal_integration" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateColumnPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateSalIntegrationPath)) Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateColumn with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSalIntegration with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ColumnPatch model - columnPatchModel := new(watsonxdatav2.ColumnPatch) - columnPatchModel.ColumnName = core.StringPtr("expenses") - columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() + // Construct an instance of the SalIntegrationPatch model + salIntegrationPatchModel := new(watsonxdatav3.SalIntegrationPatch) + salIntegrationPatchModel.Apikey = core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") + salIntegrationPatchModel.EngineID = core.StringPtr("presto-01") + salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateColumnOptions model - updateColumnOptionsModel := new(watsonxdatav2.UpdateColumnOptions) - updateColumnOptionsModel.EngineID = core.StringPtr("testString") - updateColumnOptionsModel.CatalogID = core.StringPtr("testString") - updateColumnOptionsModel.SchemaID = core.StringPtr("testString") - updateColumnOptionsModel.TableID = core.StringPtr("testString") - updateColumnOptionsModel.ColumnID = core.StringPtr("testString") - updateColumnOptionsModel.Body = columnPatchModelAsPatch - updateColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSalIntegrationOptions model + updateSalIntegrationOptionsModel := new(watsonxdatav3.UpdateSalIntegrationOptions) + updateSalIntegrationOptionsModel.SalIntegrationPatch = salIntegrationPatchModelAsPatch + updateSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateColumn(updateColumnOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateColumn(updateColumnOptionsModel) + result, response, operationErr = watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -28652,15 +29970,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateColumn(updateColumnOptions *UpdateColumnOptions)`, func() { - updateColumnPath := "/catalogs/testString/schemas/testString/tables/testString/columns/testString" + Describe(`UpdateSalIntegration(updateSalIntegrationOptions *UpdateSalIntegrationOptions)`, func() { + updateSalIntegrationPath := "/v3/sal_integration" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateColumnPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateSalIntegrationPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -28681,18 +29999,17 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"column_name": "expenses", "comment": "expenses column", "extra": "varchar", "length": "30", "scale": "2", "precision": "10", "type": "varchar"}`) + fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "created_at_epoch": "1715056266", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "trial_plan": false, "username": "xyz@abc.com"}`) })) }) - It(`Invoke UpdateColumn successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSalIntegration successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -28700,33 +30017,29 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ColumnPatch model - columnPatchModel := new(watsonxdatav2.ColumnPatch) - columnPatchModel.ColumnName = core.StringPtr("expenses") - columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() + // Construct an instance of the SalIntegrationPatch model + salIntegrationPatchModel := new(watsonxdatav3.SalIntegrationPatch) + salIntegrationPatchModel.Apikey = core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") + salIntegrationPatchModel.EngineID = core.StringPtr("presto-01") + salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateColumnOptions model - updateColumnOptionsModel := new(watsonxdatav2.UpdateColumnOptions) - updateColumnOptionsModel.EngineID = core.StringPtr("testString") - updateColumnOptionsModel.CatalogID = core.StringPtr("testString") - updateColumnOptionsModel.SchemaID = core.StringPtr("testString") - updateColumnOptionsModel.TableID = core.StringPtr("testString") - updateColumnOptionsModel.ColumnID = core.StringPtr("testString") - updateColumnOptionsModel.Body = columnPatchModelAsPatch - updateColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSalIntegrationOptions model + updateSalIntegrationOptionsModel := new(watsonxdatav3.UpdateSalIntegrationOptions) + updateSalIntegrationOptionsModel.SalIntegrationPatch = salIntegrationPatchModelAsPatch + updateSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateColumnWithContext(ctx, updateColumnOptionsModel) + _, _, operationErr := watsonxDataService.UpdateSalIntegrationWithContext(ctx, updateSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateColumn(updateColumnOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -28734,7 +30047,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateColumnWithContext(ctx, updateColumnOptionsModel) + _, _, operationErr = watsonxDataService.UpdateSalIntegrationWithContext(ctx, updateSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -28748,7 +30061,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateColumnPath)) + Expect(req.URL.EscapedPath()).To(Equal(updateSalIntegrationPath)) Expect(req.Method).To(Equal("PATCH")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -28769,15 +30082,14 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"column_name": "expenses", "comment": "expenses column", "extra": "varchar", "length": "30", "scale": "2", "precision": "10", "type": "varchar"}`) + fmt.Fprintf(res, "%s", `{"category_id": "10e64285-bf37-4d5d-b759-bc6a46589234", "created_at_epoch": "1715056266", "engine_id": "presto-01", "errors": [{"code": "unable_to_perform", "message": "Failed to process integration settings for watsonx.data instance"}], "instance_id": "18b49d7a-9519-4539-8db5-ff080623c226", "status": "provisioning", "storage_resource_crn": "crn:v1:staging:public:cloud-object-storage:global:a/04e9bc47612523rr19ac22759cb69bebd:asd23df-6ada-45ff-bfe8-4343222", "storage_type": "bmcos_object_storage", "trial_plan": false, "username": "xyz@abc.com"}`) })) }) - It(`Invoke UpdateColumn successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSalIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -28785,71 +30097,63 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateColumn(nil) + result, response, operationErr := watsonxDataService.UpdateSalIntegration(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ColumnPatch model - columnPatchModel := new(watsonxdatav2.ColumnPatch) - columnPatchModel.ColumnName = core.StringPtr("expenses") - columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() + // Construct an instance of the SalIntegrationPatch model + salIntegrationPatchModel := new(watsonxdatav3.SalIntegrationPatch) + salIntegrationPatchModel.Apikey = core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") + salIntegrationPatchModel.EngineID = core.StringPtr("presto-01") + salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateColumnOptions model - updateColumnOptionsModel := new(watsonxdatav2.UpdateColumnOptions) - updateColumnOptionsModel.EngineID = core.StringPtr("testString") - updateColumnOptionsModel.CatalogID = core.StringPtr("testString") - updateColumnOptionsModel.SchemaID = core.StringPtr("testString") - updateColumnOptionsModel.TableID = core.StringPtr("testString") - updateColumnOptionsModel.ColumnID = core.StringPtr("testString") - updateColumnOptionsModel.Body = columnPatchModelAsPatch - updateColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSalIntegrationOptions model + updateSalIntegrationOptionsModel := new(watsonxdatav3.UpdateSalIntegrationOptions) + updateSalIntegrationOptionsModel.SalIntegrationPatch = salIntegrationPatchModelAsPatch + updateSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateColumn(updateColumnOptionsModel) + result, response, operationErr = watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateColumn with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSalIntegration with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ColumnPatch model - columnPatchModel := new(watsonxdatav2.ColumnPatch) - columnPatchModel.ColumnName = core.StringPtr("expenses") - columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() + // Construct an instance of the SalIntegrationPatch model + salIntegrationPatchModel := new(watsonxdatav3.SalIntegrationPatch) + salIntegrationPatchModel.Apikey = core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") + salIntegrationPatchModel.EngineID = core.StringPtr("presto-01") + salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateColumnOptions model - updateColumnOptionsModel := new(watsonxdatav2.UpdateColumnOptions) - updateColumnOptionsModel.EngineID = core.StringPtr("testString") - updateColumnOptionsModel.CatalogID = core.StringPtr("testString") - updateColumnOptionsModel.SchemaID = core.StringPtr("testString") - updateColumnOptionsModel.TableID = core.StringPtr("testString") - updateColumnOptionsModel.ColumnID = core.StringPtr("testString") - updateColumnOptionsModel.Body = columnPatchModelAsPatch - updateColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSalIntegrationOptions model + updateSalIntegrationOptionsModel := new(watsonxdatav3.UpdateSalIntegrationOptions) + updateSalIntegrationOptionsModel.SalIntegrationPatch = salIntegrationPatchModelAsPatch + updateSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateColumn(updateColumnOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateColumnOptions model with no property values - updateColumnOptionsModelNew := new(watsonxdatav2.UpdateColumnOptions) + // Construct a second instance of the UpdateSalIntegrationOptions model with no property values + updateSalIntegrationOptionsModelNew := new(watsonxdatav3.UpdateSalIntegrationOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateColumn(updateColumnOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -28867,33 +30171,29 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateColumn successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateSalIntegration successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ColumnPatch model - columnPatchModel := new(watsonxdatav2.ColumnPatch) - columnPatchModel.ColumnName = core.StringPtr("expenses") - columnPatchModelAsPatch, asPatchErr := columnPatchModel.AsPatch() + // Construct an instance of the SalIntegrationPatch model + salIntegrationPatchModel := new(watsonxdatav3.SalIntegrationPatch) + salIntegrationPatchModel.Apikey = core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") + salIntegrationPatchModel.EngineID = core.StringPtr("presto-01") + salIntegrationPatchModelAsPatch, asPatchErr := salIntegrationPatchModel.AsPatch() Expect(asPatchErr).To(BeNil()) - // Construct an instance of the UpdateColumnOptions model - updateColumnOptionsModel := new(watsonxdatav2.UpdateColumnOptions) - updateColumnOptionsModel.EngineID = core.StringPtr("testString") - updateColumnOptionsModel.CatalogID = core.StringPtr("testString") - updateColumnOptionsModel.SchemaID = core.StringPtr("testString") - updateColumnOptionsModel.TableID = core.StringPtr("testString") - updateColumnOptionsModel.ColumnID = core.StringPtr("testString") - updateColumnOptionsModel.Body = columnPatchModelAsPatch - updateColumnOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateColumnOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the UpdateSalIntegrationOptions model + updateSalIntegrationOptionsModel := new(watsonxdatav3.UpdateSalIntegrationOptions) + updateSalIntegrationOptionsModel.SalIntegrationPatch = salIntegrationPatchModelAsPatch + updateSalIntegrationOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateSalIntegrationOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdateColumn(updateColumnOptionsModel) + result, response, operationErr := watsonxDataService.UpdateSalIntegration(updateSalIntegrationOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -28905,49 +30205,142 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListTableSnapshots(listTableSnapshotsOptions *ListTableSnapshotsOptions) - Operation response error`, func() { - listTableSnapshotsPath := "/catalogs/testString/schemas/testString/tables/testString/snapshots" + Describe(`CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptions *CreateSalIntegrationEnrichmentOptions)`, func() { + createSalIntegrationEnrichmentPath := "/v3/sal_integration/enrichment" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationEnrichmentPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.WriteHeader(204) + })) + }) + It(`Invoke CreateSalIntegrationEnrichment successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.CreateSalIntegrationEnrichment(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the EnrichmentObj model + enrichmentObjModel := new(watsonxdatav3.EnrichmentObj) + enrichmentObjModel.Catalog = core.StringPtr("iceberg_data") + enrichmentObjModel.Operation = core.StringPtr("create") + enrichmentObjModel.Schema = core.StringPtr("schema1") + enrichmentObjModel.Tables = []string{"table1"} + + // Construct an instance of the CreateSalIntegrationEnrichmentOptions model + createSalIntegrationEnrichmentOptionsModel := new(watsonxdatav3.CreateSalIntegrationEnrichmentOptions) + createSalIntegrationEnrichmentOptionsModel.Changes = []watsonxdatav3.EnrichmentObj{*enrichmentObjModel} + createSalIntegrationEnrichmentOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationEnrichmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke CreateSalIntegrationEnrichment with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the EnrichmentObj model + enrichmentObjModel := new(watsonxdatav3.EnrichmentObj) + enrichmentObjModel.Catalog = core.StringPtr("iceberg_data") + enrichmentObjModel.Operation = core.StringPtr("create") + enrichmentObjModel.Schema = core.StringPtr("schema1") + enrichmentObjModel.Tables = []string{"table1"} + + // Construct an instance of the CreateSalIntegrationEnrichmentOptions model + createSalIntegrationEnrichmentOptionsModel := new(watsonxdatav3.CreateSalIntegrationEnrichmentOptions) + createSalIntegrationEnrichmentOptionsModel.Changes = []watsonxdatav3.EnrichmentObj{*enrichmentObjModel} + createSalIntegrationEnrichmentOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationEnrichmentOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.CreateSalIntegrationEnrichment(createSalIntegrationEnrichmentOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptions *ListSalIntegrationEnrichmentAssetsOptions) - Operation response error`, func() { + listSalIntegrationEnrichmentAssetsPath := "/v3/sal_integration/enrichment/data_assets" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listTableSnapshotsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentAssetsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListTableSnapshots with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentAssets with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListTableSnapshotsOptions model - listTableSnapshotsOptionsModel := new(watsonxdatav2.ListTableSnapshotsOptions) - listTableSnapshotsOptionsModel.EngineID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.CatalogID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.SchemaID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.TableID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentAssetsOptions model + listSalIntegrationEnrichmentAssetsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentAssetsOptions) + listSalIntegrationEnrichmentAssetsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) + result, response, operationErr = watsonxDataService.ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -28957,31 +30350,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListTableSnapshots(listTableSnapshotsOptions *ListTableSnapshotsOptions)`, func() { - listTableSnapshotsPath := "/catalogs/testString/schemas/testString/tables/testString/snapshots" + Describe(`ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptions *ListSalIntegrationEnrichmentAssetsOptions)`, func() { + listSalIntegrationEnrichmentAssetsPath := "/v3/sal_integration/enrichment/data_assets" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listTableSnapshotsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentAssetsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"snapshots": [{"added_data_files": "1", "added_files_size": "17425", "added_records": "3277", "changed_partition_count": "1", "committed_at": "1609379392", "operation": "alter", "snapshot_id": "2332342122211222", "total_data_files": "2", "total_delete_files": "0", "total_equality_deletes": "0", "total_position_deletes": "0", "total_records": "5000"}]}`) + fmt.Fprintf(res, "%s", `{"data_assets": [{"attributes": ["Attributes"], "id": "ee0383b9-dcab-4c1a-b03d-bf521837b6ed", "name": "newtable", "resource_key": "0000:0000:0000:0000:0000:FFFF:9EB0:04E2|31134|:/iceberg_data/new_schema/sampletable", "schema_name": "sampleschema"}]}`) })) }) - It(`Invoke ListTableSnapshots successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentAssets successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -28989,25 +30382,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListTableSnapshotsOptions model - listTableSnapshotsOptionsModel := new(watsonxdatav2.ListTableSnapshotsOptions) - listTableSnapshotsOptionsModel.EngineID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.CatalogID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.SchemaID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.TableID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentAssetsOptions model + listSalIntegrationEnrichmentAssetsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentAssetsOptions) + listSalIntegrationEnrichmentAssetsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListTableSnapshotsWithContext(ctx, listTableSnapshotsOptionsModel) + _, _, operationErr := watsonxDataService.ListSalIntegrationEnrichmentAssetsWithContext(ctx, listSalIntegrationEnrichmentAssetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -29015,7 +30405,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListTableSnapshotsWithContext(ctx, listTableSnapshotsOptionsModel) + _, _, operationErr = watsonxDataService.ListSalIntegrationEnrichmentAssetsWithContext(ctx, listSalIntegrationEnrichmentAssetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -29029,20 +30419,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listTableSnapshotsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentAssetsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"snapshots": [{"added_data_files": "1", "added_files_size": "17425", "added_records": "3277", "changed_partition_count": "1", "committed_at": "1609379392", "operation": "alter", "snapshot_id": "2332342122211222", "total_data_files": "2", "total_delete_files": "0", "total_equality_deletes": "0", "total_position_deletes": "0", "total_records": "5000"}]}`) + fmt.Fprintf(res, "%s", `{"data_assets": [{"attributes": ["Attributes"], "id": "ee0383b9-dcab-4c1a-b03d-bf521837b6ed", "name": "newtable", "resource_key": "0000:0000:0000:0000:0000:FFFF:9EB0:04E2|31134|:/iceberg_data/new_schema/sampletable", "schema_name": "sampleschema"}]}`) })) }) - It(`Invoke ListTableSnapshots successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentAssets successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -29050,55 +30440,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListTableSnapshots(nil) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentAssets(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListTableSnapshotsOptions model - listTableSnapshotsOptionsModel := new(watsonxdatav2.ListTableSnapshotsOptions) - listTableSnapshotsOptionsModel.EngineID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.CatalogID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.SchemaID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.TableID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentAssetsOptions model + listSalIntegrationEnrichmentAssetsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentAssetsOptions) + listSalIntegrationEnrichmentAssetsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) + result, response, operationErr = watsonxDataService.ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListTableSnapshots with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentAssets with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListTableSnapshotsOptions model - listTableSnapshotsOptionsModel := new(watsonxdatav2.ListTableSnapshotsOptions) - listTableSnapshotsOptionsModel.EngineID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.CatalogID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.SchemaID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.TableID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentAssetsOptions model + listSalIntegrationEnrichmentAssetsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentAssetsOptions) + listSalIntegrationEnrichmentAssetsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListTableSnapshotsOptions model with no property values - listTableSnapshotsOptionsModelNew := new(watsonxdatav2.ListTableSnapshotsOptions) + // Construct a second instance of the ListSalIntegrationEnrichmentAssetsOptions model with no property values + listSalIntegrationEnrichmentAssetsOptionsModelNew := new(watsonxdatav3.ListSalIntegrationEnrichmentAssetsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModelNew) + result, response, operationErr = watsonxDataService.ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -29116,25 +30500,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListTableSnapshots successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentAssets successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListTableSnapshotsOptions model - listTableSnapshotsOptionsModel := new(watsonxdatav2.ListTableSnapshotsOptions) - listTableSnapshotsOptionsModel.EngineID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.CatalogID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.SchemaID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.TableID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listTableSnapshotsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentAssetsOptions model + listSalIntegrationEnrichmentAssetsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentAssetsOptions) + listSalIntegrationEnrichmentAssetsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListTableSnapshots(listTableSnapshotsOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentAssets(listSalIntegrationEnrichmentAssetsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -29146,50 +30527,47 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RollbackTable(rollbackTableOptions *RollbackTableOptions) - Operation response error`, func() { - rollbackTablePath := "/catalogs/testString/schemas/testString/tables/testString/rollback" + Describe(`GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptions *GetSalIntegrationEnrichmentAssetsByIdOptions) - Operation response error`, func() { + getSalIntegrationEnrichmentAssetsByIDPath := "/v3/sal_integration/enrichment/data_assets/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(rollbackTablePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentAssetsByIDPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke RollbackTable with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentAssetsByID with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RollbackTableOptions model - rollbackTableOptionsModel := new(watsonxdatav2.RollbackTableOptions) - rollbackTableOptionsModel.EngineID = core.StringPtr("testString") - rollbackTableOptionsModel.CatalogID = core.StringPtr("testString") - rollbackTableOptionsModel.SchemaID = core.StringPtr("testString") - rollbackTableOptionsModel.TableID = core.StringPtr("testString") - rollbackTableOptionsModel.SnapshotID = core.StringPtr("testString") - rollbackTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - rollbackTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentAssetsByIdOptions model + getSalIntegrationEnrichmentAssetsByIdOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentAssetsByIdOptions) + getSalIntegrationEnrichmentAssetsByIdOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.ID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.RollbackTable(rollbackTableOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.RollbackTable(rollbackTableOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -29199,47 +30577,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RollbackTable(rollbackTableOptions *RollbackTableOptions)`, func() { - rollbackTablePath := "/catalogs/testString/schemas/testString/tables/testString/rollback" + Describe(`GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptions *GetSalIntegrationEnrichmentAssetsByIdOptions)`, func() { + getSalIntegrationEnrichmentAssetsByIDPath := "/v3/sal_integration/enrichment/data_assets/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(rollbackTablePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentAssetsByIDPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"attributes": ["Attributes"], "id": "ee0383b9-dcab-4c1a-b03d-bf521837b6ed", "name": "newtable", "resource_key": "0000:0000:0000:0000:0000:FFFF:9EB0:04E2|31134|:/iceberg_data/new_schema/sampletable", "schema_name": "sampleschema"}`) })) }) - It(`Invoke RollbackTable successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentAssetsByID successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -29247,26 +30609,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the RollbackTableOptions model - rollbackTableOptionsModel := new(watsonxdatav2.RollbackTableOptions) - rollbackTableOptionsModel.EngineID = core.StringPtr("testString") - rollbackTableOptionsModel.CatalogID = core.StringPtr("testString") - rollbackTableOptionsModel.SchemaID = core.StringPtr("testString") - rollbackTableOptionsModel.TableID = core.StringPtr("testString") - rollbackTableOptionsModel.SnapshotID = core.StringPtr("testString") - rollbackTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - rollbackTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentAssetsByIdOptions model + getSalIntegrationEnrichmentAssetsByIdOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentAssetsByIdOptions) + getSalIntegrationEnrichmentAssetsByIdOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.ID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.RollbackTableWithContext(ctx, rollbackTableOptionsModel) + _, _, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssetsByIDWithContext(ctx, getSalIntegrationEnrichmentAssetsByIdOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.RollbackTable(rollbackTableOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -29274,7 +30633,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.RollbackTableWithContext(ctx, rollbackTableOptionsModel) + _, _, operationErr = watsonxDataService.GetSalIntegrationEnrichmentAssetsByIDWithContext(ctx, getSalIntegrationEnrichmentAssetsByIdOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -29288,36 +30647,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(rollbackTablePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentAssetsByIDPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"attributes": ["Attributes"], "id": "ee0383b9-dcab-4c1a-b03d-bf521837b6ed", "name": "newtable", "resource_key": "0000:0000:0000:0000:0000:FFFF:9EB0:04E2|31134|:/iceberg_data/new_schema/sampletable", "schema_name": "sampleschema"}`) })) }) - It(`Invoke RollbackTable successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentAssetsByID successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -29325,57 +30668,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.RollbackTable(nil) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssetsByID(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the RollbackTableOptions model - rollbackTableOptionsModel := new(watsonxdatav2.RollbackTableOptions) - rollbackTableOptionsModel.EngineID = core.StringPtr("testString") - rollbackTableOptionsModel.CatalogID = core.StringPtr("testString") - rollbackTableOptionsModel.SchemaID = core.StringPtr("testString") - rollbackTableOptionsModel.TableID = core.StringPtr("testString") - rollbackTableOptionsModel.SnapshotID = core.StringPtr("testString") - rollbackTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - rollbackTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentAssetsByIdOptions model + getSalIntegrationEnrichmentAssetsByIdOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentAssetsByIdOptions) + getSalIntegrationEnrichmentAssetsByIdOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.ID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.RollbackTable(rollbackTableOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke RollbackTable with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentAssetsByID with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RollbackTableOptions model - rollbackTableOptionsModel := new(watsonxdatav2.RollbackTableOptions) - rollbackTableOptionsModel.EngineID = core.StringPtr("testString") - rollbackTableOptionsModel.CatalogID = core.StringPtr("testString") - rollbackTableOptionsModel.SchemaID = core.StringPtr("testString") - rollbackTableOptionsModel.TableID = core.StringPtr("testString") - rollbackTableOptionsModel.SnapshotID = core.StringPtr("testString") - rollbackTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - rollbackTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentAssetsByIdOptions model + getSalIntegrationEnrichmentAssetsByIdOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentAssetsByIdOptions) + getSalIntegrationEnrichmentAssetsByIdOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.ID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.RollbackTable(rollbackTableOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the RollbackTableOptions model with no property values - rollbackTableOptionsModelNew := new(watsonxdatav2.RollbackTableOptions) + // Construct a second instance of the GetSalIntegrationEnrichmentAssetsByIdOptions model with no property values + getSalIntegrationEnrichmentAssetsByIdOptionsModelNew := new(watsonxdatav3.GetSalIntegrationEnrichmentAssetsByIdOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.RollbackTable(rollbackTableOptionsModelNew) + result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -29390,29 +30727,26 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke RollbackTable successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentAssetsByID successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RollbackTableOptions model - rollbackTableOptionsModel := new(watsonxdatav2.RollbackTableOptions) - rollbackTableOptionsModel.EngineID = core.StringPtr("testString") - rollbackTableOptionsModel.CatalogID = core.StringPtr("testString") - rollbackTableOptionsModel.SchemaID = core.StringPtr("testString") - rollbackTableOptionsModel.TableID = core.StringPtr("testString") - rollbackTableOptionsModel.SnapshotID = core.StringPtr("testString") - rollbackTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - rollbackTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentAssetsByIdOptions model + getSalIntegrationEnrichmentAssetsByIdOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentAssetsByIdOptions) + getSalIntegrationEnrichmentAssetsByIdOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.ID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.RollbackTable(rollbackTableOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentAssetsByID(getSalIntegrationEnrichmentAssetsByIdOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -29424,16 +30758,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateSyncCatalog(updateSyncCatalogOptions *UpdateSyncCatalogOptions) - Operation response error`, func() { - updateSyncCatalogPath := "/catalogs/testString/sync" + Describe(`GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptions *GetSalIntegrationEnrichmentGlobalSettingsOptions) - Operation response error`, func() { + getSalIntegrationEnrichmentGlobalSettingsPath := "/v3/sal_integration/enrichment/global_settings" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSyncCatalogPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentGlobalSettingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -29441,36 +30775,27 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateSyncCatalog with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentGlobalSettings with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SyncCatalogs model - syncCatalogsModel := new(watsonxdatav2.SyncCatalogs) - syncCatalogsModel.AutoAddNewTables = core.BoolPtr(true) - syncCatalogsModel.SyncIcebergMd = core.BoolPtr(true) - syncCatalogsModelAsPatch, asPatchErr := syncCatalogsModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSyncCatalogOptions model - updateSyncCatalogOptionsModel := new(watsonxdatav2.UpdateSyncCatalogOptions) - updateSyncCatalogOptionsModel.CatalogID = core.StringPtr("testString") - updateSyncCatalogOptionsModel.Body = syncCatalogsModelAsPatch - updateSyncCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSyncCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentGlobalSettingsOptions model + getSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentGlobalSettingsOptions) + getSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -29480,32 +30805,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateSyncCatalog(updateSyncCatalogOptions *UpdateSyncCatalogOptions)`, func() { - updateSyncCatalogPath := "/catalogs/testString/sync" + Describe(`GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptions *GetSalIntegrationEnrichmentGlobalSettingsOptions)`, func() { + getSalIntegrationEnrichmentGlobalSettingsPath := "/v3/sal_integration/enrichment/global_settings" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSyncCatalogPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentGlobalSettingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -29515,11 +30824,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + fmt.Fprintf(res, "%s", `{"expansion": {"description": true, "description_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name": true, "name_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) })) }) - It(`Invoke UpdateSyncCatalog successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentGlobalSettings successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -29527,30 +30836,21 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the SyncCatalogs model - syncCatalogsModel := new(watsonxdatav2.SyncCatalogs) - syncCatalogsModel.AutoAddNewTables = core.BoolPtr(true) - syncCatalogsModel.SyncIcebergMd = core.BoolPtr(true) - syncCatalogsModelAsPatch, asPatchErr := syncCatalogsModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSyncCatalogOptions model - updateSyncCatalogOptionsModel := new(watsonxdatav2.UpdateSyncCatalogOptions) - updateSyncCatalogOptionsModel.CatalogID = core.StringPtr("testString") - updateSyncCatalogOptionsModel.Body = syncCatalogsModelAsPatch - updateSyncCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSyncCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentGlobalSettingsOptions model + getSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentGlobalSettingsOptions) + getSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateSyncCatalogWithContext(ctx, updateSyncCatalogOptionsModel) + _, _, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettingsWithContext(ctx, getSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -29558,7 +30858,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateSyncCatalogWithContext(ctx, updateSyncCatalogOptionsModel) + _, _, operationErr = watsonxDataService.GetSalIntegrationEnrichmentGlobalSettingsWithContext(ctx, getSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -29572,35 +30872,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateSyncCatalogPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentGlobalSettingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + fmt.Fprintf(res, "%s", `{"expansion": {"description": true, "description_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name": true, "name_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) })) }) - It(`Invoke UpdateSyncCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentGlobalSettings successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -29608,68 +30892,43 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateSyncCatalog(nil) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the SyncCatalogs model - syncCatalogsModel := new(watsonxdatav2.SyncCatalogs) - syncCatalogsModel.AutoAddNewTables = core.BoolPtr(true) - syncCatalogsModel.SyncIcebergMd = core.BoolPtr(true) - syncCatalogsModelAsPatch, asPatchErr := syncCatalogsModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSyncCatalogOptions model - updateSyncCatalogOptionsModel := new(watsonxdatav2.UpdateSyncCatalogOptions) - updateSyncCatalogOptionsModel.CatalogID = core.StringPtr("testString") - updateSyncCatalogOptionsModel.Body = syncCatalogsModelAsPatch - updateSyncCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSyncCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentGlobalSettingsOptions model + getSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentGlobalSettingsOptions) + getSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateSyncCatalog with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentGlobalSettings with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SyncCatalogs model - syncCatalogsModel := new(watsonxdatav2.SyncCatalogs) - syncCatalogsModel.AutoAddNewTables = core.BoolPtr(true) - syncCatalogsModel.SyncIcebergMd = core.BoolPtr(true) - syncCatalogsModelAsPatch, asPatchErr := syncCatalogsModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSyncCatalogOptions model - updateSyncCatalogOptionsModel := new(watsonxdatav2.UpdateSyncCatalogOptions) - updateSyncCatalogOptionsModel.CatalogID = core.StringPtr("testString") - updateSyncCatalogOptionsModel.Body = syncCatalogsModelAsPatch - updateSyncCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSyncCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentGlobalSettingsOptions model + getSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentGlobalSettingsOptions) + getSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateSyncCatalogOptions model with no property values - updateSyncCatalogOptionsModelNew := new(watsonxdatav2.UpdateSyncCatalogOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -29684,30 +30943,21 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateSyncCatalog successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentGlobalSettings successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the SyncCatalogs model - syncCatalogsModel := new(watsonxdatav2.SyncCatalogs) - syncCatalogsModel.AutoAddNewTables = core.BoolPtr(true) - syncCatalogsModel.SyncIcebergMd = core.BoolPtr(true) - syncCatalogsModelAsPatch, asPatchErr := syncCatalogsModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateSyncCatalogOptions model - updateSyncCatalogOptionsModel := new(watsonxdatav2.UpdateSyncCatalogOptions) - updateSyncCatalogOptionsModel.CatalogID = core.StringPtr("testString") - updateSyncCatalogOptionsModel.Body = syncCatalogsModelAsPatch - updateSyncCatalogOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateSyncCatalogOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentGlobalSettingsOptions model + getSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentGlobalSettingsOptions) + getSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdateSyncCatalog(updateSyncCatalogOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentGlobalSettings(getSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -29719,16 +30969,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListMilvusServices(listMilvusServicesOptions *ListMilvusServicesOptions) - Operation response error`, func() { - listMilvusServicesPath := "/milvus_services" + Describe(`ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptions *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) - Operation response error`, func() { + replaceSalIntegrationEnrichmentGlobalSettingsPath := "/v3/sal_integration/enrichment/global_settings" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listMilvusServicesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(replaceSalIntegrationEnrichmentGlobalSettingsPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -29736,27 +30986,57 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListMilvusServices with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ReplaceSalIntegrationEnrichmentGlobalSettings with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListMilvusServicesOptions model - listMilvusServicesOptionsModel := new(watsonxdatav2.ListMilvusServicesOptions) - listMilvusServicesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusServicesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SalEnrichmentSettingsExpansionDescriptionConfiguration model + salEnrichmentSettingsExpansionDescriptionConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) + + // Construct an instance of the SalEnrichmentSettingsExpansionNameConfiguration model + salEnrichmentSettingsExpansionNameConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration) + salEnrichmentSettingsExpansionNameConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) + salEnrichmentSettingsExpansionNameConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) + + // Construct an instance of the SalEnrichmentSettingsExpansion model + salEnrichmentSettingsExpansionModel := new(watsonxdatav3.SalEnrichmentSettingsExpansion) + salEnrichmentSettingsExpansionModel.Description = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.DescriptionConfiguration = salEnrichmentSettingsExpansionDescriptionConfigurationModel + salEnrichmentSettingsExpansionModel.Name = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.NameConfiguration = salEnrichmentSettingsExpansionNameConfigurationModel + + // Construct an instance of the SalEnrichmentSettingsTermAssignment model + salEnrichmentSettingsTermAssignmentModel := new(watsonxdatav3.SalEnrichmentSettingsTermAssignment) + salEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) + salEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) + + // Construct an instance of the ReplaceSalIntegrationEnrichmentGlobalSettingsOptions model + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav3.ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Expansion = salEnrichmentSettingsExpansionModel + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment = salEnrichmentSettingsTermAssignmentModel + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) + result, response, operationErr := watsonxDataService.ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) + result, response, operationErr = watsonxDataService.ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -29766,16 +31046,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListMilvusServices(listMilvusServicesOptions *ListMilvusServicesOptions)`, func() { - listMilvusServicesPath := "/milvus_services" + Describe(`ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptions *ReplaceSalIntegrationEnrichmentGlobalSettingsOptions)`, func() { + replaceSalIntegrationEnrichmentGlobalSettingsPath := "/v3/sal_integration/enrichment/global_settings" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listMilvusServicesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(replaceSalIntegrationEnrichmentGlobalSettingsPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -29785,11 +31081,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"milvus_services": [{"access_key": "Sample bucket access key", "actions": ["Actions"], "bucket_name": "Sample bucket name", "bucket_type": "Sample bucket type", "created_by": "@.com", "created_on": 9, "description": "milvus service for running sql queries", "endpoint": "Sample bucket type", "grpc_host": "example.grpc.host", "grpc_port": 8, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 9, "origin": "native", "root_path": "Sample path", "secret_key": "Sample bucket secret access key", "service_display_name": "sampleService", "service_id": "sampleService123", "status": "running", "status_code": 10, "tags": ["Tags"], "tshirt_size": "small", "type": "milvus"}]}`) + fmt.Fprintf(res, "%s", `{"expansion": {"description": true, "description_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name": true, "name_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) })) }) - It(`Invoke ListMilvusServices successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ReplaceSalIntegrationEnrichmentGlobalSettings successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -29797,21 +31093,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListMilvusServicesOptions model - listMilvusServicesOptionsModel := new(watsonxdatav2.ListMilvusServicesOptions) - listMilvusServicesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusServicesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SalEnrichmentSettingsExpansionDescriptionConfiguration model + salEnrichmentSettingsExpansionDescriptionConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) + + // Construct an instance of the SalEnrichmentSettingsExpansionNameConfiguration model + salEnrichmentSettingsExpansionNameConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration) + salEnrichmentSettingsExpansionNameConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) + salEnrichmentSettingsExpansionNameConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) + + // Construct an instance of the SalEnrichmentSettingsExpansion model + salEnrichmentSettingsExpansionModel := new(watsonxdatav3.SalEnrichmentSettingsExpansion) + salEnrichmentSettingsExpansionModel.Description = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.DescriptionConfiguration = salEnrichmentSettingsExpansionDescriptionConfigurationModel + salEnrichmentSettingsExpansionModel.Name = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.NameConfiguration = salEnrichmentSettingsExpansionNameConfigurationModel + + // Construct an instance of the SalEnrichmentSettingsTermAssignment model + salEnrichmentSettingsTermAssignmentModel := new(watsonxdatav3.SalEnrichmentSettingsTermAssignment) + salEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) + salEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) + + // Construct an instance of the ReplaceSalIntegrationEnrichmentGlobalSettingsOptions model + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav3.ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Expansion = salEnrichmentSettingsExpansionModel + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment = salEnrichmentSettingsTermAssignmentModel + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListMilvusServicesWithContext(ctx, listMilvusServicesOptionsModel) + _, _, operationErr := watsonxDataService.ReplaceSalIntegrationEnrichmentGlobalSettingsWithContext(ctx, replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) + result, response, operationErr := watsonxDataService.ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -29819,7 +31145,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListMilvusServicesWithContext(ctx, listMilvusServicesOptionsModel) + _, _, operationErr = watsonxDataService.ReplaceSalIntegrationEnrichmentGlobalSettingsWithContext(ctx, replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -29833,19 +31159,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listMilvusServicesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(replaceSalIntegrationEnrichmentGlobalSettingsPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"milvus_services": [{"access_key": "Sample bucket access key", "actions": ["Actions"], "bucket_name": "Sample bucket name", "bucket_type": "Sample bucket type", "created_by": "@.com", "created_on": 9, "description": "milvus service for running sql queries", "endpoint": "Sample bucket type", "grpc_host": "example.grpc.host", "grpc_port": 8, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 9, "origin": "native", "root_path": "Sample path", "secret_key": "Sample bucket secret access key", "service_display_name": "sampleService", "service_id": "sampleService123", "status": "running", "status_code": 10, "tags": ["Tags"], "tshirt_size": "small", "type": "milvus"}]}`) + fmt.Fprintf(res, "%s", `{"expansion": {"description": true, "description_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name": true, "name_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) })) }) - It(`Invoke ListMilvusServices successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ReplaceSalIntegrationEnrichmentGlobalSettings successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -29853,43 +31195,110 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListMilvusServices(nil) + result, response, operationErr := watsonxDataService.ReplaceSalIntegrationEnrichmentGlobalSettings(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListMilvusServicesOptions model - listMilvusServicesOptionsModel := new(watsonxdatav2.ListMilvusServicesOptions) - listMilvusServicesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusServicesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SalEnrichmentSettingsExpansionDescriptionConfiguration model + salEnrichmentSettingsExpansionDescriptionConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) + + // Construct an instance of the SalEnrichmentSettingsExpansionNameConfiguration model + salEnrichmentSettingsExpansionNameConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration) + salEnrichmentSettingsExpansionNameConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) + salEnrichmentSettingsExpansionNameConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) + + // Construct an instance of the SalEnrichmentSettingsExpansion model + salEnrichmentSettingsExpansionModel := new(watsonxdatav3.SalEnrichmentSettingsExpansion) + salEnrichmentSettingsExpansionModel.Description = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.DescriptionConfiguration = salEnrichmentSettingsExpansionDescriptionConfigurationModel + salEnrichmentSettingsExpansionModel.Name = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.NameConfiguration = salEnrichmentSettingsExpansionNameConfigurationModel + + // Construct an instance of the SalEnrichmentSettingsTermAssignment model + salEnrichmentSettingsTermAssignmentModel := new(watsonxdatav3.SalEnrichmentSettingsTermAssignment) + salEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) + salEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) + + // Construct an instance of the ReplaceSalIntegrationEnrichmentGlobalSettingsOptions model + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav3.ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Expansion = salEnrichmentSettingsExpansionModel + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment = salEnrichmentSettingsTermAssignmentModel + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) + result, response, operationErr = watsonxDataService.ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListMilvusServices with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ReplaceSalIntegrationEnrichmentGlobalSettings with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListMilvusServicesOptions model - listMilvusServicesOptionsModel := new(watsonxdatav2.ListMilvusServicesOptions) - listMilvusServicesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusServicesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SalEnrichmentSettingsExpansionDescriptionConfiguration model + salEnrichmentSettingsExpansionDescriptionConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) + + // Construct an instance of the SalEnrichmentSettingsExpansionNameConfiguration model + salEnrichmentSettingsExpansionNameConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration) + salEnrichmentSettingsExpansionNameConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) + salEnrichmentSettingsExpansionNameConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) + + // Construct an instance of the SalEnrichmentSettingsExpansion model + salEnrichmentSettingsExpansionModel := new(watsonxdatav3.SalEnrichmentSettingsExpansion) + salEnrichmentSettingsExpansionModel.Description = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.DescriptionConfiguration = salEnrichmentSettingsExpansionDescriptionConfigurationModel + salEnrichmentSettingsExpansionModel.Name = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.NameConfiguration = salEnrichmentSettingsExpansionNameConfigurationModel + + // Construct an instance of the SalEnrichmentSettingsTermAssignment model + salEnrichmentSettingsTermAssignmentModel := new(watsonxdatav3.SalEnrichmentSettingsTermAssignment) + salEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) + salEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) + + // Construct an instance of the ReplaceSalIntegrationEnrichmentGlobalSettingsOptions model + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav3.ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Expansion = salEnrichmentSettingsExpansionModel + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment = salEnrichmentSettingsTermAssignmentModel + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) + result, response, operationErr := watsonxDataService.ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the ReplaceSalIntegrationEnrichmentGlobalSettingsOptions model with no property values + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModelNew := new(watsonxdatav3.ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -29904,21 +31313,51 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListMilvusServices successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ReplaceSalIntegrationEnrichmentGlobalSettings successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListMilvusServicesOptions model - listMilvusServicesOptionsModel := new(watsonxdatav2.ListMilvusServicesOptions) - listMilvusServicesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusServicesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SalEnrichmentSettingsExpansionDescriptionConfiguration model + salEnrichmentSettingsExpansionDescriptionConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) + + // Construct an instance of the SalEnrichmentSettingsExpansionNameConfiguration model + salEnrichmentSettingsExpansionNameConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration) + salEnrichmentSettingsExpansionNameConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) + salEnrichmentSettingsExpansionNameConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) + + // Construct an instance of the SalEnrichmentSettingsExpansion model + salEnrichmentSettingsExpansionModel := new(watsonxdatav3.SalEnrichmentSettingsExpansion) + salEnrichmentSettingsExpansionModel.Description = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.DescriptionConfiguration = salEnrichmentSettingsExpansionDescriptionConfigurationModel + salEnrichmentSettingsExpansionModel.Name = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.NameConfiguration = salEnrichmentSettingsExpansionNameConfigurationModel + + // Construct an instance of the SalEnrichmentSettingsTermAssignment model + salEnrichmentSettingsTermAssignmentModel := new(watsonxdatav3.SalEnrichmentSettingsTermAssignment) + salEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) + salEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) + + // Construct an instance of the ReplaceSalIntegrationEnrichmentGlobalSettingsOptions model + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel := new(watsonxdatav3.ReplaceSalIntegrationEnrichmentGlobalSettingsOptions) + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Expansion = salEnrichmentSettingsExpansionModel + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment = salEnrichmentSettingsTermAssignmentModel + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListMilvusServices(listMilvusServicesOptionsModel) + result, response, operationErr := watsonxDataService.ReplaceSalIntegrationEnrichmentGlobalSettings(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -29930,52 +31369,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateMilvusService(createMilvusServiceOptions *CreateMilvusServiceOptions) - Operation response error`, func() { - createMilvusServicePath := "/milvus_services" + Describe(`ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptions *ListSalIntegrationEnrichmentJobsOptions) - Operation response error`, func() { + listSalIntegrationEnrichmentJobsPath := "/v3/sal_integration/enrichment/jobs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentJobsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateMilvusService with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentJobs with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServiceOptions model - createMilvusServiceOptionsModel := new(watsonxdatav2.CreateMilvusServiceOptions) - createMilvusServiceOptionsModel.BucketName = core.StringPtr("Sample bucket name") - createMilvusServiceOptionsModel.Origin = core.StringPtr("native") - createMilvusServiceOptionsModel.RootPath = core.StringPtr("Sample path") - createMilvusServiceOptionsModel.ServiceDisplayName = core.StringPtr("sampleService") - createMilvusServiceOptionsModel.BucketType = core.StringPtr("Sample bucket type") - createMilvusServiceOptionsModel.Description = core.StringPtr("milvus service for running sql queries") - createMilvusServiceOptionsModel.Tags = []string{"tag1", "tag2"} - createMilvusServiceOptionsModel.TshirtSize = core.StringPtr("small") - createMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentJobsOptions model + listSalIntegrationEnrichmentJobsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentJobsOptions) + listSalIntegrationEnrichmentJobsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) + result, response, operationErr = watsonxDataService.ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -29985,46 +31418,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateMilvusService(createMilvusServiceOptions *CreateMilvusServiceOptions)`, func() { - createMilvusServicePath := "/milvus_services" + Describe(`ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptions *ListSalIntegrationEnrichmentJobsOptions)`, func() { + listSalIntegrationEnrichmentJobsPath := "/v3/sal_integration/enrichment/jobs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentJobsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"access_key": "Sample bucket access key", "actions": ["Actions"], "bucket_name": "Sample bucket name", "bucket_type": "Sample bucket type", "created_by": "@.com", "created_on": 9, "description": "milvus service for running sql queries", "endpoint": "Sample bucket type", "grpc_host": "example.grpc.host", "grpc_port": 8, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 9, "origin": "native", "root_path": "Sample path", "secret_key": "Sample bucket secret access key", "service_display_name": "sampleService", "service_id": "sampleService123", "status": "running", "status_code": 10, "tags": ["Tags"], "tshirt_size": "small", "type": "milvus"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"jobs": ["Jobs"]}`) })) }) - It(`Invoke CreateMilvusService successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentJobs successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -30032,29 +31450,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateMilvusServiceOptions model - createMilvusServiceOptionsModel := new(watsonxdatav2.CreateMilvusServiceOptions) - createMilvusServiceOptionsModel.BucketName = core.StringPtr("Sample bucket name") - createMilvusServiceOptionsModel.Origin = core.StringPtr("native") - createMilvusServiceOptionsModel.RootPath = core.StringPtr("Sample path") - createMilvusServiceOptionsModel.ServiceDisplayName = core.StringPtr("sampleService") - createMilvusServiceOptionsModel.BucketType = core.StringPtr("Sample bucket type") - createMilvusServiceOptionsModel.Description = core.StringPtr("milvus service for running sql queries") - createMilvusServiceOptionsModel.Tags = []string{"tag1", "tag2"} - createMilvusServiceOptionsModel.TshirtSize = core.StringPtr("small") - createMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentJobsOptions model + listSalIntegrationEnrichmentJobsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentJobsOptions) + listSalIntegrationEnrichmentJobsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateMilvusServiceWithContext(ctx, createMilvusServiceOptionsModel) + _, _, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobsWithContext(ctx, listSalIntegrationEnrichmentJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -30062,7 +31473,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateMilvusServiceWithContext(ctx, createMilvusServiceOptionsModel) + _, _, operationErr = watsonxDataService.ListSalIntegrationEnrichmentJobsWithContext(ctx, listSalIntegrationEnrichmentJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -30076,35 +31487,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentJobsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"access_key": "Sample bucket access key", "actions": ["Actions"], "bucket_name": "Sample bucket name", "bucket_type": "Sample bucket type", "created_by": "@.com", "created_on": 9, "description": "milvus service for running sql queries", "endpoint": "Sample bucket type", "grpc_host": "example.grpc.host", "grpc_port": 8, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 9, "origin": "native", "root_path": "Sample path", "secret_key": "Sample bucket secret access key", "service_display_name": "sampleService", "service_id": "sampleService123", "status": "running", "status_code": 10, "tags": ["Tags"], "tshirt_size": "small", "type": "milvus"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"jobs": ["Jobs"]}`) })) }) - It(`Invoke CreateMilvusService successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentJobs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -30112,63 +31508,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateMilvusService(nil) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateMilvusServiceOptions model - createMilvusServiceOptionsModel := new(watsonxdatav2.CreateMilvusServiceOptions) - createMilvusServiceOptionsModel.BucketName = core.StringPtr("Sample bucket name") - createMilvusServiceOptionsModel.Origin = core.StringPtr("native") - createMilvusServiceOptionsModel.RootPath = core.StringPtr("Sample path") - createMilvusServiceOptionsModel.ServiceDisplayName = core.StringPtr("sampleService") - createMilvusServiceOptionsModel.BucketType = core.StringPtr("Sample bucket type") - createMilvusServiceOptionsModel.Description = core.StringPtr("milvus service for running sql queries") - createMilvusServiceOptionsModel.Tags = []string{"tag1", "tag2"} - createMilvusServiceOptionsModel.TshirtSize = core.StringPtr("small") - createMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentJobsOptions model + listSalIntegrationEnrichmentJobsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentJobsOptions) + listSalIntegrationEnrichmentJobsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) + result, response, operationErr = watsonxDataService.ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateMilvusService with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentJobs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServiceOptions model - createMilvusServiceOptionsModel := new(watsonxdatav2.CreateMilvusServiceOptions) - createMilvusServiceOptionsModel.BucketName = core.StringPtr("Sample bucket name") - createMilvusServiceOptionsModel.Origin = core.StringPtr("native") - createMilvusServiceOptionsModel.RootPath = core.StringPtr("Sample path") - createMilvusServiceOptionsModel.ServiceDisplayName = core.StringPtr("sampleService") - createMilvusServiceOptionsModel.BucketType = core.StringPtr("Sample bucket type") - createMilvusServiceOptionsModel.Description = core.StringPtr("milvus service for running sql queries") - createMilvusServiceOptionsModel.Tags = []string{"tag1", "tag2"} - createMilvusServiceOptionsModel.TshirtSize = core.StringPtr("small") - createMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentJobsOptions model + listSalIntegrationEnrichmentJobsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentJobsOptions) + listSalIntegrationEnrichmentJobsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateMilvusServiceOptions model with no property values - createMilvusServiceOptionsModelNew := new(watsonxdatav2.CreateMilvusServiceOptions) + // Construct a second instance of the ListSalIntegrationEnrichmentJobsOptions model with no property values + listSalIntegrationEnrichmentJobsOptionsModelNew := new(watsonxdatav3.ListSalIntegrationEnrichmentJobsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModelNew) + result, response, operationErr = watsonxDataService.ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -30183,32 +31565,25 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateMilvusService successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentJobs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServiceOptions model - createMilvusServiceOptionsModel := new(watsonxdatav2.CreateMilvusServiceOptions) - createMilvusServiceOptionsModel.BucketName = core.StringPtr("Sample bucket name") - createMilvusServiceOptionsModel.Origin = core.StringPtr("native") - createMilvusServiceOptionsModel.RootPath = core.StringPtr("Sample path") - createMilvusServiceOptionsModel.ServiceDisplayName = core.StringPtr("sampleService") - createMilvusServiceOptionsModel.BucketType = core.StringPtr("Sample bucket type") - createMilvusServiceOptionsModel.Description = core.StringPtr("milvus service for running sql queries") - createMilvusServiceOptionsModel.Tags = []string{"tag1", "tag2"} - createMilvusServiceOptionsModel.TshirtSize = core.StringPtr("small") - createMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentJobsOptions model + listSalIntegrationEnrichmentJobsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentJobsOptions) + listSalIntegrationEnrichmentJobsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateMilvusService(createMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobs(listSalIntegrationEnrichmentJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -30220,45 +31595,47 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetMilvusService(getMilvusServiceOptions *GetMilvusServiceOptions) - Operation response error`, func() { - getMilvusServicePath := "/milvus_services/testString" + Describe(`ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptions *ListSalIntegrationEnrichmentJobRunsOptions) - Operation response error`, func() { + listSalIntegrationEnrichmentJobRunsPath := "/v3/sal_integration/enrichment/jobs/testString/runs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getMilvusServicePath)) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentJobRunsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetMilvusService with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentJobRuns with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetMilvusServiceOptions model - getMilvusServiceOptionsModel := new(watsonxdatav2.GetMilvusServiceOptions) - getMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - getMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - getMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentJobRunsOptions model + listSalIntegrationEnrichmentJobRunsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentJobRunsOptions) + listSalIntegrationEnrichmentJobRunsOptionsModel.JobID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) + result, response, operationErr = watsonxDataService.ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -30268,30 +31645,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetMilvusService(getMilvusServiceOptions *GetMilvusServiceOptions)`, func() { - getMilvusServicePath := "/milvus_services/testString" + Describe(`ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptions *ListSalIntegrationEnrichmentJobRunsOptions)`, func() { + listSalIntegrationEnrichmentJobRunsPath := "/v3/sal_integration/enrichment/jobs/testString/runs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getMilvusServicePath)) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentJobRunsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_key": "Sample bucket access key", "actions": ["Actions"], "bucket_name": "Sample bucket name", "bucket_type": "Sample bucket type", "created_by": "@.com", "created_on": 9, "description": "milvus service for running sql queries", "endpoint": "Sample bucket type", "grpc_host": "example.grpc.host", "grpc_port": 8, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 9, "origin": "native", "root_path": "Sample path", "secret_key": "Sample bucket secret access key", "service_display_name": "sampleService", "service_id": "sampleService123", "status": "running", "status_code": 10, "tags": ["Tags"], "tshirt_size": "small", "type": "milvus"}`) + fmt.Fprintf(res, "%s", `{"runs": ["Runs"]}`) })) }) - It(`Invoke GetMilvusService successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentJobRuns successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -30299,22 +31677,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetMilvusServiceOptions model - getMilvusServiceOptionsModel := new(watsonxdatav2.GetMilvusServiceOptions) - getMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - getMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - getMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentJobRunsOptions model + listSalIntegrationEnrichmentJobRunsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentJobRunsOptions) + listSalIntegrationEnrichmentJobRunsOptionsModel.JobID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetMilvusServiceWithContext(ctx, getMilvusServiceOptionsModel) + _, _, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobRunsWithContext(ctx, listSalIntegrationEnrichmentJobRunsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -30322,7 +31701,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetMilvusServiceWithContext(ctx, getMilvusServiceOptionsModel) + _, _, operationErr = watsonxDataService.ListSalIntegrationEnrichmentJobRunsWithContext(ctx, listSalIntegrationEnrichmentJobRunsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -30336,19 +31715,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getMilvusServicePath)) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentJobRunsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_key": "Sample bucket access key", "actions": ["Actions"], "bucket_name": "Sample bucket name", "bucket_type": "Sample bucket type", "created_by": "@.com", "created_on": 9, "description": "milvus service for running sql queries", "endpoint": "Sample bucket type", "grpc_host": "example.grpc.host", "grpc_port": 8, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 9, "origin": "native", "root_path": "Sample path", "secret_key": "Sample bucket secret access key", "service_display_name": "sampleService", "service_id": "sampleService123", "status": "running", "status_code": 10, "tags": ["Tags"], "tshirt_size": "small", "type": "milvus"}`) + fmt.Fprintf(res, "%s", `{"runs": ["Runs"]}`) })) }) - It(`Invoke GetMilvusService successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentJobRuns successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -30356,49 +31736,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetMilvusService(nil) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobRuns(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetMilvusServiceOptions model - getMilvusServiceOptionsModel := new(watsonxdatav2.GetMilvusServiceOptions) - getMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - getMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - getMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentJobRunsOptions model + listSalIntegrationEnrichmentJobRunsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentJobRunsOptions) + listSalIntegrationEnrichmentJobRunsOptionsModel.JobID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) + result, response, operationErr = watsonxDataService.ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetMilvusService with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentJobRuns with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetMilvusServiceOptions model - getMilvusServiceOptionsModel := new(watsonxdatav2.GetMilvusServiceOptions) - getMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - getMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - getMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentJobRunsOptions model + listSalIntegrationEnrichmentJobRunsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentJobRunsOptions) + listSalIntegrationEnrichmentJobRunsOptionsModel.JobID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetMilvusServiceOptions model with no property values - getMilvusServiceOptionsModelNew := new(watsonxdatav2.GetMilvusServiceOptions) + // Construct a second instance of the ListSalIntegrationEnrichmentJobRunsOptions model with no property values + listSalIntegrationEnrichmentJobRunsOptionsModelNew := new(watsonxdatav3.ListSalIntegrationEnrichmentJobRunsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetMilvusService(getMilvusServiceOptionsModelNew) + result, response, operationErr = watsonxDataService.ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -30416,22 +31798,23 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetMilvusService successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentJobRuns successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetMilvusServiceOptions model - getMilvusServiceOptionsModel := new(watsonxdatav2.GetMilvusServiceOptions) - getMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - getMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - getMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentJobRunsOptions model + listSalIntegrationEnrichmentJobRunsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentJobRunsOptions) + listSalIntegrationEnrichmentJobRunsOptionsModel.JobID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetMilvusService(getMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentJobRuns(listSalIntegrationEnrichmentJobRunsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -30443,126 +31826,48 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteMilvusService(deleteMilvusServiceOptions *DeleteMilvusServiceOptions)`, func() { - deleteMilvusServicePath := "/milvus_services/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteMilvusServicePath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteMilvusService successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteMilvusService(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteMilvusServiceOptions model - deleteMilvusServiceOptionsModel := new(watsonxdatav2.DeleteMilvusServiceOptions) - deleteMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - deleteMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteMilvusService(deleteMilvusServiceOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteMilvusService with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeleteMilvusServiceOptions model - deleteMilvusServiceOptionsModel := new(watsonxdatav2.DeleteMilvusServiceOptions) - deleteMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - deleteMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteMilvusService(deleteMilvusServiceOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteMilvusServiceOptions model with no property values - deleteMilvusServiceOptionsModelNew := new(watsonxdatav2.DeleteMilvusServiceOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteMilvusService(deleteMilvusServiceOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`UpdateMilvusService(updateMilvusServiceOptions *UpdateMilvusServiceOptions) - Operation response error`, func() { - updateMilvusServicePath := "/milvus_services/testString" + Describe(`GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptions *GetSalIntegrationEnrichmentJobRunLogsOptions) - Operation response error`, func() { + getSalIntegrationEnrichmentJobRunLogsPath := "/v3/sal_integration/enrichment/jobs/testString/runs/testString/logs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServicePath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobRunLogsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateMilvusService with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentJobRunLogs with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the MilvusServicePatch model - milvusServicePatchModel := new(watsonxdatav2.MilvusServicePatch) - milvusServicePatchModel.Description = core.StringPtr("updated description for milvus service") - milvusServicePatchModel.ServiceDisplayName = core.StringPtr("sampleService") - milvusServicePatchModel.Tags = []string{"tag1", "tag2"} - milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateMilvusServiceOptions model - updateMilvusServiceOptionsModel := new(watsonxdatav2.UpdateMilvusServiceOptions) - updateMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - updateMilvusServiceOptionsModel.Body = milvusServicePatchModelAsPatch - updateMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model + getSalIntegrationEnrichmentJobRunLogsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentJobRunLogsOptions) + getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.RunID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -30572,46 +31877,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateMilvusService(updateMilvusServiceOptions *UpdateMilvusServiceOptions)`, func() { - updateMilvusServicePath := "/milvus_services/testString" + Describe(`GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptions *GetSalIntegrationEnrichmentJobRunLogsOptions)`, func() { + getSalIntegrationEnrichmentJobRunLogsPath := "/v3/sal_integration/enrichment/jobs/testString/runs/testString/logs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServicePath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobRunLogsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_key": "Sample bucket access key", "actions": ["Actions"], "bucket_name": "Sample bucket name", "bucket_type": "Sample bucket type", "created_by": "@.com", "created_on": 9, "description": "milvus service for running sql queries", "endpoint": "Sample bucket type", "grpc_host": "example.grpc.host", "grpc_port": 8, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 9, "origin": "native", "root_path": "Sample path", "secret_key": "Sample bucket secret access key", "service_display_name": "sampleService", "service_id": "sampleService123", "status": "running", "status_code": 10, "tags": ["Tags"], "tshirt_size": "small", "type": "milvus"}`) + fmt.Fprintf(res, "%s", `{"results": ["Results"], "total_count": 12}`) })) }) - It(`Invoke UpdateMilvusService successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentJobRunLogs successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -30619,31 +31909,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the MilvusServicePatch model - milvusServicePatchModel := new(watsonxdatav2.MilvusServicePatch) - milvusServicePatchModel.Description = core.StringPtr("updated description for milvus service") - milvusServicePatchModel.ServiceDisplayName = core.StringPtr("sampleService") - milvusServicePatchModel.Tags = []string{"tag1", "tag2"} - milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateMilvusServiceOptions model - updateMilvusServiceOptionsModel := new(watsonxdatav2.UpdateMilvusServiceOptions) - updateMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - updateMilvusServiceOptionsModel.Body = milvusServicePatchModelAsPatch - updateMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model + getSalIntegrationEnrichmentJobRunLogsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentJobRunLogsOptions) + getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.RunID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateMilvusServiceWithContext(ctx, updateMilvusServiceOptionsModel) + _, _, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogsWithContext(ctx, getSalIntegrationEnrichmentJobRunLogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -30651,7 +31934,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateMilvusServiceWithContext(ctx, updateMilvusServiceOptionsModel) + _, _, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobRunLogsWithContext(ctx, getSalIntegrationEnrichmentJobRunLogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -30665,35 +31948,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServicePath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentJobRunLogsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_key": "Sample bucket access key", "actions": ["Actions"], "bucket_name": "Sample bucket name", "bucket_type": "Sample bucket type", "created_by": "@.com", "created_on": 9, "description": "milvus service for running sql queries", "endpoint": "Sample bucket type", "grpc_host": "example.grpc.host", "grpc_port": 8, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 9, "origin": "native", "root_path": "Sample path", "secret_key": "Sample bucket secret access key", "service_display_name": "sampleService", "service_id": "sampleService123", "status": "running", "status_code": 10, "tags": ["Tags"], "tshirt_size": "small", "type": "milvus"}`) + fmt.Fprintf(res, "%s", `{"results": ["Results"], "total_count": 12}`) })) }) - It(`Invoke UpdateMilvusService successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentJobRunLogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -30701,67 +31969,53 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateMilvusService(nil) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the MilvusServicePatch model - milvusServicePatchModel := new(watsonxdatav2.MilvusServicePatch) - milvusServicePatchModel.Description = core.StringPtr("updated description for milvus service") - milvusServicePatchModel.ServiceDisplayName = core.StringPtr("sampleService") - milvusServicePatchModel.Tags = []string{"tag1", "tag2"} - milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateMilvusServiceOptions model - updateMilvusServiceOptionsModel := new(watsonxdatav2.UpdateMilvusServiceOptions) - updateMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - updateMilvusServiceOptionsModel.Body = milvusServicePatchModelAsPatch - updateMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model + getSalIntegrationEnrichmentJobRunLogsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentJobRunLogsOptions) + getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.RunID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateMilvusService with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentJobRunLogs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the MilvusServicePatch model - milvusServicePatchModel := new(watsonxdatav2.MilvusServicePatch) - milvusServicePatchModel.Description = core.StringPtr("updated description for milvus service") - milvusServicePatchModel.ServiceDisplayName = core.StringPtr("sampleService") - milvusServicePatchModel.Tags = []string{"tag1", "tag2"} - milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateMilvusServiceOptions model - updateMilvusServiceOptionsModel := new(watsonxdatav2.UpdateMilvusServiceOptions) - updateMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - updateMilvusServiceOptionsModel.Body = milvusServicePatchModelAsPatch - updateMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model + getSalIntegrationEnrichmentJobRunLogsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentJobRunLogsOptions) + getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.RunID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateMilvusServiceOptions model with no property values - updateMilvusServiceOptionsModelNew := new(watsonxdatav2.UpdateMilvusServiceOptions) + // Construct a second instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model with no property values + getSalIntegrationEnrichmentJobRunLogsOptionsModelNew := new(watsonxdatav3.GetSalIntegrationEnrichmentJobRunLogsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModelNew) + result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -30779,31 +32033,24 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateMilvusService successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentJobRunLogs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the MilvusServicePatch model - milvusServicePatchModel := new(watsonxdatav2.MilvusServicePatch) - milvusServicePatchModel.Description = core.StringPtr("updated description for milvus service") - milvusServicePatchModel.ServiceDisplayName = core.StringPtr("sampleService") - milvusServicePatchModel.Tags = []string{"tag1", "tag2"} - milvusServicePatchModelAsPatch, asPatchErr := milvusServicePatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateMilvusServiceOptions model - updateMilvusServiceOptionsModel := new(watsonxdatav2.UpdateMilvusServiceOptions) - updateMilvusServiceOptionsModel.ServiceID = core.StringPtr("testString") - updateMilvusServiceOptionsModel.Body = milvusServicePatchModelAsPatch - updateMilvusServiceOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateMilvusServiceOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model + getSalIntegrationEnrichmentJobRunLogsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentJobRunLogsOptions) + getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.RunID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdateMilvusService(updateMilvusServiceOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentJobRunLogs(getSalIntegrationEnrichmentJobRunLogsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -30815,55 +32062,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateMilvusServiceBucket(updateMilvusServiceBucketOptions *UpdateMilvusServiceBucketOptions) - Operation response error`, func() { - updateMilvusServiceBucketPath := "/milvus_services/testString/bucket" + Describe(`GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptions *GetSalIntegrationEnrichmentProjectSettingsOptions) - Operation response error`, func() { + getSalIntegrationEnrichmentProjectSettingsPath := "/v3/sal_integration/enrichment/project_settings" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServiceBucketPath)) - Expect(req.Method).To(Equal("PATCH")) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentProjectSettingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke UpdateMilvusServiceBucket with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentProjectSettings with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the MilvusServiceBucketPatch model - milvusServiceBucketPatchModel := new(watsonxdatav2.MilvusServiceBucketPatch) - milvusServiceBucketPatchModel.BucketName = core.StringPtr("Sample bucket name") - milvusServiceBucketPatchModel.ManagedBy = core.StringPtr("customer") - milvusServiceBucketPatchModel.RootPath = core.StringPtr("Sample path") - milvusServiceBucketPatchModel.TshirtSize = core.StringPtr("small") - milvusServiceBucketPatchModelAsPatch, asPatchErr := milvusServiceBucketPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateMilvusServiceBucketOptions model - updateMilvusServiceBucketOptionsModel := new(watsonxdatav2.UpdateMilvusServiceBucketOptions) - updateMilvusServiceBucketOptionsModel.ServiceID = core.StringPtr("testString") - updateMilvusServiceBucketOptionsModel.Body = milvusServiceBucketPatchModelAsPatch - updateMilvusServiceBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateMilvusServiceBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentProjectSettingsOptions model + getSalIntegrationEnrichmentProjectSettingsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentProjectSettingsOptions) + getSalIntegrationEnrichmentProjectSettingsOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -30873,46 +32111,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`UpdateMilvusServiceBucket(updateMilvusServiceBucketOptions *UpdateMilvusServiceBucketOptions)`, func() { - updateMilvusServiceBucketPath := "/milvus_services/testString/bucket" + Describe(`GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptions *GetSalIntegrationEnrichmentProjectSettingsOptions)`, func() { + getSalIntegrationEnrichmentProjectSettingsPath := "/v3/sal_integration/enrichment/project_settings" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServiceBucketPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentProjectSettingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_key": "Sample bucket access key", "actions": ["Actions"], "bucket_name": "Sample bucket name", "bucket_type": "Sample bucket type", "created_by": "@.com", "created_on": 9, "description": "milvus service for running sql queries", "endpoint": "Sample bucket type", "grpc_host": "example.grpc.host", "grpc_port": 8, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 9, "origin": "native", "root_path": "Sample path", "secret_key": "Sample bucket secret access key", "service_display_name": "sampleService", "service_id": "sampleService123", "status": "running", "status_code": 10, "tags": ["Tags"], "tshirt_size": "small", "type": "milvus"}`) + fmt.Fprintf(res, "%s", `{"expansion": {"description": true, "description_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name": true, "name_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) })) }) - It(`Invoke UpdateMilvusServiceBucket successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentProjectSettings successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -30920,32 +32143,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the MilvusServiceBucketPatch model - milvusServiceBucketPatchModel := new(watsonxdatav2.MilvusServiceBucketPatch) - milvusServiceBucketPatchModel.BucketName = core.StringPtr("Sample bucket name") - milvusServiceBucketPatchModel.ManagedBy = core.StringPtr("customer") - milvusServiceBucketPatchModel.RootPath = core.StringPtr("Sample path") - milvusServiceBucketPatchModel.TshirtSize = core.StringPtr("small") - milvusServiceBucketPatchModelAsPatch, asPatchErr := milvusServiceBucketPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateMilvusServiceBucketOptions model - updateMilvusServiceBucketOptionsModel := new(watsonxdatav2.UpdateMilvusServiceBucketOptions) - updateMilvusServiceBucketOptionsModel.ServiceID = core.StringPtr("testString") - updateMilvusServiceBucketOptionsModel.Body = milvusServiceBucketPatchModelAsPatch - updateMilvusServiceBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateMilvusServiceBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentProjectSettingsOptions model + getSalIntegrationEnrichmentProjectSettingsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentProjectSettingsOptions) + getSalIntegrationEnrichmentProjectSettingsOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.UpdateMilvusServiceBucketWithContext(ctx, updateMilvusServiceBucketOptionsModel) + _, _, operationErr := watsonxDataService.GetSalIntegrationEnrichmentProjectSettingsWithContext(ctx, getSalIntegrationEnrichmentProjectSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -30953,7 +32166,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.UpdateMilvusServiceBucketWithContext(ctx, updateMilvusServiceBucketOptionsModel) + _, _, operationErr = watsonxDataService.GetSalIntegrationEnrichmentProjectSettingsWithContext(ctx, getSalIntegrationEnrichmentProjectSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -30967,35 +32180,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(updateMilvusServiceBucketPath)) - Expect(req.Method).To(Equal("PATCH")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationEnrichmentProjectSettingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"access_key": "Sample bucket access key", "actions": ["Actions"], "bucket_name": "Sample bucket name", "bucket_type": "Sample bucket type", "created_by": "@.com", "created_on": 9, "description": "milvus service for running sql queries", "endpoint": "Sample bucket type", "grpc_host": "example.grpc.host", "grpc_port": 8, "host_name": "sampleMilvus", "https_host": "example.https.host", "https_port": 9, "origin": "native", "root_path": "Sample path", "secret_key": "Sample bucket secret access key", "service_display_name": "sampleService", "service_id": "sampleService123", "status": "running", "status_code": 10, "tags": ["Tags"], "tshirt_size": "small", "type": "milvus"}`) + fmt.Fprintf(res, "%s", `{"expansion": {"description": true, "description_configuration": {"assignment_threshold": 0.14, "suggestion_threshold": 0.9}, "name": true, "name_configuration": {"assignment_threshold": 0.1, "suggestion_threshold": 0.1}}, "term_assignment": {"class_based_assignments": false, "evaluate_negative_assignments": false, "llm_based_assignments": false, "ml_based_assignments_custom": false, "ml_based_assignments_default": false, "name_matching": false, "term_assignment_threshold": 0.3, "term_suggestion_threshold": 0.4}}`) })) }) - It(`Invoke UpdateMilvusServiceBucket successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentProjectSettings successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -31003,69 +32201,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.UpdateMilvusServiceBucket(nil) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentProjectSettings(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the MilvusServiceBucketPatch model - milvusServiceBucketPatchModel := new(watsonxdatav2.MilvusServiceBucketPatch) - milvusServiceBucketPatchModel.BucketName = core.StringPtr("Sample bucket name") - milvusServiceBucketPatchModel.ManagedBy = core.StringPtr("customer") - milvusServiceBucketPatchModel.RootPath = core.StringPtr("Sample path") - milvusServiceBucketPatchModel.TshirtSize = core.StringPtr("small") - milvusServiceBucketPatchModelAsPatch, asPatchErr := milvusServiceBucketPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateMilvusServiceBucketOptions model - updateMilvusServiceBucketOptionsModel := new(watsonxdatav2.UpdateMilvusServiceBucketOptions) - updateMilvusServiceBucketOptionsModel.ServiceID = core.StringPtr("testString") - updateMilvusServiceBucketOptionsModel.Body = milvusServiceBucketPatchModelAsPatch - updateMilvusServiceBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateMilvusServiceBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentProjectSettingsOptions model + getSalIntegrationEnrichmentProjectSettingsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentProjectSettingsOptions) + getSalIntegrationEnrichmentProjectSettingsOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke UpdateMilvusServiceBucket with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentProjectSettings with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the MilvusServiceBucketPatch model - milvusServiceBucketPatchModel := new(watsonxdatav2.MilvusServiceBucketPatch) - milvusServiceBucketPatchModel.BucketName = core.StringPtr("Sample bucket name") - milvusServiceBucketPatchModel.ManagedBy = core.StringPtr("customer") - milvusServiceBucketPatchModel.RootPath = core.StringPtr("Sample path") - milvusServiceBucketPatchModel.TshirtSize = core.StringPtr("small") - milvusServiceBucketPatchModelAsPatch, asPatchErr := milvusServiceBucketPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateMilvusServiceBucketOptions model - updateMilvusServiceBucketOptionsModel := new(watsonxdatav2.UpdateMilvusServiceBucketOptions) - updateMilvusServiceBucketOptionsModel.ServiceID = core.StringPtr("testString") - updateMilvusServiceBucketOptionsModel.Body = milvusServiceBucketPatchModelAsPatch - updateMilvusServiceBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateMilvusServiceBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentProjectSettingsOptions model + getSalIntegrationEnrichmentProjectSettingsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentProjectSettingsOptions) + getSalIntegrationEnrichmentProjectSettingsOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the UpdateMilvusServiceBucketOptions model with no property values - updateMilvusServiceBucketOptionsModelNew := new(watsonxdatav2.UpdateMilvusServiceBucketOptions) + // Construct a second instance of the GetSalIntegrationEnrichmentProjectSettingsOptions model with no property values + getSalIntegrationEnrichmentProjectSettingsOptionsModelNew := new(watsonxdatav3.GetSalIntegrationEnrichmentProjectSettingsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModelNew) + result, response, operationErr = watsonxDataService.GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -31083,32 +32261,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke UpdateMilvusServiceBucket successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationEnrichmentProjectSettings successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the MilvusServiceBucketPatch model - milvusServiceBucketPatchModel := new(watsonxdatav2.MilvusServiceBucketPatch) - milvusServiceBucketPatchModel.BucketName = core.StringPtr("Sample bucket name") - milvusServiceBucketPatchModel.ManagedBy = core.StringPtr("customer") - milvusServiceBucketPatchModel.RootPath = core.StringPtr("Sample path") - milvusServiceBucketPatchModel.TshirtSize = core.StringPtr("small") - milvusServiceBucketPatchModelAsPatch, asPatchErr := milvusServiceBucketPatchModel.AsPatch() - Expect(asPatchErr).To(BeNil()) - - // Construct an instance of the UpdateMilvusServiceBucketOptions model - updateMilvusServiceBucketOptionsModel := new(watsonxdatav2.UpdateMilvusServiceBucketOptions) - updateMilvusServiceBucketOptionsModel.ServiceID = core.StringPtr("testString") - updateMilvusServiceBucketOptionsModel.Body = milvusServiceBucketPatchModelAsPatch - updateMilvusServiceBucketOptionsModel.AuthInstanceID = core.StringPtr("testString") - updateMilvusServiceBucketOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationEnrichmentProjectSettingsOptions model + getSalIntegrationEnrichmentProjectSettingsOptionsModel := new(watsonxdatav3.GetSalIntegrationEnrichmentProjectSettingsOptions) + getSalIntegrationEnrichmentProjectSettingsOptionsModel.ProjectID = core.StringPtr("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.UpdateMilvusServiceBucket(updateMilvusServiceBucketOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationEnrichmentProjectSettings(getSalIntegrationEnrichmentProjectSettingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -31120,63 +32288,211 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListMilvusServiceDatabases(listMilvusServiceDatabasesOptions *ListMilvusServiceDatabasesOptions) - Operation response error`, func() { - listMilvusServiceDatabasesPath := "/milvus_services/testString/databases" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`ReplaceSalIntegrationEnrichmentProjectSettings(replaceSalIntegrationEnrichmentProjectSettingsOptions *ReplaceSalIntegrationEnrichmentProjectSettingsOptions)`, func() { + replaceSalIntegrationEnrichmentProjectSettingsPath := "/v3/sal_integration/enrichment/project_settings" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listMilvusServiceDatabasesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(replaceSalIntegrationEnrichmentProjectSettingsPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprint(res, `} this is not valid json {`) + Expect(req.URL.Query()["project_id"]).To(Equal([]string{"testString"})) + res.WriteHeader(202) })) }) - It(`Invoke ListMilvusServiceDatabases with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ReplaceSalIntegrationEnrichmentProjectSettings successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListMilvusServiceDatabasesOptions model - listMilvusServiceDatabasesOptionsModel := new(watsonxdatav2.ListMilvusServiceDatabasesOptions) - listMilvusServiceDatabasesOptionsModel.ServiceID = core.StringPtr("testString") - listMilvusServiceDatabasesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusServiceDatabasesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.ReplaceSalIntegrationEnrichmentProjectSettings(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Enable retries and test again - watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Construct an instance of the SalEnrichmentSettingsExpansionDescriptionConfiguration model + salEnrichmentSettingsExpansionDescriptionConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) + + // Construct an instance of the SalEnrichmentSettingsExpansionNameConfiguration model + salEnrichmentSettingsExpansionNameConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration) + salEnrichmentSettingsExpansionNameConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) + salEnrichmentSettingsExpansionNameConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) + + // Construct an instance of the SalEnrichmentSettingsExpansion model + salEnrichmentSettingsExpansionModel := new(watsonxdatav3.SalEnrichmentSettingsExpansion) + salEnrichmentSettingsExpansionModel.Description = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.DescriptionConfiguration = salEnrichmentSettingsExpansionDescriptionConfigurationModel + salEnrichmentSettingsExpansionModel.Name = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.NameConfiguration = salEnrichmentSettingsExpansionNameConfigurationModel + + // Construct an instance of the SalEnrichmentSettingsTermAssignment model + salEnrichmentSettingsTermAssignmentModel := new(watsonxdatav3.SalEnrichmentSettingsTermAssignment) + salEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) + salEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) + + // Construct an instance of the ReplaceSalIntegrationEnrichmentProjectSettingsOptions model + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel := new(watsonxdatav3.ReplaceSalIntegrationEnrichmentProjectSettingsOptions) + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.ProjectID = core.StringPtr("testString") + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.Expansion = salEnrichmentSettingsExpansionModel + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.TermAssignment = salEnrichmentSettingsTermAssignmentModel + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.ReplaceSalIntegrationEnrichmentProjectSettings(replaceSalIntegrationEnrichmentProjectSettingsOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`ListMilvusServiceDatabases(listMilvusServiceDatabasesOptions *ListMilvusServiceDatabasesOptions)`, func() { - listMilvusServiceDatabasesPath := "/milvus_services/testString/databases" - Context(`Using mock server endpoint with timeout`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listMilvusServiceDatabasesPath)) + It(`Invoke ReplaceSalIntegrationEnrichmentProjectSettings with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the SalEnrichmentSettingsExpansionDescriptionConfiguration model + salEnrichmentSettingsExpansionDescriptionConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) + + // Construct an instance of the SalEnrichmentSettingsExpansionNameConfiguration model + salEnrichmentSettingsExpansionNameConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration) + salEnrichmentSettingsExpansionNameConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) + salEnrichmentSettingsExpansionNameConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) + + // Construct an instance of the SalEnrichmentSettingsExpansion model + salEnrichmentSettingsExpansionModel := new(watsonxdatav3.SalEnrichmentSettingsExpansion) + salEnrichmentSettingsExpansionModel.Description = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.DescriptionConfiguration = salEnrichmentSettingsExpansionDescriptionConfigurationModel + salEnrichmentSettingsExpansionModel.Name = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.NameConfiguration = salEnrichmentSettingsExpansionNameConfigurationModel + + // Construct an instance of the SalEnrichmentSettingsTermAssignment model + salEnrichmentSettingsTermAssignmentModel := new(watsonxdatav3.SalEnrichmentSettingsTermAssignment) + salEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) + salEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) + + // Construct an instance of the ReplaceSalIntegrationEnrichmentProjectSettingsOptions model + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel := new(watsonxdatav3.ReplaceSalIntegrationEnrichmentProjectSettingsOptions) + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.ProjectID = core.StringPtr("testString") + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.Expansion = salEnrichmentSettingsExpansionModel + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.TermAssignment = salEnrichmentSettingsTermAssignmentModel + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.ReplaceSalIntegrationEnrichmentProjectSettings(replaceSalIntegrationEnrichmentProjectSettingsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the ReplaceSalIntegrationEnrichmentProjectSettingsOptions model with no property values + replaceSalIntegrationEnrichmentProjectSettingsOptionsModelNew := new(watsonxdatav3.ReplaceSalIntegrationEnrichmentProjectSettingsOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.ReplaceSalIntegrationEnrichmentProjectSettings(replaceSalIntegrationEnrichmentProjectSettingsOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptions *GetSalIntegrationGlossaryTermsOptions) - Operation response error`, func() { + getSalIntegrationGlossaryTermsPath := "/v3/sal_integration/glossary/terms" + Context(`Using mock server endpoint with invalid JSON response`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationGlossaryTermsPath)) + Expect(req.Method).To(Equal("GET")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + fmt.Fprint(res, `} this is not valid json {`) + })) + }) + It(`Invoke GetSalIntegrationGlossaryTerms with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the GetSalIntegrationGlossaryTermsOptions model + getSalIntegrationGlossaryTermsOptionsModel := new(watsonxdatav3.GetSalIntegrationGlossaryTermsOptions) + getSalIntegrationGlossaryTermsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationGlossaryTermsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Expect response parsing to fail since we are receiving a text/plain response + result, response, operationErr := watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + + // Enable retries and test again + watsonxDataService.EnableRetries(0, 0) + result, response, operationErr = watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(response).ToNot(BeNil()) + Expect(result).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptions *GetSalIntegrationGlossaryTermsOptions)`, func() { + getSalIntegrationGlossaryTermsPath := "/v3/sal_integration/glossary/terms" + Context(`Using mock server endpoint with timeout`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationGlossaryTermsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -31187,11 +32503,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"databases": ["default"]}`) + fmt.Fprintf(res, "%s", `{"glossary_terms": [{"description": "First Name", "name": "Name"}]}`) })) }) - It(`Invoke ListMilvusServiceDatabases successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationGlossaryTerms successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -31199,22 +32515,21 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListMilvusServiceDatabasesOptions model - listMilvusServiceDatabasesOptionsModel := new(watsonxdatav2.ListMilvusServiceDatabasesOptions) - listMilvusServiceDatabasesOptionsModel.ServiceID = core.StringPtr("testString") - listMilvusServiceDatabasesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusServiceDatabasesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationGlossaryTermsOptions model + getSalIntegrationGlossaryTermsOptionsModel := new(watsonxdatav3.GetSalIntegrationGlossaryTermsOptions) + getSalIntegrationGlossaryTermsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationGlossaryTermsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListMilvusServiceDatabasesWithContext(ctx, listMilvusServiceDatabasesOptionsModel) + _, _, operationErr := watsonxDataService.GetSalIntegrationGlossaryTermsWithContext(ctx, getSalIntegrationGlossaryTermsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -31222,7 +32537,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListMilvusServiceDatabasesWithContext(ctx, listMilvusServiceDatabasesOptionsModel) + _, _, operationErr = watsonxDataService.GetSalIntegrationGlossaryTermsWithContext(ctx, getSalIntegrationGlossaryTermsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -31236,7 +32551,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listMilvusServiceDatabasesPath)) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationGlossaryTermsPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) @@ -31244,11 +32559,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"databases": ["default"]}`) + fmt.Fprintf(res, "%s", `{"glossary_terms": [{"description": "First Name", "name": "Name"}]}`) })) }) - It(`Invoke ListMilvusServiceDatabases successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationGlossaryTerms successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -31256,52 +32571,43 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListMilvusServiceDatabases(nil) + result, response, operationErr := watsonxDataService.GetSalIntegrationGlossaryTerms(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListMilvusServiceDatabasesOptions model - listMilvusServiceDatabasesOptionsModel := new(watsonxdatav2.ListMilvusServiceDatabasesOptions) - listMilvusServiceDatabasesOptionsModel.ServiceID = core.StringPtr("testString") - listMilvusServiceDatabasesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusServiceDatabasesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationGlossaryTermsOptions model + getSalIntegrationGlossaryTermsOptionsModel := new(watsonxdatav3.GetSalIntegrationGlossaryTermsOptions) + getSalIntegrationGlossaryTermsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationGlossaryTermsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListMilvusServiceDatabases with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationGlossaryTerms with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListMilvusServiceDatabasesOptions model - listMilvusServiceDatabasesOptionsModel := new(watsonxdatav2.ListMilvusServiceDatabasesOptions) - listMilvusServiceDatabasesOptionsModel.ServiceID = core.StringPtr("testString") - listMilvusServiceDatabasesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusServiceDatabasesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationGlossaryTermsOptions model + getSalIntegrationGlossaryTermsOptionsModel := new(watsonxdatav3.GetSalIntegrationGlossaryTermsOptions) + getSalIntegrationGlossaryTermsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationGlossaryTermsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListMilvusServiceDatabasesOptions model with no property values - listMilvusServiceDatabasesOptionsModelNew := new(watsonxdatav2.ListMilvusServiceDatabasesOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -31316,22 +32622,21 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke ListMilvusServiceDatabases successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationGlossaryTerms successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListMilvusServiceDatabasesOptions model - listMilvusServiceDatabasesOptionsModel := new(watsonxdatav2.ListMilvusServiceDatabasesOptions) - listMilvusServiceDatabasesOptionsModel.ServiceID = core.StringPtr("testString") - listMilvusServiceDatabasesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusServiceDatabasesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationGlossaryTermsOptions model + getSalIntegrationGlossaryTermsOptionsModel := new(watsonxdatav3.GetSalIntegrationGlossaryTermsOptions) + getSalIntegrationGlossaryTermsOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationGlossaryTermsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListMilvusServiceDatabases(listMilvusServiceDatabasesOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationGlossaryTerms(getSalIntegrationGlossaryTermsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -31343,46 +32648,47 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptions *ListMilvusDatabaseCollectionsOptions) - Operation response error`, func() { - listMilvusDatabaseCollectionsPath := "/milvus_services/testString/databases/testString/collections" + Describe(`CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptions *CreateSalIntegrationUploadGlossaryOptions) - Operation response error`, func() { + createSalIntegrationUploadGlossaryPath := "/v3/sal_integration/glossary/upload_processes" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listMilvusDatabaseCollectionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationUploadGlossaryPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListMilvusDatabaseCollections with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSalIntegrationUploadGlossary with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListMilvusDatabaseCollectionsOptions model - listMilvusDatabaseCollectionsOptionsModel := new(watsonxdatav2.ListMilvusDatabaseCollectionsOptions) - listMilvusDatabaseCollectionsOptionsModel.ServiceID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.DatabaseID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSalIntegrationUploadGlossaryOptions model + createSalIntegrationUploadGlossaryOptionsModel := new(watsonxdatav3.CreateSalIntegrationUploadGlossaryOptions) + createSalIntegrationUploadGlossaryOptionsModel.ReplaceOption = core.StringPtr("all") + createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsv = CreateMockReader("This is a mock file.") + createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsvContentType = core.StringPtr("testString") + createSalIntegrationUploadGlossaryOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationUploadGlossaryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) + result, response, operationErr = watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -31392,16 +32698,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptions *ListMilvusDatabaseCollectionsOptions)`, func() { - listMilvusDatabaseCollectionsPath := "/milvus_services/testString/databases/testString/collections" + Describe(`CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptions *CreateSalIntegrationUploadGlossaryOptions)`, func() { + createSalIntegrationUploadGlossaryPath := "/v3/sal_integration/glossary/upload_processes" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listMilvusDatabaseCollectionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationUploadGlossaryPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -31410,12 +32716,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"collections": [{"collection_id": 12, "collection_name": "col1", "physical_channels": ["PhysicalChannels"], "virtual_channels": ["VirtualChannels"]}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID"}`) })) }) - It(`Invoke ListMilvusDatabaseCollections successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSalIntegrationUploadGlossary successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -31423,23 +32729,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListMilvusDatabaseCollectionsOptions model - listMilvusDatabaseCollectionsOptionsModel := new(watsonxdatav2.ListMilvusDatabaseCollectionsOptions) - listMilvusDatabaseCollectionsOptionsModel.ServiceID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.DatabaseID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSalIntegrationUploadGlossaryOptions model + createSalIntegrationUploadGlossaryOptionsModel := new(watsonxdatav3.CreateSalIntegrationUploadGlossaryOptions) + createSalIntegrationUploadGlossaryOptionsModel.ReplaceOption = core.StringPtr("all") + createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsv = CreateMockReader("This is a mock file.") + createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsvContentType = core.StringPtr("testString") + createSalIntegrationUploadGlossaryOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationUploadGlossaryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListMilvusDatabaseCollectionsWithContext(ctx, listMilvusDatabaseCollectionsOptionsModel) + _, _, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossaryWithContext(ctx, createSalIntegrationUploadGlossaryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -31447,7 +32754,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListMilvusDatabaseCollectionsWithContext(ctx, listMilvusDatabaseCollectionsOptionsModel) + _, _, operationErr = watsonxDataService.CreateSalIntegrationUploadGlossaryWithContext(ctx, createSalIntegrationUploadGlossaryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -31461,19 +32768,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listMilvusDatabaseCollectionsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSalIntegrationUploadGlossaryPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"collections": [{"collection_id": 12, "collection_name": "col1", "physical_channels": ["PhysicalChannels"], "virtual_channels": ["VirtualChannels"]}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "ID"}`) })) }) - It(`Invoke ListMilvusDatabaseCollections successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSalIntegrationUploadGlossary successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -31481,51 +32788,53 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListMilvusDatabaseCollections(nil) + result, response, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossary(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListMilvusDatabaseCollectionsOptions model - listMilvusDatabaseCollectionsOptionsModel := new(watsonxdatav2.ListMilvusDatabaseCollectionsOptions) - listMilvusDatabaseCollectionsOptionsModel.ServiceID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.DatabaseID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSalIntegrationUploadGlossaryOptions model + createSalIntegrationUploadGlossaryOptionsModel := new(watsonxdatav3.CreateSalIntegrationUploadGlossaryOptions) + createSalIntegrationUploadGlossaryOptionsModel.ReplaceOption = core.StringPtr("all") + createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsv = CreateMockReader("This is a mock file.") + createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsvContentType = core.StringPtr("testString") + createSalIntegrationUploadGlossaryOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationUploadGlossaryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) + result, response, operationErr = watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListMilvusDatabaseCollections with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSalIntegrationUploadGlossary with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListMilvusDatabaseCollectionsOptions model - listMilvusDatabaseCollectionsOptionsModel := new(watsonxdatav2.ListMilvusDatabaseCollectionsOptions) - listMilvusDatabaseCollectionsOptionsModel.ServiceID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.DatabaseID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSalIntegrationUploadGlossaryOptions model + createSalIntegrationUploadGlossaryOptionsModel := new(watsonxdatav3.CreateSalIntegrationUploadGlossaryOptions) + createSalIntegrationUploadGlossaryOptionsModel.ReplaceOption = core.StringPtr("all") + createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsv = CreateMockReader("This is a mock file.") + createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsvContentType = core.StringPtr("testString") + createSalIntegrationUploadGlossaryOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationUploadGlossaryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListMilvusDatabaseCollectionsOptions model with no property values - listMilvusDatabaseCollectionsOptionsModelNew := new(watsonxdatav2.ListMilvusDatabaseCollectionsOptions) + // Construct a second instance of the CreateSalIntegrationUploadGlossaryOptions model with no property values + createSalIntegrationUploadGlossaryOptionsModelNew := new(watsonxdatav3.CreateSalIntegrationUploadGlossaryOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -31540,26 +32849,27 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListMilvusDatabaseCollections successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSalIntegrationUploadGlossary successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListMilvusDatabaseCollectionsOptions model - listMilvusDatabaseCollectionsOptionsModel := new(watsonxdatav2.ListMilvusDatabaseCollectionsOptions) - listMilvusDatabaseCollectionsOptionsModel.ServiceID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.DatabaseID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listMilvusDatabaseCollectionsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the CreateSalIntegrationUploadGlossaryOptions model + createSalIntegrationUploadGlossaryOptionsModel := new(watsonxdatav3.CreateSalIntegrationUploadGlossaryOptions) + createSalIntegrationUploadGlossaryOptionsModel.ReplaceOption = core.StringPtr("all") + createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsv = CreateMockReader("This is a mock file.") + createSalIntegrationUploadGlossaryOptionsModel.GlossaryCsvContentType = core.StringPtr("testString") + createSalIntegrationUploadGlossaryOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSalIntegrationUploadGlossaryOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListMilvusDatabaseCollections(listMilvusDatabaseCollectionsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSalIntegrationUploadGlossary(createSalIntegrationUploadGlossaryOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -31571,45 +32881,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateMilvusServicePause(createMilvusServicePauseOptions *CreateMilvusServicePauseOptions) - Operation response error`, func() { - createMilvusServicePausePath := "/milvus_services/testString/pause" + Describe(`GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptions *GetSalIntegrationUploadGlossaryStatusOptions) - Operation response error`, func() { + getSalIntegrationUploadGlossaryStatusPath := "/v3/sal_integration/glossary/upload_processes/testString/status" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePausePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationUploadGlossaryStatusPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateMilvusServicePause with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationUploadGlossaryStatus with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServicePauseOptions model - createMilvusServicePauseOptionsModel := new(watsonxdatav2.CreateMilvusServicePauseOptions) - createMilvusServicePauseOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServicePauseOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServicePauseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationUploadGlossaryStatusOptions model + getSalIntegrationUploadGlossaryStatusOptionsModel := new(watsonxdatav3.GetSalIntegrationUploadGlossaryStatusOptions) + getSalIntegrationUploadGlossaryStatusOptionsModel.ID = core.StringPtr("testString") + getSalIntegrationUploadGlossaryStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationUploadGlossaryStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -31619,16 +32929,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateMilvusServicePause(createMilvusServicePauseOptions *CreateMilvusServicePauseOptions)`, func() { - createMilvusServicePausePath := "/milvus_services/testString/pause" + Describe(`GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptions *GetSalIntegrationUploadGlossaryStatusOptions)`, func() { + getSalIntegrationUploadGlossaryStatusPath := "/v3/sal_integration/glossary/upload_processes/testString/status" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePausePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationUploadGlossaryStatusPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -31637,12 +32947,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"response": "completed"}`) })) }) - It(`Invoke CreateMilvusServicePause successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationUploadGlossaryStatus successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -31650,22 +32960,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateMilvusServicePauseOptions model - createMilvusServicePauseOptionsModel := new(watsonxdatav2.CreateMilvusServicePauseOptions) - createMilvusServicePauseOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServicePauseOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServicePauseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationUploadGlossaryStatusOptions model + getSalIntegrationUploadGlossaryStatusOptionsModel := new(watsonxdatav3.GetSalIntegrationUploadGlossaryStatusOptions) + getSalIntegrationUploadGlossaryStatusOptionsModel.ID = core.StringPtr("testString") + getSalIntegrationUploadGlossaryStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationUploadGlossaryStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateMilvusServicePauseWithContext(ctx, createMilvusServicePauseOptionsModel) + _, _, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatusWithContext(ctx, getSalIntegrationUploadGlossaryStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -31673,7 +32983,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateMilvusServicePauseWithContext(ctx, createMilvusServicePauseOptionsModel) + _, _, operationErr = watsonxDataService.GetSalIntegrationUploadGlossaryStatusWithContext(ctx, getSalIntegrationUploadGlossaryStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -31687,19 +32997,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServicePausePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getSalIntegrationUploadGlossaryStatusPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"response": "completed"}`) })) }) - It(`Invoke CreateMilvusServicePause successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationUploadGlossaryStatus successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -31707,49 +33017,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateMilvusServicePause(nil) + result, response, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateMilvusServicePauseOptions model - createMilvusServicePauseOptionsModel := new(watsonxdatav2.CreateMilvusServicePauseOptions) - createMilvusServicePauseOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServicePauseOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServicePauseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationUploadGlossaryStatusOptions model + getSalIntegrationUploadGlossaryStatusOptionsModel := new(watsonxdatav3.GetSalIntegrationUploadGlossaryStatusOptions) + getSalIntegrationUploadGlossaryStatusOptionsModel.ID = core.StringPtr("testString") + getSalIntegrationUploadGlossaryStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationUploadGlossaryStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) + result, response, operationErr = watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateMilvusServicePause with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationUploadGlossaryStatus with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServicePauseOptions model - createMilvusServicePauseOptionsModel := new(watsonxdatav2.CreateMilvusServicePauseOptions) - createMilvusServicePauseOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServicePauseOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServicePauseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationUploadGlossaryStatusOptions model + getSalIntegrationUploadGlossaryStatusOptionsModel := new(watsonxdatav3.GetSalIntegrationUploadGlossaryStatusOptions) + getSalIntegrationUploadGlossaryStatusOptionsModel.ID = core.StringPtr("testString") + getSalIntegrationUploadGlossaryStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationUploadGlossaryStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateMilvusServicePauseOptions model with no property values - createMilvusServicePauseOptionsModelNew := new(watsonxdatav2.CreateMilvusServicePauseOptions) + // Construct a second instance of the GetSalIntegrationUploadGlossaryStatusOptions model with no property values + getSalIntegrationUploadGlossaryStatusOptionsModelNew := new(watsonxdatav3.GetSalIntegrationUploadGlossaryStatusOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModelNew) + result, response, operationErr = watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -31764,25 +33074,25 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateMilvusServicePause successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetSalIntegrationUploadGlossaryStatus successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServicePauseOptions model - createMilvusServicePauseOptionsModel := new(watsonxdatav2.CreateMilvusServicePauseOptions) - createMilvusServicePauseOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServicePauseOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServicePauseOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetSalIntegrationUploadGlossaryStatusOptions model + getSalIntegrationUploadGlossaryStatusOptionsModel := new(watsonxdatav3.GetSalIntegrationUploadGlossaryStatusOptions) + getSalIntegrationUploadGlossaryStatusOptionsModel.ID = core.StringPtr("testString") + getSalIntegrationUploadGlossaryStatusOptionsModel.AuthInstanceID = core.StringPtr("testString") + getSalIntegrationUploadGlossaryStatusOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateMilvusServicePause(createMilvusServicePauseOptionsModel) + result, response, operationErr := watsonxDataService.GetSalIntegrationUploadGlossaryStatus(getSalIntegrationUploadGlossaryStatusOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -31794,45 +33104,50 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateMilvusServiceResume(createMilvusServiceResumeOptions *CreateMilvusServiceResumeOptions) - Operation response error`, func() { - createMilvusServiceResumePath := "/milvus_services/testString/resume" + Describe(`ListSalIntegrationEnrichmentMappings(listSalIntegrationEnrichmentMappingsOptions *ListSalIntegrationEnrichmentMappingsOptions) - Operation response error`, func() { + listSalIntegrationEnrichmentMappingsPath := "/v3/sal_integration/mappings" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceResumePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentMappingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["next"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateMilvusServiceResume with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentMappings with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServiceResumeOptions model - createMilvusServiceResumeOptionsModel := new(watsonxdatav2.CreateMilvusServiceResumeOptions) - createMilvusServiceResumeOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServiceResumeOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceResumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentMappingsOptions model + listSalIntegrationEnrichmentMappingsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentMappingsOptions) + listSalIntegrationEnrichmentMappingsOptionsModel.CatalogName = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.SchemaName = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.Next = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentMappings(listSalIntegrationEnrichmentMappingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) + result, response, operationErr = watsonxDataService.ListSalIntegrationEnrichmentMappings(listSalIntegrationEnrichmentMappingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -31842,30 +33157,33 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateMilvusServiceResume(createMilvusServiceResumeOptions *CreateMilvusServiceResumeOptions)`, func() { - createMilvusServiceResumePath := "/milvus_services/testString/resume" + Describe(`ListSalIntegrationEnrichmentMappings(listSalIntegrationEnrichmentMappingsOptions *ListSalIntegrationEnrichmentMappingsOptions)`, func() { + listSalIntegrationEnrichmentMappingsPath := "/v3/sal_integration/mappings" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceResumePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentMappingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["next"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"mappings": [{"wkc_catalog_id": "18b49d7a-9519-4539-8db5-ff080623c226", "wkc_project_id": "9519bd7a-9519-8db5-4539-ff080623c226", "wxd_catalog_name": "iceberg_data", "wxd_schema_name": "test_schema"}], "next": "g2wAAAABaANkACpkYmNvcmVAZGIxOC5ibS1jYy11cy1zb3V0aC0yOC5jbG91ZGFudC5uZXRsAAAAAm4EAAAAAKBuBAD___-vamwAAAACbQAAABQyMDI1LTA2LTExVDAyOjA0OjU1WmEAamo"}`) })) }) - It(`Invoke CreateMilvusServiceResume successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentMappings successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -31873,22 +33191,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateMilvusServiceResumeOptions model - createMilvusServiceResumeOptionsModel := new(watsonxdatav2.CreateMilvusServiceResumeOptions) - createMilvusServiceResumeOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServiceResumeOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceResumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentMappingsOptions model + listSalIntegrationEnrichmentMappingsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentMappingsOptions) + listSalIntegrationEnrichmentMappingsOptionsModel.CatalogName = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.SchemaName = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.Next = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateMilvusServiceResumeWithContext(ctx, createMilvusServiceResumeOptionsModel) + _, _, operationErr := watsonxDataService.ListSalIntegrationEnrichmentMappingsWithContext(ctx, listSalIntegrationEnrichmentMappingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentMappings(listSalIntegrationEnrichmentMappingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -31896,7 +33216,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateMilvusServiceResumeWithContext(ctx, createMilvusServiceResumeOptionsModel) + _, _, operationErr = watsonxDataService.ListSalIntegrationEnrichmentMappingsWithContext(ctx, listSalIntegrationEnrichmentMappingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -31910,19 +33230,22 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceResumePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listSalIntegrationEnrichmentMappingsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["next"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"mappings": [{"wkc_catalog_id": "18b49d7a-9519-4539-8db5-ff080623c226", "wkc_project_id": "9519bd7a-9519-8db5-4539-ff080623c226", "wxd_catalog_name": "iceberg_data", "wxd_schema_name": "test_schema"}], "next": "g2wAAAABaANkACpkYmNvcmVAZGIxOC5ibS1jYy11cy1zb3V0aC0yOC5jbG91ZGFudC5uZXRsAAAAAm4EAAAAAKBuBAD___-vamwAAAACbQAAABQyMDI1LTA2LTExVDAyOjA0OjU1WmEAamo"}`) })) }) - It(`Invoke CreateMilvusServiceResume successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentMappings successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -31930,52 +33253,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateMilvusServiceResume(nil) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentMappings(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateMilvusServiceResumeOptions model - createMilvusServiceResumeOptionsModel := new(watsonxdatav2.CreateMilvusServiceResumeOptions) - createMilvusServiceResumeOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServiceResumeOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceResumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentMappingsOptions model + listSalIntegrationEnrichmentMappingsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentMappingsOptions) + listSalIntegrationEnrichmentMappingsOptionsModel.CatalogName = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.SchemaName = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.Next = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) + result, response, operationErr = watsonxDataService.ListSalIntegrationEnrichmentMappings(listSalIntegrationEnrichmentMappingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateMilvusServiceResume with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentMappings with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServiceResumeOptions model - createMilvusServiceResumeOptionsModel := new(watsonxdatav2.CreateMilvusServiceResumeOptions) - createMilvusServiceResumeOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServiceResumeOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceResumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentMappingsOptions model + listSalIntegrationEnrichmentMappingsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentMappingsOptions) + listSalIntegrationEnrichmentMappingsOptionsModel.CatalogName = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.SchemaName = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.Next = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentMappings(listSalIntegrationEnrichmentMappingsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateMilvusServiceResumeOptions model with no property values - createMilvusServiceResumeOptionsModelNew := new(watsonxdatav2.CreateMilvusServiceResumeOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -31987,25 +33307,27 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateMilvusServiceResume successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSalIntegrationEnrichmentMappings successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServiceResumeOptions model - createMilvusServiceResumeOptionsModel := new(watsonxdatav2.CreateMilvusServiceResumeOptions) - createMilvusServiceResumeOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServiceResumeOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceResumeOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSalIntegrationEnrichmentMappingsOptions model + listSalIntegrationEnrichmentMappingsOptionsModel := new(watsonxdatav3.ListSalIntegrationEnrichmentMappingsOptions) + listSalIntegrationEnrichmentMappingsOptionsModel.CatalogName = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.SchemaName = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.Next = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateMilvusServiceResume(createMilvusServiceResumeOptionsModel) + result, response, operationErr := watsonxDataService.ListSalIntegrationEnrichmentMappings(listSalIntegrationEnrichmentMappingsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -32017,46 +33339,54 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateMilvusServiceScale(createMilvusServiceScaleOptions *CreateMilvusServiceScaleOptions) - Operation response error`, func() { - createMilvusServiceScalePath := "/milvus_services/testString/scale" + Describe(`ListSemanticSearchQueries(listSemanticSearchQueriesOptions *ListSemanticSearchQueriesOptions) - Operation response error`, func() { + listSemanticSearchQueriesPath := "/v3/sal_integration/semantic_search/queries" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceScalePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listSemanticSearchQueriesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + // TODO: Add check for schema_search_enabled query parameter + // TODO: Add check for column_search_enabled query parameter + Expect(req.URL.Query()["max_result_number"]).To(Equal([]string{fmt.Sprint(int64(5))})) + // TODO: Add check for run_search query parameter res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateMilvusServiceScale with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSemanticSearchQueries with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServiceScaleOptions model - createMilvusServiceScaleOptionsModel := new(watsonxdatav2.CreateMilvusServiceScaleOptions) - createMilvusServiceScaleOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServiceScaleOptionsModel.TshirtSize = core.StringPtr("small") - createMilvusServiceScaleOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceScaleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSemanticSearchQueriesOptions model + listSemanticSearchQueriesOptionsModel := new(watsonxdatav3.ListSemanticSearchQueriesOptions) + listSemanticSearchQueriesOptionsModel.EngineID = core.StringPtr("testString") + listSemanticSearchQueriesOptionsModel.SchemaSearchEnabled = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.ColumnSearchEnabled = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.MaxResultNumber = core.Int64Ptr(int64(5)) + listSemanticSearchQueriesOptionsModel.RunSearch = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) + result, response, operationErr := watsonxDataService.ListSemanticSearchQueries(listSemanticSearchQueriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) + result, response, operationErr = watsonxDataService.ListSemanticSearchQueries(listSemanticSearchQueriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -32066,46 +33396,35 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateMilvusServiceScale(createMilvusServiceScaleOptions *CreateMilvusServiceScaleOptions)`, func() { - createMilvusServiceScalePath := "/milvus_services/testString/scale" + Describe(`ListSemanticSearchQueries(listSemanticSearchQueriesOptions *ListSemanticSearchQueriesOptions)`, func() { + listSemanticSearchQueriesPath := "/v3/sal_integration/semantic_search/queries" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceScalePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listSemanticSearchQueriesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + // TODO: Add check for schema_search_enabled query parameter + // TODO: Add check for column_search_enabled query parameter + Expect(req.URL.Query()["max_result_number"]).To(Equal([]string{fmt.Sprint(int64(5))})) + // TODO: Add check for run_search query parameter // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"queries": [{"id": "1", "last_search_time": "2024-09-15T14:30:00.000Z", "results": [{"artifact_type": "data_asset", "asset_id": "7f9d8270-496f-4bda-96b9-9891b35c80e9", "catalog_name": "iceberg", "description": "Description", "highlight": {"mapKey": ["Inner"]}, "matched_columns": [{"asset_id": "7f9d8270-496f-4bda-96b9-9891b35c80e9:customer_id", "description": "Description", "highlight": {"mapKey": ["Inner"]}, "name": "customer_id", "semantic_description": "SemanticDescription", "semantic_name": "SemanticName"}], "name": "table1", "path": "/iceberg/california_school/table1", "project_id": "b94b3f1c-3808-44d2-b7e6-4df8d5861950", "provider_type": "cams", "schema_name": "california_school", "search_score": 11, "semantic_description": "SemanticDescription", "semantic_name": "SemanticName", "state": "active", "table_name": "table1", "tags": ["Tags"], "terms": ["Terms"]}], "search_query": "catalog_table"}]}`) })) }) - It(`Invoke CreateMilvusServiceScale successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSemanticSearchQueries successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -32113,23 +33432,26 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateMilvusServiceScaleOptions model - createMilvusServiceScaleOptionsModel := new(watsonxdatav2.CreateMilvusServiceScaleOptions) - createMilvusServiceScaleOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServiceScaleOptionsModel.TshirtSize = core.StringPtr("small") - createMilvusServiceScaleOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceScaleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSemanticSearchQueriesOptions model + listSemanticSearchQueriesOptionsModel := new(watsonxdatav3.ListSemanticSearchQueriesOptions) + listSemanticSearchQueriesOptionsModel.EngineID = core.StringPtr("testString") + listSemanticSearchQueriesOptionsModel.SchemaSearchEnabled = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.ColumnSearchEnabled = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.MaxResultNumber = core.Int64Ptr(int64(5)) + listSemanticSearchQueriesOptionsModel.RunSearch = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateMilvusServiceScaleWithContext(ctx, createMilvusServiceScaleOptionsModel) + _, _, operationErr := watsonxDataService.ListSemanticSearchQueriesWithContext(ctx, listSemanticSearchQueriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) + result, response, operationErr := watsonxDataService.ListSemanticSearchQueries(listSemanticSearchQueriesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -32137,7 +33459,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateMilvusServiceScaleWithContext(ctx, createMilvusServiceScaleOptionsModel) + _, _, operationErr = watsonxDataService.ListSemanticSearchQueriesWithContext(ctx, listSemanticSearchQueriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -32151,35 +33473,24 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createMilvusServiceScalePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(listSemanticSearchQueriesPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["engine_id"]).To(Equal([]string{"testString"})) + // TODO: Add check for schema_search_enabled query parameter + // TODO: Add check for column_search_enabled query parameter + Expect(req.URL.Query()["max_result_number"]).To(Equal([]string{fmt.Sprint(int64(5))})) + // TODO: Add check for run_search query parameter // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode"}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"queries": [{"id": "1", "last_search_time": "2024-09-15T14:30:00.000Z", "results": [{"artifact_type": "data_asset", "asset_id": "7f9d8270-496f-4bda-96b9-9891b35c80e9", "catalog_name": "iceberg", "description": "Description", "highlight": {"mapKey": ["Inner"]}, "matched_columns": [{"asset_id": "7f9d8270-496f-4bda-96b9-9891b35c80e9:customer_id", "description": "Description", "highlight": {"mapKey": ["Inner"]}, "name": "customer_id", "semantic_description": "SemanticDescription", "semantic_name": "SemanticName"}], "name": "table1", "path": "/iceberg/california_school/table1", "project_id": "b94b3f1c-3808-44d2-b7e6-4df8d5861950", "provider_type": "cams", "schema_name": "california_school", "search_score": 11, "semantic_description": "SemanticDescription", "semantic_name": "SemanticName", "state": "active", "table_name": "table1", "tags": ["Tags"], "terms": ["Terms"]}], "search_query": "catalog_table"}]}`) })) }) - It(`Invoke CreateMilvusServiceScale successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSemanticSearchQueries successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -32187,54 +33498,53 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateMilvusServiceScale(nil) + result, response, operationErr := watsonxDataService.ListSemanticSearchQueries(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateMilvusServiceScaleOptions model - createMilvusServiceScaleOptionsModel := new(watsonxdatav2.CreateMilvusServiceScaleOptions) - createMilvusServiceScaleOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServiceScaleOptionsModel.TshirtSize = core.StringPtr("small") - createMilvusServiceScaleOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceScaleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSemanticSearchQueriesOptions model + listSemanticSearchQueriesOptionsModel := new(watsonxdatav3.ListSemanticSearchQueriesOptions) + listSemanticSearchQueriesOptionsModel.EngineID = core.StringPtr("testString") + listSemanticSearchQueriesOptionsModel.SchemaSearchEnabled = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.ColumnSearchEnabled = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.MaxResultNumber = core.Int64Ptr(int64(5)) + listSemanticSearchQueriesOptionsModel.RunSearch = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) + result, response, operationErr = watsonxDataService.ListSemanticSearchQueries(listSemanticSearchQueriesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateMilvusServiceScale with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSemanticSearchQueries with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServiceScaleOptions model - createMilvusServiceScaleOptionsModel := new(watsonxdatav2.CreateMilvusServiceScaleOptions) - createMilvusServiceScaleOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServiceScaleOptionsModel.TshirtSize = core.StringPtr("small") - createMilvusServiceScaleOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceScaleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSemanticSearchQueriesOptions model + listSemanticSearchQueriesOptionsModel := new(watsonxdatav3.ListSemanticSearchQueriesOptions) + listSemanticSearchQueriesOptionsModel.EngineID = core.StringPtr("testString") + listSemanticSearchQueriesOptionsModel.SchemaSearchEnabled = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.ColumnSearchEnabled = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.MaxResultNumber = core.Int64Ptr(int64(5)) + listSemanticSearchQueriesOptionsModel.RunSearch = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) + result, response, operationErr := watsonxDataService.ListSemanticSearchQueries(listSemanticSearchQueriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateMilvusServiceScaleOptions model with no property values - createMilvusServiceScaleOptionsModelNew := new(watsonxdatav2.CreateMilvusServiceScaleOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -32246,26 +33556,29 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreateMilvusServiceScale successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListSemanticSearchQueries successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateMilvusServiceScaleOptions model - createMilvusServiceScaleOptionsModel := new(watsonxdatav2.CreateMilvusServiceScaleOptions) - createMilvusServiceScaleOptionsModel.ServiceID = core.StringPtr("testString") - createMilvusServiceScaleOptionsModel.TshirtSize = core.StringPtr("small") - createMilvusServiceScaleOptionsModel.AuthInstanceID = core.StringPtr("testString") - createMilvusServiceScaleOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListSemanticSearchQueriesOptions model + listSemanticSearchQueriesOptionsModel := new(watsonxdatav3.ListSemanticSearchQueriesOptions) + listSemanticSearchQueriesOptionsModel.EngineID = core.StringPtr("testString") + listSemanticSearchQueriesOptionsModel.SchemaSearchEnabled = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.ColumnSearchEnabled = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.MaxResultNumber = core.Int64Ptr(int64(5)) + listSemanticSearchQueriesOptionsModel.RunSearch = core.BoolPtr(true) + listSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateMilvusServiceScale(createMilvusServiceScaleOptionsModel) + result, response, operationErr := watsonxDataService.ListSemanticSearchQueries(listSemanticSearchQueriesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -32277,48 +33590,54 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListIngestionJobs(listIngestionJobsOptions *ListIngestionJobsOptions) - Operation response error`, func() { - listIngestionJobsPath := "/ingestion_jobs" + Describe(`CreateSemanticSearchQueries(createSemanticSearchQueriesOptions *CreateSemanticSearchQueriesOptions) - Operation response error`, func() { + createSemanticSearchQueriesPath := "/v3/sal_integration/semantic_search/queries" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listIngestionJobsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSemanticSearchQueriesPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["start"]).To(Equal([]string{"1"})) - Expect(req.URL.Query()["jobs_per_page"]).To(Equal([]string{fmt.Sprint(int64(1))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListIngestionJobs with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSemanticSearchQueries with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListIngestionJobsOptions model - listIngestionJobsOptionsModel := new(watsonxdatav2.ListIngestionJobsOptions) - listIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listIngestionJobsOptionsModel.Start = core.StringPtr("1") - listIngestionJobsOptionsModel.JobsPerPage = core.Int64Ptr(int64(1)) - listIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SemanticSearchBodySearchConfig model + semanticSearchBodySearchConfigModel := new(watsonxdatav3.SemanticSearchBodySearchConfig) + semanticSearchBodySearchConfigModel.ColumnSearchEnabled = core.BoolPtr(true) + semanticSearchBodySearchConfigModel.Fields = []string{"metadata.name", "metadata.description", "metadata.tags"} + semanticSearchBodySearchConfigModel.MaxResultNumber = core.Int64Ptr(int64(1)) + semanticSearchBodySearchConfigModel.SchemaSearchEnabled = core.BoolPtr(true) + + // Construct an instance of the CreateSemanticSearchQueriesOptions model + createSemanticSearchQueriesOptionsModel := new(watsonxdatav3.CreateSemanticSearchQueriesOptions) + createSemanticSearchQueriesOptionsModel.EngineID = core.StringPtr("presto01") + createSemanticSearchQueriesOptionsModel.QueryInput = core.StringPtr("catalog_table") + createSemanticSearchQueriesOptionsModel.SearchConfig = semanticSearchBodySearchConfigModel + createSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSemanticSearchQueries(createSemanticSearchQueriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) + result, response, operationErr = watsonxDataService.CreateSemanticSearchQueries(createSemanticSearchQueriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -32328,32 +33647,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListIngestionJobs(listIngestionJobsOptions *ListIngestionJobsOptions)`, func() { - listIngestionJobsPath := "/ingestion_jobs" + Describe(`CreateSemanticSearchQueries(createSemanticSearchQueriesOptions *CreateSemanticSearchQueriesOptions)`, func() { + createSemanticSearchQueriesPath := "/v3/sal_integration/semantic_search/queries" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listIngestionJobsPath)) - Expect(req.Method).To(Equal("GET")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["start"]).To(Equal([]string{"1"})) - Expect(req.URL.Query()["jobs_per_page"]).To(Equal([]string{fmt.Sprint(int64(1))})) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) + Expect(req.URL.EscapedPath()).To(Equal(createSemanticSearchQueriesPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"ingestion_jobs": [{"create_if_not_exist": false, "csv_property": {"encoding": "utf-8", "escape_character": "|", "field_delimiter": ",", "header": true, "line_delimiter": "\n"}, "details": "Path does not exist 'demobucket/data/yellow_tripdata_2022-01.parquet'. Detail: [errno 2] No such file or directory", "end_timestamp": "1685088775", "engine_id": "spark123", "engine_name": "sparkdemo", "execute_config": {"driver_cores": 1, "driver_memory": "2G", "executor_cores": 1, "executor_memory": "2G", "num_executors": 1}, "instance_id": "1684432229673971", "job_id": "ingestion-1699459946935", "partition_by": "col1, col2", "schema": "{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}", "source_data_files": "s3://demobucket/data/yellow_tripdata_2022-01.parquet", "source_file_type": "csv", "start_timestamp": "1685084455", "status": "running", "target_table": "demodb.test.targettable", "username": "ibmlhadmin", "validate_csv_header": false}], "first": {"href": "http://api.example.com/collection?start=eyJvZmZzZXQiOjAsImRvbmUiOnRydWV9"}, "next": {"href": "http://api.example.com/collection?start=eyJvZmZzZXQiOjAsImRvbmUiOnRydWV9"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "1", "last_search_time": "2024-09-15T14:30:00.000Z", "results": [{"artifact_type": "data_asset", "asset_id": "7f9d8270-496f-4bda-96b9-9891b35c80e9", "catalog_name": "iceberg", "description": "Description", "highlight": {"mapKey": ["Inner"]}, "matched_columns": [{"asset_id": "7f9d8270-496f-4bda-96b9-9891b35c80e9:customer_id", "description": "Description", "highlight": {"mapKey": ["Inner"]}, "name": "customer_id", "semantic_description": "SemanticDescription", "semantic_name": "SemanticName"}], "name": "table1", "path": "/iceberg/california_school/table1", "project_id": "b94b3f1c-3808-44d2-b7e6-4df8d5861950", "provider_type": "cams", "schema_name": "california_school", "search_score": 11, "semantic_description": "SemanticDescription", "semantic_name": "SemanticName", "state": "active", "table_name": "table1", "tags": ["Tags"], "terms": ["Terms"]}], "search_query": "catalog_table"}`) })) }) - It(`Invoke ListIngestionJobs successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSemanticSearchQueries successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -32361,23 +33694,31 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListIngestionJobsOptions model - listIngestionJobsOptionsModel := new(watsonxdatav2.ListIngestionJobsOptions) - listIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listIngestionJobsOptionsModel.Start = core.StringPtr("1") - listIngestionJobsOptionsModel.JobsPerPage = core.Int64Ptr(int64(1)) - listIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SemanticSearchBodySearchConfig model + semanticSearchBodySearchConfigModel := new(watsonxdatav3.SemanticSearchBodySearchConfig) + semanticSearchBodySearchConfigModel.ColumnSearchEnabled = core.BoolPtr(true) + semanticSearchBodySearchConfigModel.Fields = []string{"metadata.name", "metadata.description", "metadata.tags"} + semanticSearchBodySearchConfigModel.MaxResultNumber = core.Int64Ptr(int64(1)) + semanticSearchBodySearchConfigModel.SchemaSearchEnabled = core.BoolPtr(true) + + // Construct an instance of the CreateSemanticSearchQueriesOptions model + createSemanticSearchQueriesOptionsModel := new(watsonxdatav3.CreateSemanticSearchQueriesOptions) + createSemanticSearchQueriesOptionsModel.EngineID = core.StringPtr("presto01") + createSemanticSearchQueriesOptionsModel.QueryInput = core.StringPtr("catalog_table") + createSemanticSearchQueriesOptionsModel.SearchConfig = semanticSearchBodySearchConfigModel + createSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListIngestionJobsWithContext(ctx, listIngestionJobsOptionsModel) + _, _, operationErr := watsonxDataService.CreateSemanticSearchQueriesWithContext(ctx, createSemanticSearchQueriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSemanticSearchQueries(createSemanticSearchQueriesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -32385,7 +33726,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListIngestionJobsWithContext(ctx, listIngestionJobsOptionsModel) + _, _, operationErr = watsonxDataService.CreateSemanticSearchQueriesWithContext(ctx, createSemanticSearchQueriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -32399,21 +33740,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listIngestionJobsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createSemanticSearchQueriesPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["start"]).To(Equal([]string{"1"})) - Expect(req.URL.Query()["jobs_per_page"]).To(Equal([]string{fmt.Sprint(int64(1))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"ingestion_jobs": [{"create_if_not_exist": false, "csv_property": {"encoding": "utf-8", "escape_character": "|", "field_delimiter": ",", "header": true, "line_delimiter": "\n"}, "details": "Path does not exist 'demobucket/data/yellow_tripdata_2022-01.parquet'. Detail: [errno 2] No such file or directory", "end_timestamp": "1685088775", "engine_id": "spark123", "engine_name": "sparkdemo", "execute_config": {"driver_cores": 1, "driver_memory": "2G", "executor_cores": 1, "executor_memory": "2G", "num_executors": 1}, "instance_id": "1684432229673971", "job_id": "ingestion-1699459946935", "partition_by": "col1, col2", "schema": "{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}", "source_data_files": "s3://demobucket/data/yellow_tripdata_2022-01.parquet", "source_file_type": "csv", "start_timestamp": "1685084455", "status": "running", "target_table": "demodb.test.targettable", "username": "ibmlhadmin", "validate_csv_header": false}], "first": {"href": "http://api.example.com/collection?start=eyJvZmZzZXQiOjAsImRvbmUiOnRydWV9"}, "next": {"href": "http://api.example.com/collection?start=eyJvZmZzZXQiOjAsImRvbmUiOnRydWV9"}}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"id": "1", "last_search_time": "2024-09-15T14:30:00.000Z", "results": [{"artifact_type": "data_asset", "asset_id": "7f9d8270-496f-4bda-96b9-9891b35c80e9", "catalog_name": "iceberg", "description": "Description", "highlight": {"mapKey": ["Inner"]}, "matched_columns": [{"asset_id": "7f9d8270-496f-4bda-96b9-9891b35c80e9:customer_id", "description": "Description", "highlight": {"mapKey": ["Inner"]}, "name": "customer_id", "semantic_description": "SemanticDescription", "semantic_name": "SemanticName"}], "name": "table1", "path": "/iceberg/california_school/table1", "project_id": "b94b3f1c-3808-44d2-b7e6-4df8d5861950", "provider_type": "cams", "schema_name": "california_school", "search_score": 11, "semantic_description": "SemanticDescription", "semantic_name": "SemanticName", "state": "active", "table_name": "table1", "tags": ["Tags"], "terms": ["Terms"]}], "search_query": "catalog_table"}`) })) }) - It(`Invoke ListIngestionJobs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSemanticSearchQueries successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -32421,51 +33776,67 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListIngestionJobs(nil) + result, response, operationErr := watsonxDataService.CreateSemanticSearchQueries(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListIngestionJobsOptions model - listIngestionJobsOptionsModel := new(watsonxdatav2.ListIngestionJobsOptions) - listIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listIngestionJobsOptionsModel.Start = core.StringPtr("1") - listIngestionJobsOptionsModel.JobsPerPage = core.Int64Ptr(int64(1)) - listIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SemanticSearchBodySearchConfig model + semanticSearchBodySearchConfigModel := new(watsonxdatav3.SemanticSearchBodySearchConfig) + semanticSearchBodySearchConfigModel.ColumnSearchEnabled = core.BoolPtr(true) + semanticSearchBodySearchConfigModel.Fields = []string{"metadata.name", "metadata.description", "metadata.tags"} + semanticSearchBodySearchConfigModel.MaxResultNumber = core.Int64Ptr(int64(1)) + semanticSearchBodySearchConfigModel.SchemaSearchEnabled = core.BoolPtr(true) + + // Construct an instance of the CreateSemanticSearchQueriesOptions model + createSemanticSearchQueriesOptionsModel := new(watsonxdatav3.CreateSemanticSearchQueriesOptions) + createSemanticSearchQueriesOptionsModel.EngineID = core.StringPtr("presto01") + createSemanticSearchQueriesOptionsModel.QueryInput = core.StringPtr("catalog_table") + createSemanticSearchQueriesOptionsModel.SearchConfig = semanticSearchBodySearchConfigModel + createSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) + result, response, operationErr = watsonxDataService.CreateSemanticSearchQueries(createSemanticSearchQueriesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListIngestionJobs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSemanticSearchQueries with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListIngestionJobsOptions model - listIngestionJobsOptionsModel := new(watsonxdatav2.ListIngestionJobsOptions) - listIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listIngestionJobsOptionsModel.Start = core.StringPtr("1") - listIngestionJobsOptionsModel.JobsPerPage = core.Int64Ptr(int64(1)) - listIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SemanticSearchBodySearchConfig model + semanticSearchBodySearchConfigModel := new(watsonxdatav3.SemanticSearchBodySearchConfig) + semanticSearchBodySearchConfigModel.ColumnSearchEnabled = core.BoolPtr(true) + semanticSearchBodySearchConfigModel.Fields = []string{"metadata.name", "metadata.description", "metadata.tags"} + semanticSearchBodySearchConfigModel.MaxResultNumber = core.Int64Ptr(int64(1)) + semanticSearchBodySearchConfigModel.SchemaSearchEnabled = core.BoolPtr(true) + + // Construct an instance of the CreateSemanticSearchQueriesOptions model + createSemanticSearchQueriesOptionsModel := new(watsonxdatav3.CreateSemanticSearchQueriesOptions) + createSemanticSearchQueriesOptionsModel.EngineID = core.StringPtr("presto01") + createSemanticSearchQueriesOptionsModel.QueryInput = core.StringPtr("catalog_table") + createSemanticSearchQueriesOptionsModel.SearchConfig = semanticSearchBodySearchConfigModel + createSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSemanticSearchQueries(createSemanticSearchQueriesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the ListIngestionJobsOptions model with no property values - listIngestionJobsOptionsModelNew := new(watsonxdatav2.ListIngestionJobsOptions) + // Construct a second instance of the CreateSemanticSearchQueriesOptions model with no property values + createSemanticSearchQueriesOptionsModelNew := new(watsonxdatav3.CreateSemanticSearchQueriesOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateSemanticSearchQueries(createSemanticSearchQueriesOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -32480,26 +33851,34 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListIngestionJobs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateSemanticSearchQueries successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListIngestionJobsOptions model - listIngestionJobsOptionsModel := new(watsonxdatav2.ListIngestionJobsOptions) - listIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - listIngestionJobsOptionsModel.Start = core.StringPtr("1") - listIngestionJobsOptionsModel.JobsPerPage = core.Int64Ptr(int64(1)) - listIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SemanticSearchBodySearchConfig model + semanticSearchBodySearchConfigModel := new(watsonxdatav3.SemanticSearchBodySearchConfig) + semanticSearchBodySearchConfigModel.ColumnSearchEnabled = core.BoolPtr(true) + semanticSearchBodySearchConfigModel.Fields = []string{"metadata.name", "metadata.description", "metadata.tags"} + semanticSearchBodySearchConfigModel.MaxResultNumber = core.Int64Ptr(int64(1)) + semanticSearchBodySearchConfigModel.SchemaSearchEnabled = core.BoolPtr(true) + + // Construct an instance of the CreateSemanticSearchQueriesOptions model + createSemanticSearchQueriesOptionsModel := new(watsonxdatav3.CreateSemanticSearchQueriesOptions) + createSemanticSearchQueriesOptionsModel.EngineID = core.StringPtr("presto01") + createSemanticSearchQueriesOptionsModel.QueryInput = core.StringPtr("catalog_table") + createSemanticSearchQueriesOptionsModel.SearchConfig = semanticSearchBodySearchConfigModel + createSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + createSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) + result, response, operationErr := watsonxDataService.CreateSemanticSearchQueries(createSemanticSearchQueriesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -32510,547 +33889,248 @@ var _ = Describe(`WatsonxDataV2`, func() { testServer.Close() }) }) - Context(`Test pagination helper method on response`, func() { - It(`Invoke GetNextStart successfully`, func() { - responseObject := new(watsonxdatav2.IngestionJobCollection) - nextObject := new(watsonxdatav2.IngestionJobCollectionPage) - nextObject.Href = core.StringPtr("ibm.com?start=abc-123") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(Equal(core.StringPtr("abc-123"))) - }) - It(`Invoke GetNextStart without a "Next" property in the response`, func() { - responseObject := new(watsonxdatav2.IngestionJobCollection) - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { - responseObject := new(watsonxdatav2.IngestionJobCollection) - nextObject := new(watsonxdatav2.IngestionJobCollectionPage) - nextObject.Href = core.StringPtr("ibm.com") - responseObject.Next = nextObject - - value, err := responseObject.GetNextStart() - Expect(err).To(BeNil()) - Expect(value).To(BeNil()) - }) - }) - Context(`Using mock server endpoint - paginated response`, func() { + }) + Describe(`DeleteSemanticSearchQueries(deleteSemanticSearchQueriesOptions *DeleteSemanticSearchQueriesOptions)`, func() { + deleteSemanticSearchQueriesPath := "/v3/sal_integration/semantic_search/queries" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { - var requestNumber int = 0 testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listIngestionJobsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSemanticSearchQueriesPath)) + Expect(req.Method).To(Equal("DELETE")) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - requestNumber++ - if requestNumber == 1 { - fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"limit":1,"ingestion_jobs":[{"create_if_not_exist":false,"csv_property":{"encoding":"utf-8","escape_character":"|","field_delimiter":",","header":true,"line_delimiter":"\n"},"details":"Path does not exist 'demobucket/data/yellow_tripdata_2022-01.parquet'. Detail: [errno 2] No such file or directory","end_timestamp":"1685088775","engine_id":"spark123","engine_name":"sparkdemo","execute_config":{"driver_cores":1,"driver_memory":"2G","executor_cores":1,"executor_memory":"2G","num_executors":1},"instance_id":"1684432229673971","job_id":"ingestion-1699459946935","partition_by":"col1, col2","schema":"{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}","source_data_files":"s3://demobucket/data/yellow_tripdata_2022-01.parquet","source_file_type":"csv","start_timestamp":"1685084455","status":"running","target_table":"demodb.test.targettable","username":"ibmlhadmin","validate_csv_header":false}]}`) - } else if requestNumber == 2 { - fmt.Fprintf(res, "%s", `{"total_count":2,"limit":1,"ingestion_jobs":[{"create_if_not_exist":false,"csv_property":{"encoding":"utf-8","escape_character":"|","field_delimiter":",","header":true,"line_delimiter":"\n"},"details":"Path does not exist 'demobucket/data/yellow_tripdata_2022-01.parquet'. Detail: [errno 2] No such file or directory","end_timestamp":"1685088775","engine_id":"spark123","engine_name":"sparkdemo","execute_config":{"driver_cores":1,"driver_memory":"2G","executor_cores":1,"executor_memory":"2G","num_executors":1},"instance_id":"1684432229673971","job_id":"ingestion-1699459946935","partition_by":"col1, col2","schema":"{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}","source_data_files":"s3://demobucket/data/yellow_tripdata_2022-01.parquet","source_file_type":"csv","start_timestamp":"1685084455","status":"running","target_table":"demodb.test.targettable","username":"ibmlhadmin","validate_csv_header":false}]}`) - } else { - res.WriteHeader(400) - } + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["batch_size"]).To(Equal([]string{fmt.Sprint(int64(1))})) + res.WriteHeader(204) })) }) - It(`Use IngestionJobsPager.GetNext successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSemanticSearchQueries successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - listIngestionJobsOptionsModel := &watsonxdatav2.ListIngestionJobsOptions{ - AuthInstanceID: core.StringPtr("testString"), - JobsPerPage: core.Int64Ptr(int64(1)), - } + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteSemanticSearchQueries(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - pager, err := watsonxDataService.NewIngestionJobsPager(listIngestionJobsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) + // Construct an instance of the DeleteSemanticSearchQueriesOptions model + deleteSemanticSearchQueriesOptionsModel := new(watsonxdatav3.DeleteSemanticSearchQueriesOptions) + deleteSemanticSearchQueriesOptionsModel.BatchSize = core.Int64Ptr(int64(1)) + deleteSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - var allResults []watsonxdatav2.IngestionJob - for pager.HasNext() { - nextPage, err := pager.GetNext() - Expect(err).To(BeNil()) - Expect(nextPage).ToNot(BeNil()) - allResults = append(allResults, nextPage...) - } - Expect(len(allResults)).To(Equal(2)) + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteSemanticSearchQueries(deleteSemanticSearchQueriesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) }) - It(`Use IngestionJobsPager.GetAll successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSemanticSearchQueries with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - listIngestionJobsOptionsModel := &watsonxdatav2.ListIngestionJobsOptions{ - AuthInstanceID: core.StringPtr("testString"), - JobsPerPage: core.Int64Ptr(int64(1)), - } - - pager, err := watsonxDataService.NewIngestionJobsPager(listIngestionJobsOptionsModel) - Expect(err).To(BeNil()) - Expect(pager).ToNot(BeNil()) - - allResults, err := pager.GetAll() + // Construct an instance of the DeleteSemanticSearchQueriesOptions model + deleteSemanticSearchQueriesOptionsModel := new(watsonxdatav3.DeleteSemanticSearchQueriesOptions) + deleteSemanticSearchQueriesOptionsModel.BatchSize = core.Int64Ptr(int64(1)) + deleteSemanticSearchQueriesOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSemanticSearchQueriesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - Expect(allResults).ToNot(BeNil()) - Expect(len(allResults)).To(Equal(2)) + response, operationErr := watsonxDataService.DeleteSemanticSearchQueries(deleteSemanticSearchQueriesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() }) }) }) - Describe(`CreateIngestionJobs(createIngestionJobsOptions *CreateIngestionJobsOptions) - Operation response error`, func() { - createIngestionJobsPath := "/ingestion_jobs" - Context(`Using mock server endpoint with invalid JSON response`, func() { + Describe(`DeleteSemanticSearchQueriesByID(deleteSemanticSearchQueriesByIdOptions *DeleteSemanticSearchQueriesByIdOptions)`, func() { + deleteSemanticSearchQueriesByIDPath := "/v3/sal_integration/semantic_search/queries/testString" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createIngestionJobsPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(deleteSemanticSearchQueriesByIDPath)) + Expect(req.Method).To(Equal("DELETE")) + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprint(res, `} this is not valid json {`) + res.WriteHeader(204) })) }) - It(`Invoke CreateIngestionJobs with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSemanticSearchQueriesByID successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the IngestionJobPrototypeCsvProperty model - ingestionJobPrototypeCsvPropertyModel := new(watsonxdatav2.IngestionJobPrototypeCsvProperty) - ingestionJobPrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - ingestionJobPrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - ingestionJobPrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - ingestionJobPrototypeCsvPropertyModel.Header = core.BoolPtr(true) - ingestionJobPrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteSemanticSearchQueriesByID(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Construct an instance of the IngestionJobPrototypeExecuteConfig model - ingestionJobPrototypeExecuteConfigModel := new(watsonxdatav2.IngestionJobPrototypeExecuteConfig) - ingestionJobPrototypeExecuteConfigModel.DriverCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.DriverMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.ExecutorMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.NumExecutors = core.Int64Ptr(int64(1)) + // Construct an instance of the DeleteSemanticSearchQueriesByIdOptions model + deleteSemanticSearchQueriesByIdOptionsModel := new(watsonxdatav3.DeleteSemanticSearchQueriesByIdOptions) + deleteSemanticSearchQueriesByIdOptionsModel.ID = core.StringPtr("testString") + deleteSemanticSearchQueriesByIdOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSemanticSearchQueriesByIdOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Construct an instance of the CreateIngestionJobsOptions model - createIngestionJobsOptionsModel := new(watsonxdatav2.CreateIngestionJobsOptions) - createIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIngestionJobsOptionsModel.JobID = core.StringPtr("ingestion-1699459946935") - createIngestionJobsOptionsModel.SourceDataFiles = core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createIngestionJobsOptionsModel.TargetTable = core.StringPtr("demodb.test.targettable") - createIngestionJobsOptionsModel.Username = core.StringPtr("user1") - createIngestionJobsOptionsModel.CreateIfNotExist = core.BoolPtr(false) - createIngestionJobsOptionsModel.CsvProperty = ingestionJobPrototypeCsvPropertyModel - createIngestionJobsOptionsModel.EngineID = core.StringPtr("spark123") - createIngestionJobsOptionsModel.ExecuteConfig = ingestionJobPrototypeExecuteConfigModel - createIngestionJobsOptionsModel.PartitionBy = core.StringPtr("col1, col2") - createIngestionJobsOptionsModel.Schema = core.StringPtr("{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}") - createIngestionJobsOptionsModel.SourceFileType = core.StringPtr("csv") - createIngestionJobsOptionsModel.ValidateCsvHeader = core.BoolPtr(false) - createIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateIngestionJobs(createIngestionJobsOptionsModel) - Expect(operationErr).ToNot(BeNil()) + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteSemanticSearchQueriesByID(deleteSemanticSearchQueriesByIdOptionsModel) + Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + }) + It(`Invoke DeleteSemanticSearchQueriesByID with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) - // Enable retries and test again - watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateIngestionJobs(createIngestionJobsOptionsModel) + // Construct an instance of the DeleteSemanticSearchQueriesByIdOptions model + deleteSemanticSearchQueriesByIdOptionsModel := new(watsonxdatav3.DeleteSemanticSearchQueriesByIdOptions) + deleteSemanticSearchQueriesByIdOptionsModel.ID = core.StringPtr("testString") + deleteSemanticSearchQueriesByIdOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteSemanticSearchQueriesByIdOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteSemanticSearchQueriesByID(deleteSemanticSearchQueriesByIdOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).To(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteSemanticSearchQueriesByIdOptions model with no property values + deleteSemanticSearchQueriesByIdOptionsModelNew := new(watsonxdatav3.DeleteSemanticSearchQueriesByIdOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteSemanticSearchQueriesByID(deleteSemanticSearchQueriesByIdOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) }) - Describe(`CreateIngestionJobs(createIngestionJobsOptions *CreateIngestionJobsOptions)`, func() { - createIngestionJobsPath := "/ingestion_jobs" - Context(`Using mock server endpoint with timeout`, func() { + Describe(`DeleteSalMetadata(deleteSalMetadataOptions *DeleteSalMetadataOptions)`, func() { + deleteSalMetadataPath := "/v3/sal_metadata" + Context(`Using mock server endpoint`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createIngestionJobsPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) + Expect(req.URL.EscapedPath()).To(Equal(deleteSalMetadataPath)) + Expect(req.Method).To(Equal("DELETE")) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"create_if_not_exist": false, "csv_property": {"encoding": "utf-8", "escape_character": "|", "field_delimiter": ",", "header": true, "line_delimiter": "\n"}, "details": "Path does not exist 'demobucket/data/yellow_tripdata_2022-01.parquet'. Detail: [errno 2] No such file or directory", "end_timestamp": "1685088775", "engine_id": "spark123", "engine_name": "sparkdemo", "execute_config": {"driver_cores": 1, "driver_memory": "2G", "executor_cores": 1, "executor_memory": "2G", "num_executors": 1}, "instance_id": "1684432229673971", "job_id": "ingestion-1699459946935", "partition_by": "col1, col2", "schema": "{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}", "source_data_files": "s3://demobucket/data/yellow_tripdata_2022-01.parquet", "source_file_type": "csv", "start_timestamp": "1685084455", "status": "running", "target_table": "demodb.test.targettable", "username": "ibmlhadmin", "validate_csv_header": false}`) + res.WriteHeader(204) })) }) - It(`Invoke CreateIngestionJobs successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke DeleteSalMetadata successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the IngestionJobPrototypeCsvProperty model - ingestionJobPrototypeCsvPropertyModel := new(watsonxdatav2.IngestionJobPrototypeCsvProperty) - ingestionJobPrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - ingestionJobPrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - ingestionJobPrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - ingestionJobPrototypeCsvPropertyModel.Header = core.BoolPtr(true) - ingestionJobPrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") - - // Construct an instance of the IngestionJobPrototypeExecuteConfig model - ingestionJobPrototypeExecuteConfigModel := new(watsonxdatav2.IngestionJobPrototypeExecuteConfig) - ingestionJobPrototypeExecuteConfigModel.DriverCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.DriverMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.ExecutorMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.NumExecutors = core.Int64Ptr(int64(1)) - - // Construct an instance of the CreateIngestionJobsOptions model - createIngestionJobsOptionsModel := new(watsonxdatav2.CreateIngestionJobsOptions) - createIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIngestionJobsOptionsModel.JobID = core.StringPtr("ingestion-1699459946935") - createIngestionJobsOptionsModel.SourceDataFiles = core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createIngestionJobsOptionsModel.TargetTable = core.StringPtr("demodb.test.targettable") - createIngestionJobsOptionsModel.Username = core.StringPtr("user1") - createIngestionJobsOptionsModel.CreateIfNotExist = core.BoolPtr(false) - createIngestionJobsOptionsModel.CsvProperty = ingestionJobPrototypeCsvPropertyModel - createIngestionJobsOptionsModel.EngineID = core.StringPtr("spark123") - createIngestionJobsOptionsModel.ExecuteConfig = ingestionJobPrototypeExecuteConfigModel - createIngestionJobsOptionsModel.PartitionBy = core.StringPtr("col1, col2") - createIngestionJobsOptionsModel.Schema = core.StringPtr("{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}") - createIngestionJobsOptionsModel.SourceFileType = core.StringPtr("csv") - createIngestionJobsOptionsModel.ValidateCsvHeader = core.BoolPtr(false) - createIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteSalMetadata(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) - // Invoke operation with a Context to test a timeout error - ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateIngestionJobsWithContext(ctx, createIngestionJobsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + // Construct an instance of the DeleteSalMetadataOptions model + deleteSalMetadataOptionsModel := new(watsonxdatav3.DeleteSalMetadataOptions) + deleteSalMetadataOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Disable retries and test again - watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateIngestionJobs(createIngestionJobsOptionsModel) + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteSalMetadata(deleteSalMetadataOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) + }) + It(`Invoke DeleteSalMetadata with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) - // Re-test the timeout error with retries disabled - ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) - defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateIngestionJobsWithContext(ctx, createIngestionJobsOptionsModel) + // Construct an instance of the DeleteSalMetadataOptions model + deleteSalMetadataOptionsModel := new(watsonxdatav3.DeleteSalMetadataOptions) + deleteSalMetadataOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteSalMetadata(deleteSalMetadataOptionsModel) Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) }) AfterEach(func() { testServer.Close() }) }) - Context(`Using mock server endpoint`, func() { + }) + Describe(`ListIngestionJobs(listIngestionJobsOptions *ListIngestionJobsOptions) - Operation response error`, func() { + listIngestionJobsPath := "/v3/lhingestion/api/v1/ingestion/jobs" + Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createIngestionJobsPath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"create_if_not_exist": false, "csv_property": {"encoding": "utf-8", "escape_character": "|", "field_delimiter": ",", "header": true, "line_delimiter": "\n"}, "details": "Path does not exist 'demobucket/data/yellow_tripdata_2022-01.parquet'. Detail: [errno 2] No such file or directory", "end_timestamp": "1685088775", "engine_id": "spark123", "engine_name": "sparkdemo", "execute_config": {"driver_cores": 1, "driver_memory": "2G", "executor_cores": 1, "executor_memory": "2G", "num_executors": 1}, "instance_id": "1684432229673971", "job_id": "ingestion-1699459946935", "partition_by": "col1, col2", "schema": "{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}", "source_data_files": "s3://demobucket/data/yellow_tripdata_2022-01.parquet", "source_file_type": "csv", "start_timestamp": "1685084455", "status": "running", "target_table": "demodb.test.targettable", "username": "ibmlhadmin", "validate_csv_header": false}`) - })) - }) - It(`Invoke CreateIngestionJobs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateIngestionJobs(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - - // Construct an instance of the IngestionJobPrototypeCsvProperty model - ingestionJobPrototypeCsvPropertyModel := new(watsonxdatav2.IngestionJobPrototypeCsvProperty) - ingestionJobPrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - ingestionJobPrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - ingestionJobPrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - ingestionJobPrototypeCsvPropertyModel.Header = core.BoolPtr(true) - ingestionJobPrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") - - // Construct an instance of the IngestionJobPrototypeExecuteConfig model - ingestionJobPrototypeExecuteConfigModel := new(watsonxdatav2.IngestionJobPrototypeExecuteConfig) - ingestionJobPrototypeExecuteConfigModel.DriverCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.DriverMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.ExecutorMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.NumExecutors = core.Int64Ptr(int64(1)) - - // Construct an instance of the CreateIngestionJobsOptions model - createIngestionJobsOptionsModel := new(watsonxdatav2.CreateIngestionJobsOptions) - createIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIngestionJobsOptionsModel.JobID = core.StringPtr("ingestion-1699459946935") - createIngestionJobsOptionsModel.SourceDataFiles = core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createIngestionJobsOptionsModel.TargetTable = core.StringPtr("demodb.test.targettable") - createIngestionJobsOptionsModel.Username = core.StringPtr("user1") - createIngestionJobsOptionsModel.CreateIfNotExist = core.BoolPtr(false) - createIngestionJobsOptionsModel.CsvProperty = ingestionJobPrototypeCsvPropertyModel - createIngestionJobsOptionsModel.EngineID = core.StringPtr("spark123") - createIngestionJobsOptionsModel.ExecuteConfig = ingestionJobPrototypeExecuteConfigModel - createIngestionJobsOptionsModel.PartitionBy = core.StringPtr("col1, col2") - createIngestionJobsOptionsModel.Schema = core.StringPtr("{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}") - createIngestionJobsOptionsModel.SourceFileType = core.StringPtr("csv") - createIngestionJobsOptionsModel.ValidateCsvHeader = core.BoolPtr(false) - createIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateIngestionJobs(createIngestionJobsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - Expect(result).ToNot(BeNil()) - - }) - It(`Invoke CreateIngestionJobs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the IngestionJobPrototypeCsvProperty model - ingestionJobPrototypeCsvPropertyModel := new(watsonxdatav2.IngestionJobPrototypeCsvProperty) - ingestionJobPrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - ingestionJobPrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - ingestionJobPrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - ingestionJobPrototypeCsvPropertyModel.Header = core.BoolPtr(true) - ingestionJobPrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") - - // Construct an instance of the IngestionJobPrototypeExecuteConfig model - ingestionJobPrototypeExecuteConfigModel := new(watsonxdatav2.IngestionJobPrototypeExecuteConfig) - ingestionJobPrototypeExecuteConfigModel.DriverCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.DriverMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.ExecutorMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.NumExecutors = core.Int64Ptr(int64(1)) - - // Construct an instance of the CreateIngestionJobsOptions model - createIngestionJobsOptionsModel := new(watsonxdatav2.CreateIngestionJobsOptions) - createIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIngestionJobsOptionsModel.JobID = core.StringPtr("ingestion-1699459946935") - createIngestionJobsOptionsModel.SourceDataFiles = core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createIngestionJobsOptionsModel.TargetTable = core.StringPtr("demodb.test.targettable") - createIngestionJobsOptionsModel.Username = core.StringPtr("user1") - createIngestionJobsOptionsModel.CreateIfNotExist = core.BoolPtr(false) - createIngestionJobsOptionsModel.CsvProperty = ingestionJobPrototypeCsvPropertyModel - createIngestionJobsOptionsModel.EngineID = core.StringPtr("spark123") - createIngestionJobsOptionsModel.ExecuteConfig = ingestionJobPrototypeExecuteConfigModel - createIngestionJobsOptionsModel.PartitionBy = core.StringPtr("col1, col2") - createIngestionJobsOptionsModel.Schema = core.StringPtr("{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}") - createIngestionJobsOptionsModel.SourceFileType = core.StringPtr("csv") - createIngestionJobsOptionsModel.ValidateCsvHeader = core.BoolPtr(false) - createIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateIngestionJobs(createIngestionJobsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - // Construct a second instance of the CreateIngestionJobsOptions model with no property values - createIngestionJobsOptionsModelNew := new(watsonxdatav2.CreateIngestionJobsOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateIngestionJobs(createIngestionJobsOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - Context(`Using mock server endpoint with missing response body`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Set success status code with no respoonse body - res.WriteHeader(202) - })) - }) - It(`Invoke CreateIngestionJobs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the IngestionJobPrototypeCsvProperty model - ingestionJobPrototypeCsvPropertyModel := new(watsonxdatav2.IngestionJobPrototypeCsvProperty) - ingestionJobPrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - ingestionJobPrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - ingestionJobPrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - ingestionJobPrototypeCsvPropertyModel.Header = core.BoolPtr(true) - ingestionJobPrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") - - // Construct an instance of the IngestionJobPrototypeExecuteConfig model - ingestionJobPrototypeExecuteConfigModel := new(watsonxdatav2.IngestionJobPrototypeExecuteConfig) - ingestionJobPrototypeExecuteConfigModel.DriverCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.DriverMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.ExecutorMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.NumExecutors = core.Int64Ptr(int64(1)) - - // Construct an instance of the CreateIngestionJobsOptions model - createIngestionJobsOptionsModel := new(watsonxdatav2.CreateIngestionJobsOptions) - createIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIngestionJobsOptionsModel.JobID = core.StringPtr("ingestion-1699459946935") - createIngestionJobsOptionsModel.SourceDataFiles = core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createIngestionJobsOptionsModel.TargetTable = core.StringPtr("demodb.test.targettable") - createIngestionJobsOptionsModel.Username = core.StringPtr("user1") - createIngestionJobsOptionsModel.CreateIfNotExist = core.BoolPtr(false) - createIngestionJobsOptionsModel.CsvProperty = ingestionJobPrototypeCsvPropertyModel - createIngestionJobsOptionsModel.EngineID = core.StringPtr("spark123") - createIngestionJobsOptionsModel.ExecuteConfig = ingestionJobPrototypeExecuteConfigModel - createIngestionJobsOptionsModel.PartitionBy = core.StringPtr("col1, col2") - createIngestionJobsOptionsModel.Schema = core.StringPtr("{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}") - createIngestionJobsOptionsModel.SourceFileType = core.StringPtr("csv") - createIngestionJobsOptionsModel.ValidateCsvHeader = core.BoolPtr(false) - createIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation - result, response, operationErr := watsonxDataService.CreateIngestionJobs(createIngestionJobsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - - // Verify a nil result - Expect(result).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptions *CreateIngestionJobsLocalFilesOptions) - Operation response error`, func() { - createIngestionJobsLocalFilesPath := "/ingestion_jobs_local_files" - Context(`Using mock server endpoint with invalid JSON response`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createIngestionJobsLocalFilesPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listIngestionJobsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreateIngestionJobsLocalFiles with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListIngestionJobs with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateIngestionJobsLocalFilesOptions model - createIngestionJobsLocalFilesOptionsModel := new(watsonxdatav2.CreateIngestionJobsLocalFilesOptions) - createIngestionJobsLocalFilesOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceDataFile = CreateMockReader("This is a mock file.") - createIngestionJobsLocalFilesOptionsModel.TargetTable = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.JobID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.Username = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceDataFileContentType = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceFileType = core.StringPtr("csv") - createIngestionJobsLocalFilesOptionsModel.CsvProperty = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.CreateIfNotExist = core.BoolPtr(false) - createIngestionJobsLocalFilesOptionsModel.ValidateCsvHeader = core.BoolPtr(false) - createIngestionJobsLocalFilesOptionsModel.ExecuteConfig = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.EngineID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListIngestionJobsOptions model + listIngestionJobsOptionsModel := new(watsonxdatav3.ListIngestionJobsOptions) + listIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listIngestionJobsOptionsModel.Start = core.StringPtr("testString") + listIngestionJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptionsModel) + result, response, operationErr := watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptionsModel) + result, response, operationErr = watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -33060,30 +34140,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptions *CreateIngestionJobsLocalFilesOptions)`, func() { - createIngestionJobsLocalFilesPath := "/ingestion_jobs_local_files" + Describe(`ListIngestionJobs(listIngestionJobsOptions *ListIngestionJobsOptions)`, func() { + listIngestionJobsPath := "/v3/lhingestion/api/v1/ingestion/jobs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createIngestionJobsLocalFilesPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listIngestionJobsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"create_if_not_exist": false, "csv_property": {"encoding": "utf-8", "escape_character": "|", "field_delimiter": ",", "header": true, "line_delimiter": "\n"}, "details": "Path does not exist 'demobucket/data/yellow_tripdata_2022-01.parquet'. Detail: [errno 2] No such file or directory", "end_timestamp": "1685088775", "engine_id": "spark123", "engine_name": "sparkdemo", "execute_config": {"driver_cores": 1, "driver_memory": "2G", "executor_cores": 1, "executor_memory": "2G", "num_executors": 1}, "instance_id": "1684432229673971", "job_id": "ingestion-1699459946935", "partition_by": "col1, col2", "schema": "{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}", "source_data_files": "s3://demobucket/data/yellow_tripdata_2022-01.parquet", "source_file_type": "csv", "start_timestamp": "1685084455", "status": "running", "target_table": "demodb.test.targettable", "username": "ibmlhadmin", "validate_csv_header": false}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"limit": 0, "offset": 0, "total_count": 0, "jobs": [{"instance_id": "InstanceID", "job_id": "JobID", "application_id": "ApplicationID", "username": "Username", "start_timestamp": "2019-01-01T12:00:00.000Z", "end_timestamp": "2019-01-01T12:00:00.000Z", "status": "Status", "source_data_files": "SourceDataFiles", "target_table": "TargetTable", "details": "Details", "engine_logs": "EngineLogs", "engine_id": "EngineID", "engine_name": "EngineName", "partition_by": "column1,column2", "is_new_schema": false, "is_new_table": false}], "first": {"href": "Href"}, "last": {"href": "Href"}, "next": {"href": "Href"}}`) })) }) - It(`Invoke CreateIngestionJobsLocalFiles successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListIngestionJobs successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -33091,32 +34173,23 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the CreateIngestionJobsLocalFilesOptions model - createIngestionJobsLocalFilesOptionsModel := new(watsonxdatav2.CreateIngestionJobsLocalFilesOptions) - createIngestionJobsLocalFilesOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceDataFile = CreateMockReader("This is a mock file.") - createIngestionJobsLocalFilesOptionsModel.TargetTable = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.JobID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.Username = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceDataFileContentType = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceFileType = core.StringPtr("csv") - createIngestionJobsLocalFilesOptionsModel.CsvProperty = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.CreateIfNotExist = core.BoolPtr(false) - createIngestionJobsLocalFilesOptionsModel.ValidateCsvHeader = core.BoolPtr(false) - createIngestionJobsLocalFilesOptionsModel.ExecuteConfig = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.EngineID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListIngestionJobsOptions model + listIngestionJobsOptionsModel := new(watsonxdatav3.ListIngestionJobsOptions) + listIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listIngestionJobsOptionsModel.Start = core.StringPtr("testString") + listIngestionJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreateIngestionJobsLocalFilesWithContext(ctx, createIngestionJobsLocalFilesOptionsModel) + _, _, operationErr := watsonxDataService.ListIngestionJobsWithContext(ctx, listIngestionJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptionsModel) + result, response, operationErr := watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -33124,7 +34197,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreateIngestionJobsLocalFilesWithContext(ctx, createIngestionJobsLocalFilesOptionsModel) + _, _, operationErr = watsonxDataService.ListIngestionJobsWithContext(ctx, listIngestionJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -33138,19 +34211,21 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createIngestionJobsLocalFilesPath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(listIngestionJobsPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["start"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["limit"]).To(Equal([]string{fmt.Sprint(int64(10))})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(202) - fmt.Fprintf(res, "%s", `{"create_if_not_exist": false, "csv_property": {"encoding": "utf-8", "escape_character": "|", "field_delimiter": ",", "header": true, "line_delimiter": "\n"}, "details": "Path does not exist 'demobucket/data/yellow_tripdata_2022-01.parquet'. Detail: [errno 2] No such file or directory", "end_timestamp": "1685088775", "engine_id": "spark123", "engine_name": "sparkdemo", "execute_config": {"driver_cores": 1, "driver_memory": "2G", "executor_cores": 1, "executor_memory": "2G", "num_executors": 1}, "instance_id": "1684432229673971", "job_id": "ingestion-1699459946935", "partition_by": "col1, col2", "schema": "{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}", "source_data_files": "s3://demobucket/data/yellow_tripdata_2022-01.parquet", "source_file_type": "csv", "start_timestamp": "1685084455", "status": "running", "target_table": "demodb.test.targettable", "username": "ibmlhadmin", "validate_csv_header": false}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"limit": 0, "offset": 0, "total_count": 0, "jobs": [{"instance_id": "InstanceID", "job_id": "JobID", "application_id": "ApplicationID", "username": "Username", "start_timestamp": "2019-01-01T12:00:00.000Z", "end_timestamp": "2019-01-01T12:00:00.000Z", "status": "Status", "source_data_files": "SourceDataFiles", "target_table": "TargetTable", "details": "Details", "engine_logs": "EngineLogs", "engine_id": "EngineID", "engine_name": "EngineName", "partition_by": "column1,column2", "is_new_schema": false, "is_new_table": false}], "first": {"href": "Href"}, "last": {"href": "Href"}, "next": {"href": "Href"}}`) })) }) - It(`Invoke CreateIngestionJobsLocalFiles successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListIngestionJobs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -33158,69 +34233,51 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreateIngestionJobsLocalFiles(nil) + result, response, operationErr := watsonxDataService.ListIngestionJobs(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the CreateIngestionJobsLocalFilesOptions model - createIngestionJobsLocalFilesOptionsModel := new(watsonxdatav2.CreateIngestionJobsLocalFilesOptions) - createIngestionJobsLocalFilesOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceDataFile = CreateMockReader("This is a mock file.") - createIngestionJobsLocalFilesOptionsModel.TargetTable = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.JobID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.Username = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceDataFileContentType = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceFileType = core.StringPtr("csv") - createIngestionJobsLocalFilesOptionsModel.CsvProperty = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.CreateIfNotExist = core.BoolPtr(false) - createIngestionJobsLocalFilesOptionsModel.ValidateCsvHeader = core.BoolPtr(false) - createIngestionJobsLocalFilesOptionsModel.ExecuteConfig = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.EngineID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListIngestionJobsOptions model + listIngestionJobsOptionsModel := new(watsonxdatav3.ListIngestionJobsOptions) + listIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listIngestionJobsOptionsModel.Start = core.StringPtr("testString") + listIngestionJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptionsModel) + result, response, operationErr = watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreateIngestionJobsLocalFiles with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListIngestionJobs with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateIngestionJobsLocalFilesOptions model - createIngestionJobsLocalFilesOptionsModel := new(watsonxdatav2.CreateIngestionJobsLocalFilesOptions) - createIngestionJobsLocalFilesOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceDataFile = CreateMockReader("This is a mock file.") - createIngestionJobsLocalFilesOptionsModel.TargetTable = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.JobID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.Username = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceDataFileContentType = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceFileType = core.StringPtr("csv") - createIngestionJobsLocalFilesOptionsModel.CsvProperty = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.CreateIfNotExist = core.BoolPtr(false) - createIngestionJobsLocalFilesOptionsModel.ValidateCsvHeader = core.BoolPtr(false) - createIngestionJobsLocalFilesOptionsModel.ExecuteConfig = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.EngineID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListIngestionJobsOptions model + listIngestionJobsOptionsModel := new(watsonxdatav3.ListIngestionJobsOptions) + listIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listIngestionJobsOptionsModel.Start = core.StringPtr("testString") + listIngestionJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptionsModel) + result, response, operationErr := watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreateIngestionJobsLocalFilesOptions model with no property values - createIngestionJobsLocalFilesOptionsModelNew := new(watsonxdatav2.CreateIngestionJobsLocalFilesOptions) + // Construct a second instance of the ListIngestionJobsOptions model with no property values + listIngestionJobsOptionsModelNew := new(watsonxdatav3.ListIngestionJobsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptionsModelNew) + result, response, operationErr = watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -33235,35 +34292,26 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(202) + res.WriteHeader(200) })) }) - It(`Invoke CreateIngestionJobsLocalFiles successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListIngestionJobs successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the CreateIngestionJobsLocalFilesOptions model - createIngestionJobsLocalFilesOptionsModel := new(watsonxdatav2.CreateIngestionJobsLocalFilesOptions) - createIngestionJobsLocalFilesOptionsModel.AuthInstanceID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceDataFile = CreateMockReader("This is a mock file.") - createIngestionJobsLocalFilesOptionsModel.TargetTable = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.JobID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.Username = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceDataFileContentType = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.SourceFileType = core.StringPtr("csv") - createIngestionJobsLocalFilesOptionsModel.CsvProperty = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.CreateIfNotExist = core.BoolPtr(false) - createIngestionJobsLocalFilesOptionsModel.ValidateCsvHeader = core.BoolPtr(false) - createIngestionJobsLocalFilesOptionsModel.ExecuteConfig = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.EngineID = core.StringPtr("testString") - createIngestionJobsLocalFilesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListIngestionJobsOptions model + listIngestionJobsOptionsModel := new(watsonxdatav3.ListIngestionJobsOptions) + listIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") + listIngestionJobsOptionsModel.Start = core.StringPtr("testString") + listIngestionJobsOptionsModel.Limit = core.Int64Ptr(int64(10)) + listIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreateIngestionJobsLocalFiles(createIngestionJobsLocalFilesOptionsModel) + result, response, operationErr := watsonxDataService.ListIngestionJobs(listIngestionJobsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -33274,46 +34322,261 @@ var _ = Describe(`WatsonxDataV2`, func() { testServer.Close() }) }) + Context(`Test pagination helper method on response`, func() { + It(`Invoke GetNextStart successfully`, func() { + responseObject := new(watsonxdatav3.IngestionJobCollection) + nextObject := new(watsonxdatav3.PagedResultsLink) + nextObject.Href = core.StringPtr("ibm.com?start=abc-123") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(Equal(core.StringPtr("abc-123"))) + }) + It(`Invoke GetNextStart without a "Next" property in the response`, func() { + responseObject := new(watsonxdatav3.IngestionJobCollection) + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + It(`Invoke GetNextStart without any query params in the "Next" URL`, func() { + responseObject := new(watsonxdatav3.IngestionJobCollection) + nextObject := new(watsonxdatav3.PagedResultsLink) + nextObject.Href = core.StringPtr("ibm.com") + responseObject.Next = nextObject + + value, err := responseObject.GetNextStart() + Expect(err).To(BeNil()) + Expect(value).To(BeNil()) + }) + }) + Context(`Using mock server endpoint - paginated response`, func() { + BeforeEach(func() { + var requestNumber int = 0 + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(listIngestionJobsPath)) + Expect(req.Method).To(Equal("GET")) + + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(200) + requestNumber++ + if requestNumber == 1 { + fmt.Fprintf(res, "%s", `{"next":{"href":"https://myhost.com/somePath?start=1"},"total_count":2,"jobs":[{"instance_id":"InstanceID","job_id":"JobID","application_id":"ApplicationID","username":"Username","start_timestamp":"2019-01-01T12:00:00.000Z","end_timestamp":"2019-01-01T12:00:00.000Z","status":"Status","source_data_files":"SourceDataFiles","target_table":"TargetTable","details":"Details","engine_logs":"EngineLogs","engine_id":"EngineID","engine_name":"EngineName","partition_by":"column1,column2","is_new_schema":false,"is_new_table":false}],"limit":1}`) + } else if requestNumber == 2 { + fmt.Fprintf(res, "%s", `{"total_count":2,"jobs":[{"instance_id":"InstanceID","job_id":"JobID","application_id":"ApplicationID","username":"Username","start_timestamp":"2019-01-01T12:00:00.000Z","end_timestamp":"2019-01-01T12:00:00.000Z","status":"Status","source_data_files":"SourceDataFiles","target_table":"TargetTable","details":"Details","engine_logs":"EngineLogs","engine_id":"EngineID","engine_name":"EngineName","partition_by":"column1,column2","is_new_schema":false,"is_new_table":false}],"limit":1}`) + } else { + res.WriteHeader(400) + } + })) + }) + It(`Use IngestionJobsPager.GetNext successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + listIngestionJobsOptionsModel := &watsonxdatav3.ListIngestionJobsOptions{ + AuthInstanceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := watsonxDataService.NewIngestionJobsPager(listIngestionJobsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + var allResults []watsonxdatav3.IngestionJob + for pager.HasNext() { + nextPage, err := pager.GetNext() + Expect(err).To(BeNil()) + Expect(nextPage).ToNot(BeNil()) + allResults = append(allResults, nextPage...) + } + Expect(len(allResults)).To(Equal(2)) + }) + It(`Use IngestionJobsPager.GetAll successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + listIngestionJobsOptionsModel := &watsonxdatav3.ListIngestionJobsOptions{ + AuthInstanceID: core.StringPtr("testString"), + Limit: core.Int64Ptr(int64(10)), + } + + pager, err := watsonxDataService.NewIngestionJobsPager(listIngestionJobsOptionsModel) + Expect(err).To(BeNil()) + Expect(pager).ToNot(BeNil()) + + allResults, err := pager.GetAll() + Expect(err).To(BeNil()) + Expect(allResults).ToNot(BeNil()) + Expect(len(allResults)).To(Equal(2)) + }) + }) }) - Describe(`GetIngestionJob(getIngestionJobOptions *GetIngestionJobOptions) - Operation response error`, func() { - getIngestionJobPath := "/ingestion_jobs/testString" + Describe(`CreateIngestionJob(createIngestionJobOptions *CreateIngestionJobOptions) - Operation response error`, func() { + createIngestionJobPath := "/v3/lhingestion/api/v1/ingestion/jobs" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getIngestionJobPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createIngestionJobPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetIngestionJob with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateIngestionJob with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetIngestionJobOptions model - getIngestionJobOptionsModel := new(watsonxdatav2.GetIngestionJobOptions) - getIngestionJobOptionsModel.JobID = core.StringPtr("testString") - getIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") - getIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SchemaTransformation model + schemaTransformationModel := new(watsonxdatav3.SchemaTransformation) + schemaTransformationModel.OldColumn = core.StringPtr("old_column_name") + schemaTransformationModel.NewColumn = core.StringPtr("new_column_name") + schemaTransformationModel.NewType = core.StringPtr("string") + + // Construct an instance of the BucketDetails model + bucketDetailsModel := new(watsonxdatav3.BucketDetails) + bucketDetailsModel.AccessKey = core.StringPtr("testString") + bucketDetailsModel.AccountName = core.StringPtr("testString") + bucketDetailsModel.ApplicationID = core.StringPtr("testString") + bucketDetailsModel.ContainerName = core.StringPtr("testString") + bucketDetailsModel.DirectoryID = core.StringPtr("testString") + bucketDetailsModel.Endpoint = core.StringPtr("testString") + bucketDetailsModel.Region = core.StringPtr("testString") + bucketDetailsModel.SecretKey = core.StringPtr("testString") + bucketDetailsModel.AuthMode = core.StringPtr("aws_assume_role") + bucketDetailsModel.RoleArn = core.StringPtr("testString") + bucketDetailsModel.ManagedBy = core.StringPtr("testString") + bucketDetailsModel.Name = core.StringPtr("testString") + bucketDetailsModel.Type = core.StringPtr("adls_gen1") + + // Construct an instance of the IcebergSourceTable model + icebergSourceTableModel := new(watsonxdatav3.IcebergSourceTable) + icebergSourceTableModel.SchemaName = core.StringPtr("testString") + icebergSourceTableModel.TableName = core.StringPtr("testString") + icebergSourceTableModel.CatalogName = core.StringPtr("testString") + icebergSourceTableModel.WarehouseName = core.StringPtr("testString") + icebergSourceTableModel.SnapshotID = core.Int64Ptr(int64(0)) + + // Construct an instance of the DbConnectionModel model + dbConnectionModelModel := new(watsonxdatav3.DbConnectionModel) + dbConnectionModelModel.DatabaseID = core.StringPtr("testString") + dbConnectionModelModel.DbType = core.StringPtr("testString") + dbConnectionModelModel.Host = core.StringPtr("testString") + dbConnectionModelModel.Port = core.StringPtr("testString") + dbConnectionModelModel.DbName = core.StringPtr("testString") + dbConnectionModelModel.DbUsername = core.StringPtr("testString") + dbConnectionModelModel.Password = core.StringPtr("testString") + dbConnectionModelModel.AuthenticationValue = core.StringPtr("testString") + dbConnectionModelModel.IsSsl = core.BoolPtr(false) + dbConnectionModelModel.CertExtension = core.StringPtr("testString") + dbConnectionModelModel.CertContent = core.StringPtr("testString") + dbConnectionModelModel.ConnectionMode = core.StringPtr("testString") + dbConnectionModelModel.ConnectionModeValue = core.StringPtr("testString") + dbConnectionModelModel.JdbcURL = core.StringPtr("testString") + + // Construct an instance of the FileFormatProperties model + fileFormatPropertiesModel := new(watsonxdatav3.FileFormatProperties) + fileFormatPropertiesModel.Encoding = core.StringPtr("testString") + fileFormatPropertiesModel.EscapeCharacter = core.StringPtr("testString") + fileFormatPropertiesModel.FieldDelimiter = core.StringPtr("testString") + fileFormatPropertiesModel.Header = core.BoolPtr(true) + fileFormatPropertiesModel.LineDelimiter = core.StringPtr("testString") + + // Construct an instance of the SourceDetails model + sourceDetailsModel := new(watsonxdatav3.SourceDetails) + sourceDetailsModel.FilePaths = core.StringPtr("testString") + sourceDetailsModel.FileType = core.StringPtr("csv") + sourceDetailsModel.SourceType = core.StringPtr("STORAGE") + sourceDetailsModel.SchemaTransformations = []watsonxdatav3.SchemaTransformation{*schemaTransformationModel} + sourceDetailsModel.SchemaName = core.StringPtr("testString") + sourceDetailsModel.TableName = core.StringPtr("testString") + sourceDetailsModel.BucketDetails = bucketDetailsModel + sourceDetailsModel.IcebergSourceTable = icebergSourceTableModel + sourceDetailsModel.SourceDatabase = dbConnectionModelModel + sourceDetailsModel.FileFormatProperties = fileFormatPropertiesModel + sourceDetailsModel.IsLocalIngestion = core.BoolPtr(false) + + // Construct an instance of the TargetDetails model + targetDetailsModel := new(watsonxdatav3.TargetDetails) + targetDetailsModel.Catalog = core.StringPtr("testString") + targetDetailsModel.Schema = core.StringPtr("testString") + targetDetailsModel.Table = core.StringPtr("testString") + targetDetailsModel.WriteMode = core.StringPtr("testString") + targetDetailsModel.MergeOnRead = core.BoolPtr(false) + targetDetailsModel.SchemaMode = core.StringPtr("testString") + targetDetailsModel.SchemaInfer = core.BoolPtr(true) + targetDetailsModel.CatalogURI = core.StringPtr("testString") + targetDetailsModel.BucketDetails = bucketDetailsModel + targetDetailsModel.Location = core.StringPtr("testString") + targetDetailsModel.IsNewSchema = core.BoolPtr(false) + targetDetailsModel.IsNewTable = core.BoolPtr(false) + + // Construct an instance of the ExecuteConfig model + executeConfigModel := new(watsonxdatav3.ExecuteConfig) + executeConfigModel.DriverMemory = core.StringPtr("testString") + executeConfigModel.DriverCores = core.Int64Ptr(int64(1)) + executeConfigModel.ExecutorMemory = core.StringPtr("testString") + executeConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) + executeConfigModel.NumExecutors = core.Int64Ptr(int64(1)) + + // Construct an instance of the IngestionEngine model + ingestionEngineModel := new(watsonxdatav3.IngestionEngine) + ingestionEngineModel.EngineID = core.StringPtr("testString") + ingestionEngineModel.Name = core.StringPtr("testString") + ingestionEngineModel.Endpoint = core.StringPtr("testString") + ingestionEngineModel.Origin = core.StringPtr("testString") + ingestionEngineModel.ExecuteConfig = executeConfigModel + ingestionEngineModel.BucketDetails = bucketDetailsModel + ingestionEngineModel.LogPath = core.StringPtr("testString") + + // Construct an instance of the CapacityDetails model + capacityDetailsModel := new(watsonxdatav3.CapacityDetails) + capacityDetailsModel.ID = CreateMockUUID("6f51248a-4cda-459a-b141-eb9b76bb6689") + + // Construct an instance of the CreateIngestionJobOptions model + createIngestionJobOptionsModel := new(watsonxdatav3.CreateIngestionJobOptions) + createIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") + createIngestionJobOptionsModel.ID = core.StringPtr("testString") + createIngestionJobOptionsModel.Source = sourceDetailsModel + createIngestionJobOptionsModel.Target = targetDetailsModel + createIngestionJobOptionsModel.Engine = ingestionEngineModel + createIngestionJobOptionsModel.EngineID = core.StringPtr("spark123") + createIngestionJobOptionsModel.ExecuteConfig = executeConfigModel + createIngestionJobOptionsModel.SourceIcebergTable = icebergSourceTableModel + createIngestionJobOptionsModel.PartitionBy = core.StringPtr("column1,column2") + createIngestionJobOptionsModel.Capacity = capacityDetailsModel + createIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) + result, response, operationErr := watsonxDataService.CreateIngestionJob(createIngestionJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) + result, response, operationErr = watsonxDataService.CreateIngestionJob(createIngestionJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -33323,30 +34586,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetIngestionJob(getIngestionJobOptions *GetIngestionJobOptions)`, func() { - getIngestionJobPath := "/ingestion_jobs/testString" + Describe(`CreateIngestionJob(createIngestionJobOptions *CreateIngestionJobOptions)`, func() { + createIngestionJobPath := "/v3/lhingestion/api/v1/ingestion/jobs" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getIngestionJobPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createIngestionJobPath)) + Expect(req.Method).To(Equal("POST")) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - // Sleep a short time to support a timeout test - time.Sleep(100 * time.Millisecond) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Sleep a short time to support a timeout test + time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"create_if_not_exist": false, "csv_property": {"encoding": "utf-8", "escape_character": "|", "field_delimiter": ",", "header": true, "line_delimiter": "\n"}, "details": "Path does not exist 'demobucket/data/yellow_tripdata_2022-01.parquet'. Detail: [errno 2] No such file or directory", "end_timestamp": "1685088775", "engine_id": "spark123", "engine_name": "sparkdemo", "execute_config": {"driver_cores": 1, "driver_memory": "2G", "executor_cores": 1, "executor_memory": "2G", "num_executors": 1}, "instance_id": "1684432229673971", "job_id": "ingestion-1699459946935", "partition_by": "col1, col2", "schema": "{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}", "source_data_files": "s3://demobucket/data/yellow_tripdata_2022-01.parquet", "source_file_type": "csv", "start_timestamp": "1685084455", "status": "running", "target_table": "demodb.test.targettable", "username": "ibmlhadmin", "validate_csv_header": false}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"instance_id": "InstanceID", "job_id": "JobID", "application_id": "ApplicationID", "username": "Username", "start_timestamp": "2019-01-01T12:00:00.000Z", "end_timestamp": "2019-01-01T12:00:00.000Z", "status": "Status", "source_data_files": "SourceDataFiles", "target_table": "TargetTable", "details": "Details", "engine_logs": "EngineLogs", "engine_id": "EngineID", "engine_name": "EngineName", "partition_by": "column1,column2", "is_new_schema": false, "is_new_table": false}`) })) }) - It(`Invoke GetIngestionJob successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateIngestionJob successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -33354,22 +34633,136 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetIngestionJobOptions model - getIngestionJobOptionsModel := new(watsonxdatav2.GetIngestionJobOptions) - getIngestionJobOptionsModel.JobID = core.StringPtr("testString") - getIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") - getIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SchemaTransformation model + schemaTransformationModel := new(watsonxdatav3.SchemaTransformation) + schemaTransformationModel.OldColumn = core.StringPtr("old_column_name") + schemaTransformationModel.NewColumn = core.StringPtr("new_column_name") + schemaTransformationModel.NewType = core.StringPtr("string") + + // Construct an instance of the BucketDetails model + bucketDetailsModel := new(watsonxdatav3.BucketDetails) + bucketDetailsModel.AccessKey = core.StringPtr("testString") + bucketDetailsModel.AccountName = core.StringPtr("testString") + bucketDetailsModel.ApplicationID = core.StringPtr("testString") + bucketDetailsModel.ContainerName = core.StringPtr("testString") + bucketDetailsModel.DirectoryID = core.StringPtr("testString") + bucketDetailsModel.Endpoint = core.StringPtr("testString") + bucketDetailsModel.Region = core.StringPtr("testString") + bucketDetailsModel.SecretKey = core.StringPtr("testString") + bucketDetailsModel.AuthMode = core.StringPtr("aws_assume_role") + bucketDetailsModel.RoleArn = core.StringPtr("testString") + bucketDetailsModel.ManagedBy = core.StringPtr("testString") + bucketDetailsModel.Name = core.StringPtr("testString") + bucketDetailsModel.Type = core.StringPtr("adls_gen1") + + // Construct an instance of the IcebergSourceTable model + icebergSourceTableModel := new(watsonxdatav3.IcebergSourceTable) + icebergSourceTableModel.SchemaName = core.StringPtr("testString") + icebergSourceTableModel.TableName = core.StringPtr("testString") + icebergSourceTableModel.CatalogName = core.StringPtr("testString") + icebergSourceTableModel.WarehouseName = core.StringPtr("testString") + icebergSourceTableModel.SnapshotID = core.Int64Ptr(int64(0)) + + // Construct an instance of the DbConnectionModel model + dbConnectionModelModel := new(watsonxdatav3.DbConnectionModel) + dbConnectionModelModel.DatabaseID = core.StringPtr("testString") + dbConnectionModelModel.DbType = core.StringPtr("testString") + dbConnectionModelModel.Host = core.StringPtr("testString") + dbConnectionModelModel.Port = core.StringPtr("testString") + dbConnectionModelModel.DbName = core.StringPtr("testString") + dbConnectionModelModel.DbUsername = core.StringPtr("testString") + dbConnectionModelModel.Password = core.StringPtr("testString") + dbConnectionModelModel.AuthenticationValue = core.StringPtr("testString") + dbConnectionModelModel.IsSsl = core.BoolPtr(false) + dbConnectionModelModel.CertExtension = core.StringPtr("testString") + dbConnectionModelModel.CertContent = core.StringPtr("testString") + dbConnectionModelModel.ConnectionMode = core.StringPtr("testString") + dbConnectionModelModel.ConnectionModeValue = core.StringPtr("testString") + dbConnectionModelModel.JdbcURL = core.StringPtr("testString") + + // Construct an instance of the FileFormatProperties model + fileFormatPropertiesModel := new(watsonxdatav3.FileFormatProperties) + fileFormatPropertiesModel.Encoding = core.StringPtr("testString") + fileFormatPropertiesModel.EscapeCharacter = core.StringPtr("testString") + fileFormatPropertiesModel.FieldDelimiter = core.StringPtr("testString") + fileFormatPropertiesModel.Header = core.BoolPtr(true) + fileFormatPropertiesModel.LineDelimiter = core.StringPtr("testString") + + // Construct an instance of the SourceDetails model + sourceDetailsModel := new(watsonxdatav3.SourceDetails) + sourceDetailsModel.FilePaths = core.StringPtr("testString") + sourceDetailsModel.FileType = core.StringPtr("csv") + sourceDetailsModel.SourceType = core.StringPtr("STORAGE") + sourceDetailsModel.SchemaTransformations = []watsonxdatav3.SchemaTransformation{*schemaTransformationModel} + sourceDetailsModel.SchemaName = core.StringPtr("testString") + sourceDetailsModel.TableName = core.StringPtr("testString") + sourceDetailsModel.BucketDetails = bucketDetailsModel + sourceDetailsModel.IcebergSourceTable = icebergSourceTableModel + sourceDetailsModel.SourceDatabase = dbConnectionModelModel + sourceDetailsModel.FileFormatProperties = fileFormatPropertiesModel + sourceDetailsModel.IsLocalIngestion = core.BoolPtr(false) + + // Construct an instance of the TargetDetails model + targetDetailsModel := new(watsonxdatav3.TargetDetails) + targetDetailsModel.Catalog = core.StringPtr("testString") + targetDetailsModel.Schema = core.StringPtr("testString") + targetDetailsModel.Table = core.StringPtr("testString") + targetDetailsModel.WriteMode = core.StringPtr("testString") + targetDetailsModel.MergeOnRead = core.BoolPtr(false) + targetDetailsModel.SchemaMode = core.StringPtr("testString") + targetDetailsModel.SchemaInfer = core.BoolPtr(true) + targetDetailsModel.CatalogURI = core.StringPtr("testString") + targetDetailsModel.BucketDetails = bucketDetailsModel + targetDetailsModel.Location = core.StringPtr("testString") + targetDetailsModel.IsNewSchema = core.BoolPtr(false) + targetDetailsModel.IsNewTable = core.BoolPtr(false) + + // Construct an instance of the ExecuteConfig model + executeConfigModel := new(watsonxdatav3.ExecuteConfig) + executeConfigModel.DriverMemory = core.StringPtr("testString") + executeConfigModel.DriverCores = core.Int64Ptr(int64(1)) + executeConfigModel.ExecutorMemory = core.StringPtr("testString") + executeConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) + executeConfigModel.NumExecutors = core.Int64Ptr(int64(1)) + + // Construct an instance of the IngestionEngine model + ingestionEngineModel := new(watsonxdatav3.IngestionEngine) + ingestionEngineModel.EngineID = core.StringPtr("testString") + ingestionEngineModel.Name = core.StringPtr("testString") + ingestionEngineModel.Endpoint = core.StringPtr("testString") + ingestionEngineModel.Origin = core.StringPtr("testString") + ingestionEngineModel.ExecuteConfig = executeConfigModel + ingestionEngineModel.BucketDetails = bucketDetailsModel + ingestionEngineModel.LogPath = core.StringPtr("testString") + + // Construct an instance of the CapacityDetails model + capacityDetailsModel := new(watsonxdatav3.CapacityDetails) + capacityDetailsModel.ID = CreateMockUUID("6f51248a-4cda-459a-b141-eb9b76bb6689") + + // Construct an instance of the CreateIngestionJobOptions model + createIngestionJobOptionsModel := new(watsonxdatav3.CreateIngestionJobOptions) + createIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") + createIngestionJobOptionsModel.ID = core.StringPtr("testString") + createIngestionJobOptionsModel.Source = sourceDetailsModel + createIngestionJobOptionsModel.Target = targetDetailsModel + createIngestionJobOptionsModel.Engine = ingestionEngineModel + createIngestionJobOptionsModel.EngineID = core.StringPtr("spark123") + createIngestionJobOptionsModel.ExecuteConfig = executeConfigModel + createIngestionJobOptionsModel.SourceIcebergTable = icebergSourceTableModel + createIngestionJobOptionsModel.PartitionBy = core.StringPtr("column1,column2") + createIngestionJobOptionsModel.Capacity = capacityDetailsModel + createIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetIngestionJobWithContext(ctx, getIngestionJobOptionsModel) + _, _, operationErr := watsonxDataService.CreateIngestionJobWithContext(ctx, createIngestionJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) + result, response, operationErr := watsonxDataService.CreateIngestionJob(createIngestionJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -33377,7 +34770,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetIngestionJobWithContext(ctx, getIngestionJobOptionsModel) + _, _, operationErr = watsonxDataService.CreateIngestionJobWithContext(ctx, createIngestionJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -33391,19 +34784,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getIngestionJobPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createIngestionJobPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"create_if_not_exist": false, "csv_property": {"encoding": "utf-8", "escape_character": "|", "field_delimiter": ",", "header": true, "line_delimiter": "\n"}, "details": "Path does not exist 'demobucket/data/yellow_tripdata_2022-01.parquet'. Detail: [errno 2] No such file or directory", "end_timestamp": "1685088775", "engine_id": "spark123", "engine_name": "sparkdemo", "execute_config": {"driver_cores": 1, "driver_memory": "2G", "executor_cores": 1, "executor_memory": "2G", "num_executors": 1}, "instance_id": "1684432229673971", "job_id": "ingestion-1699459946935", "partition_by": "col1, col2", "schema": "{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}", "source_data_files": "s3://demobucket/data/yellow_tripdata_2022-01.parquet", "source_file_type": "csv", "start_timestamp": "1685084455", "status": "running", "target_table": "demodb.test.targettable", "username": "ibmlhadmin", "validate_csv_header": false}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"instance_id": "InstanceID", "job_id": "JobID", "application_id": "ApplicationID", "username": "Username", "start_timestamp": "2019-01-01T12:00:00.000Z", "end_timestamp": "2019-01-01T12:00:00.000Z", "status": "Status", "source_data_files": "SourceDataFiles", "target_table": "TargetTable", "details": "Details", "engine_logs": "EngineLogs", "engine_id": "EngineID", "engine_name": "EngineName", "partition_by": "column1,column2", "is_new_schema": false, "is_new_table": false}`) })) }) - It(`Invoke GetIngestionJob successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateIngestionJob successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -33411,49 +34820,277 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetIngestionJob(nil) + result, response, operationErr := watsonxDataService.CreateIngestionJob(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetIngestionJobOptions model - getIngestionJobOptionsModel := new(watsonxdatav2.GetIngestionJobOptions) - getIngestionJobOptionsModel.JobID = core.StringPtr("testString") - getIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") - getIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SchemaTransformation model + schemaTransformationModel := new(watsonxdatav3.SchemaTransformation) + schemaTransformationModel.OldColumn = core.StringPtr("old_column_name") + schemaTransformationModel.NewColumn = core.StringPtr("new_column_name") + schemaTransformationModel.NewType = core.StringPtr("string") + + // Construct an instance of the BucketDetails model + bucketDetailsModel := new(watsonxdatav3.BucketDetails) + bucketDetailsModel.AccessKey = core.StringPtr("testString") + bucketDetailsModel.AccountName = core.StringPtr("testString") + bucketDetailsModel.ApplicationID = core.StringPtr("testString") + bucketDetailsModel.ContainerName = core.StringPtr("testString") + bucketDetailsModel.DirectoryID = core.StringPtr("testString") + bucketDetailsModel.Endpoint = core.StringPtr("testString") + bucketDetailsModel.Region = core.StringPtr("testString") + bucketDetailsModel.SecretKey = core.StringPtr("testString") + bucketDetailsModel.AuthMode = core.StringPtr("aws_assume_role") + bucketDetailsModel.RoleArn = core.StringPtr("testString") + bucketDetailsModel.ManagedBy = core.StringPtr("testString") + bucketDetailsModel.Name = core.StringPtr("testString") + bucketDetailsModel.Type = core.StringPtr("adls_gen1") + + // Construct an instance of the IcebergSourceTable model + icebergSourceTableModel := new(watsonxdatav3.IcebergSourceTable) + icebergSourceTableModel.SchemaName = core.StringPtr("testString") + icebergSourceTableModel.TableName = core.StringPtr("testString") + icebergSourceTableModel.CatalogName = core.StringPtr("testString") + icebergSourceTableModel.WarehouseName = core.StringPtr("testString") + icebergSourceTableModel.SnapshotID = core.Int64Ptr(int64(0)) + + // Construct an instance of the DbConnectionModel model + dbConnectionModelModel := new(watsonxdatav3.DbConnectionModel) + dbConnectionModelModel.DatabaseID = core.StringPtr("testString") + dbConnectionModelModel.DbType = core.StringPtr("testString") + dbConnectionModelModel.Host = core.StringPtr("testString") + dbConnectionModelModel.Port = core.StringPtr("testString") + dbConnectionModelModel.DbName = core.StringPtr("testString") + dbConnectionModelModel.DbUsername = core.StringPtr("testString") + dbConnectionModelModel.Password = core.StringPtr("testString") + dbConnectionModelModel.AuthenticationValue = core.StringPtr("testString") + dbConnectionModelModel.IsSsl = core.BoolPtr(false) + dbConnectionModelModel.CertExtension = core.StringPtr("testString") + dbConnectionModelModel.CertContent = core.StringPtr("testString") + dbConnectionModelModel.ConnectionMode = core.StringPtr("testString") + dbConnectionModelModel.ConnectionModeValue = core.StringPtr("testString") + dbConnectionModelModel.JdbcURL = core.StringPtr("testString") + + // Construct an instance of the FileFormatProperties model + fileFormatPropertiesModel := new(watsonxdatav3.FileFormatProperties) + fileFormatPropertiesModel.Encoding = core.StringPtr("testString") + fileFormatPropertiesModel.EscapeCharacter = core.StringPtr("testString") + fileFormatPropertiesModel.FieldDelimiter = core.StringPtr("testString") + fileFormatPropertiesModel.Header = core.BoolPtr(true) + fileFormatPropertiesModel.LineDelimiter = core.StringPtr("testString") + + // Construct an instance of the SourceDetails model + sourceDetailsModel := new(watsonxdatav3.SourceDetails) + sourceDetailsModel.FilePaths = core.StringPtr("testString") + sourceDetailsModel.FileType = core.StringPtr("csv") + sourceDetailsModel.SourceType = core.StringPtr("STORAGE") + sourceDetailsModel.SchemaTransformations = []watsonxdatav3.SchemaTransformation{*schemaTransformationModel} + sourceDetailsModel.SchemaName = core.StringPtr("testString") + sourceDetailsModel.TableName = core.StringPtr("testString") + sourceDetailsModel.BucketDetails = bucketDetailsModel + sourceDetailsModel.IcebergSourceTable = icebergSourceTableModel + sourceDetailsModel.SourceDatabase = dbConnectionModelModel + sourceDetailsModel.FileFormatProperties = fileFormatPropertiesModel + sourceDetailsModel.IsLocalIngestion = core.BoolPtr(false) + + // Construct an instance of the TargetDetails model + targetDetailsModel := new(watsonxdatav3.TargetDetails) + targetDetailsModel.Catalog = core.StringPtr("testString") + targetDetailsModel.Schema = core.StringPtr("testString") + targetDetailsModel.Table = core.StringPtr("testString") + targetDetailsModel.WriteMode = core.StringPtr("testString") + targetDetailsModel.MergeOnRead = core.BoolPtr(false) + targetDetailsModel.SchemaMode = core.StringPtr("testString") + targetDetailsModel.SchemaInfer = core.BoolPtr(true) + targetDetailsModel.CatalogURI = core.StringPtr("testString") + targetDetailsModel.BucketDetails = bucketDetailsModel + targetDetailsModel.Location = core.StringPtr("testString") + targetDetailsModel.IsNewSchema = core.BoolPtr(false) + targetDetailsModel.IsNewTable = core.BoolPtr(false) + + // Construct an instance of the ExecuteConfig model + executeConfigModel := new(watsonxdatav3.ExecuteConfig) + executeConfigModel.DriverMemory = core.StringPtr("testString") + executeConfigModel.DriverCores = core.Int64Ptr(int64(1)) + executeConfigModel.ExecutorMemory = core.StringPtr("testString") + executeConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) + executeConfigModel.NumExecutors = core.Int64Ptr(int64(1)) + + // Construct an instance of the IngestionEngine model + ingestionEngineModel := new(watsonxdatav3.IngestionEngine) + ingestionEngineModel.EngineID = core.StringPtr("testString") + ingestionEngineModel.Name = core.StringPtr("testString") + ingestionEngineModel.Endpoint = core.StringPtr("testString") + ingestionEngineModel.Origin = core.StringPtr("testString") + ingestionEngineModel.ExecuteConfig = executeConfigModel + ingestionEngineModel.BucketDetails = bucketDetailsModel + ingestionEngineModel.LogPath = core.StringPtr("testString") + + // Construct an instance of the CapacityDetails model + capacityDetailsModel := new(watsonxdatav3.CapacityDetails) + capacityDetailsModel.ID = CreateMockUUID("6f51248a-4cda-459a-b141-eb9b76bb6689") + + // Construct an instance of the CreateIngestionJobOptions model + createIngestionJobOptionsModel := new(watsonxdatav3.CreateIngestionJobOptions) + createIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") + createIngestionJobOptionsModel.ID = core.StringPtr("testString") + createIngestionJobOptionsModel.Source = sourceDetailsModel + createIngestionJobOptionsModel.Target = targetDetailsModel + createIngestionJobOptionsModel.Engine = ingestionEngineModel + createIngestionJobOptionsModel.EngineID = core.StringPtr("spark123") + createIngestionJobOptionsModel.ExecuteConfig = executeConfigModel + createIngestionJobOptionsModel.SourceIcebergTable = icebergSourceTableModel + createIngestionJobOptionsModel.PartitionBy = core.StringPtr("column1,column2") + createIngestionJobOptionsModel.Capacity = capacityDetailsModel + createIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) + result, response, operationErr = watsonxDataService.CreateIngestionJob(createIngestionJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetIngestionJob with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateIngestionJob with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetIngestionJobOptions model - getIngestionJobOptionsModel := new(watsonxdatav2.GetIngestionJobOptions) - getIngestionJobOptionsModel.JobID = core.StringPtr("testString") - getIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") - getIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SchemaTransformation model + schemaTransformationModel := new(watsonxdatav3.SchemaTransformation) + schemaTransformationModel.OldColumn = core.StringPtr("old_column_name") + schemaTransformationModel.NewColumn = core.StringPtr("new_column_name") + schemaTransformationModel.NewType = core.StringPtr("string") + + // Construct an instance of the BucketDetails model + bucketDetailsModel := new(watsonxdatav3.BucketDetails) + bucketDetailsModel.AccessKey = core.StringPtr("testString") + bucketDetailsModel.AccountName = core.StringPtr("testString") + bucketDetailsModel.ApplicationID = core.StringPtr("testString") + bucketDetailsModel.ContainerName = core.StringPtr("testString") + bucketDetailsModel.DirectoryID = core.StringPtr("testString") + bucketDetailsModel.Endpoint = core.StringPtr("testString") + bucketDetailsModel.Region = core.StringPtr("testString") + bucketDetailsModel.SecretKey = core.StringPtr("testString") + bucketDetailsModel.AuthMode = core.StringPtr("aws_assume_role") + bucketDetailsModel.RoleArn = core.StringPtr("testString") + bucketDetailsModel.ManagedBy = core.StringPtr("testString") + bucketDetailsModel.Name = core.StringPtr("testString") + bucketDetailsModel.Type = core.StringPtr("adls_gen1") + + // Construct an instance of the IcebergSourceTable model + icebergSourceTableModel := new(watsonxdatav3.IcebergSourceTable) + icebergSourceTableModel.SchemaName = core.StringPtr("testString") + icebergSourceTableModel.TableName = core.StringPtr("testString") + icebergSourceTableModel.CatalogName = core.StringPtr("testString") + icebergSourceTableModel.WarehouseName = core.StringPtr("testString") + icebergSourceTableModel.SnapshotID = core.Int64Ptr(int64(0)) + + // Construct an instance of the DbConnectionModel model + dbConnectionModelModel := new(watsonxdatav3.DbConnectionModel) + dbConnectionModelModel.DatabaseID = core.StringPtr("testString") + dbConnectionModelModel.DbType = core.StringPtr("testString") + dbConnectionModelModel.Host = core.StringPtr("testString") + dbConnectionModelModel.Port = core.StringPtr("testString") + dbConnectionModelModel.DbName = core.StringPtr("testString") + dbConnectionModelModel.DbUsername = core.StringPtr("testString") + dbConnectionModelModel.Password = core.StringPtr("testString") + dbConnectionModelModel.AuthenticationValue = core.StringPtr("testString") + dbConnectionModelModel.IsSsl = core.BoolPtr(false) + dbConnectionModelModel.CertExtension = core.StringPtr("testString") + dbConnectionModelModel.CertContent = core.StringPtr("testString") + dbConnectionModelModel.ConnectionMode = core.StringPtr("testString") + dbConnectionModelModel.ConnectionModeValue = core.StringPtr("testString") + dbConnectionModelModel.JdbcURL = core.StringPtr("testString") + + // Construct an instance of the FileFormatProperties model + fileFormatPropertiesModel := new(watsonxdatav3.FileFormatProperties) + fileFormatPropertiesModel.Encoding = core.StringPtr("testString") + fileFormatPropertiesModel.EscapeCharacter = core.StringPtr("testString") + fileFormatPropertiesModel.FieldDelimiter = core.StringPtr("testString") + fileFormatPropertiesModel.Header = core.BoolPtr(true) + fileFormatPropertiesModel.LineDelimiter = core.StringPtr("testString") + + // Construct an instance of the SourceDetails model + sourceDetailsModel := new(watsonxdatav3.SourceDetails) + sourceDetailsModel.FilePaths = core.StringPtr("testString") + sourceDetailsModel.FileType = core.StringPtr("csv") + sourceDetailsModel.SourceType = core.StringPtr("STORAGE") + sourceDetailsModel.SchemaTransformations = []watsonxdatav3.SchemaTransformation{*schemaTransformationModel} + sourceDetailsModel.SchemaName = core.StringPtr("testString") + sourceDetailsModel.TableName = core.StringPtr("testString") + sourceDetailsModel.BucketDetails = bucketDetailsModel + sourceDetailsModel.IcebergSourceTable = icebergSourceTableModel + sourceDetailsModel.SourceDatabase = dbConnectionModelModel + sourceDetailsModel.FileFormatProperties = fileFormatPropertiesModel + sourceDetailsModel.IsLocalIngestion = core.BoolPtr(false) + + // Construct an instance of the TargetDetails model + targetDetailsModel := new(watsonxdatav3.TargetDetails) + targetDetailsModel.Catalog = core.StringPtr("testString") + targetDetailsModel.Schema = core.StringPtr("testString") + targetDetailsModel.Table = core.StringPtr("testString") + targetDetailsModel.WriteMode = core.StringPtr("testString") + targetDetailsModel.MergeOnRead = core.BoolPtr(false) + targetDetailsModel.SchemaMode = core.StringPtr("testString") + targetDetailsModel.SchemaInfer = core.BoolPtr(true) + targetDetailsModel.CatalogURI = core.StringPtr("testString") + targetDetailsModel.BucketDetails = bucketDetailsModel + targetDetailsModel.Location = core.StringPtr("testString") + targetDetailsModel.IsNewSchema = core.BoolPtr(false) + targetDetailsModel.IsNewTable = core.BoolPtr(false) + + // Construct an instance of the ExecuteConfig model + executeConfigModel := new(watsonxdatav3.ExecuteConfig) + executeConfigModel.DriverMemory = core.StringPtr("testString") + executeConfigModel.DriverCores = core.Int64Ptr(int64(1)) + executeConfigModel.ExecutorMemory = core.StringPtr("testString") + executeConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) + executeConfigModel.NumExecutors = core.Int64Ptr(int64(1)) + + // Construct an instance of the IngestionEngine model + ingestionEngineModel := new(watsonxdatav3.IngestionEngine) + ingestionEngineModel.EngineID = core.StringPtr("testString") + ingestionEngineModel.Name = core.StringPtr("testString") + ingestionEngineModel.Endpoint = core.StringPtr("testString") + ingestionEngineModel.Origin = core.StringPtr("testString") + ingestionEngineModel.ExecuteConfig = executeConfigModel + ingestionEngineModel.BucketDetails = bucketDetailsModel + ingestionEngineModel.LogPath = core.StringPtr("testString") + + // Construct an instance of the CapacityDetails model + capacityDetailsModel := new(watsonxdatav3.CapacityDetails) + capacityDetailsModel.ID = CreateMockUUID("6f51248a-4cda-459a-b141-eb9b76bb6689") + + // Construct an instance of the CreateIngestionJobOptions model + createIngestionJobOptionsModel := new(watsonxdatav3.CreateIngestionJobOptions) + createIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") + createIngestionJobOptionsModel.ID = core.StringPtr("testString") + createIngestionJobOptionsModel.Source = sourceDetailsModel + createIngestionJobOptionsModel.Target = targetDetailsModel + createIngestionJobOptionsModel.Engine = ingestionEngineModel + createIngestionJobOptionsModel.EngineID = core.StringPtr("spark123") + createIngestionJobOptionsModel.ExecuteConfig = executeConfigModel + createIngestionJobOptionsModel.SourceIcebergTable = icebergSourceTableModel + createIngestionJobOptionsModel.PartitionBy = core.StringPtr("column1,column2") + createIngestionJobOptionsModel.Capacity = capacityDetailsModel + createIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) + result, response, operationErr := watsonxDataService.CreateIngestionJob(createIngestionJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetIngestionJobOptions model with no property values - getIngestionJobOptionsModelNew := new(watsonxdatav2.GetIngestionJobOptions) + // Construct a second instance of the CreateIngestionJobOptions model with no property values + createIngestionJobOptionsModelNew := new(watsonxdatav3.CreateIngestionJobOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetIngestionJob(getIngestionJobOptionsModelNew) + result, response, operationErr = watsonxDataService.CreateIngestionJob(createIngestionJobOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -33468,25 +35105,139 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke GetIngestionJob successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateIngestionJob successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetIngestionJobOptions model - getIngestionJobOptionsModel := new(watsonxdatav2.GetIngestionJobOptions) - getIngestionJobOptionsModel.JobID = core.StringPtr("testString") - getIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") - getIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the SchemaTransformation model + schemaTransformationModel := new(watsonxdatav3.SchemaTransformation) + schemaTransformationModel.OldColumn = core.StringPtr("old_column_name") + schemaTransformationModel.NewColumn = core.StringPtr("new_column_name") + schemaTransformationModel.NewType = core.StringPtr("string") + + // Construct an instance of the BucketDetails model + bucketDetailsModel := new(watsonxdatav3.BucketDetails) + bucketDetailsModel.AccessKey = core.StringPtr("testString") + bucketDetailsModel.AccountName = core.StringPtr("testString") + bucketDetailsModel.ApplicationID = core.StringPtr("testString") + bucketDetailsModel.ContainerName = core.StringPtr("testString") + bucketDetailsModel.DirectoryID = core.StringPtr("testString") + bucketDetailsModel.Endpoint = core.StringPtr("testString") + bucketDetailsModel.Region = core.StringPtr("testString") + bucketDetailsModel.SecretKey = core.StringPtr("testString") + bucketDetailsModel.AuthMode = core.StringPtr("aws_assume_role") + bucketDetailsModel.RoleArn = core.StringPtr("testString") + bucketDetailsModel.ManagedBy = core.StringPtr("testString") + bucketDetailsModel.Name = core.StringPtr("testString") + bucketDetailsModel.Type = core.StringPtr("adls_gen1") + + // Construct an instance of the IcebergSourceTable model + icebergSourceTableModel := new(watsonxdatav3.IcebergSourceTable) + icebergSourceTableModel.SchemaName = core.StringPtr("testString") + icebergSourceTableModel.TableName = core.StringPtr("testString") + icebergSourceTableModel.CatalogName = core.StringPtr("testString") + icebergSourceTableModel.WarehouseName = core.StringPtr("testString") + icebergSourceTableModel.SnapshotID = core.Int64Ptr(int64(0)) + + // Construct an instance of the DbConnectionModel model + dbConnectionModelModel := new(watsonxdatav3.DbConnectionModel) + dbConnectionModelModel.DatabaseID = core.StringPtr("testString") + dbConnectionModelModel.DbType = core.StringPtr("testString") + dbConnectionModelModel.Host = core.StringPtr("testString") + dbConnectionModelModel.Port = core.StringPtr("testString") + dbConnectionModelModel.DbName = core.StringPtr("testString") + dbConnectionModelModel.DbUsername = core.StringPtr("testString") + dbConnectionModelModel.Password = core.StringPtr("testString") + dbConnectionModelModel.AuthenticationValue = core.StringPtr("testString") + dbConnectionModelModel.IsSsl = core.BoolPtr(false) + dbConnectionModelModel.CertExtension = core.StringPtr("testString") + dbConnectionModelModel.CertContent = core.StringPtr("testString") + dbConnectionModelModel.ConnectionMode = core.StringPtr("testString") + dbConnectionModelModel.ConnectionModeValue = core.StringPtr("testString") + dbConnectionModelModel.JdbcURL = core.StringPtr("testString") + + // Construct an instance of the FileFormatProperties model + fileFormatPropertiesModel := new(watsonxdatav3.FileFormatProperties) + fileFormatPropertiesModel.Encoding = core.StringPtr("testString") + fileFormatPropertiesModel.EscapeCharacter = core.StringPtr("testString") + fileFormatPropertiesModel.FieldDelimiter = core.StringPtr("testString") + fileFormatPropertiesModel.Header = core.BoolPtr(true) + fileFormatPropertiesModel.LineDelimiter = core.StringPtr("testString") + + // Construct an instance of the SourceDetails model + sourceDetailsModel := new(watsonxdatav3.SourceDetails) + sourceDetailsModel.FilePaths = core.StringPtr("testString") + sourceDetailsModel.FileType = core.StringPtr("csv") + sourceDetailsModel.SourceType = core.StringPtr("STORAGE") + sourceDetailsModel.SchemaTransformations = []watsonxdatav3.SchemaTransformation{*schemaTransformationModel} + sourceDetailsModel.SchemaName = core.StringPtr("testString") + sourceDetailsModel.TableName = core.StringPtr("testString") + sourceDetailsModel.BucketDetails = bucketDetailsModel + sourceDetailsModel.IcebergSourceTable = icebergSourceTableModel + sourceDetailsModel.SourceDatabase = dbConnectionModelModel + sourceDetailsModel.FileFormatProperties = fileFormatPropertiesModel + sourceDetailsModel.IsLocalIngestion = core.BoolPtr(false) + + // Construct an instance of the TargetDetails model + targetDetailsModel := new(watsonxdatav3.TargetDetails) + targetDetailsModel.Catalog = core.StringPtr("testString") + targetDetailsModel.Schema = core.StringPtr("testString") + targetDetailsModel.Table = core.StringPtr("testString") + targetDetailsModel.WriteMode = core.StringPtr("testString") + targetDetailsModel.MergeOnRead = core.BoolPtr(false) + targetDetailsModel.SchemaMode = core.StringPtr("testString") + targetDetailsModel.SchemaInfer = core.BoolPtr(true) + targetDetailsModel.CatalogURI = core.StringPtr("testString") + targetDetailsModel.BucketDetails = bucketDetailsModel + targetDetailsModel.Location = core.StringPtr("testString") + targetDetailsModel.IsNewSchema = core.BoolPtr(false) + targetDetailsModel.IsNewTable = core.BoolPtr(false) + + // Construct an instance of the ExecuteConfig model + executeConfigModel := new(watsonxdatav3.ExecuteConfig) + executeConfigModel.DriverMemory = core.StringPtr("testString") + executeConfigModel.DriverCores = core.Int64Ptr(int64(1)) + executeConfigModel.ExecutorMemory = core.StringPtr("testString") + executeConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) + executeConfigModel.NumExecutors = core.Int64Ptr(int64(1)) + + // Construct an instance of the IngestionEngine model + ingestionEngineModel := new(watsonxdatav3.IngestionEngine) + ingestionEngineModel.EngineID = core.StringPtr("testString") + ingestionEngineModel.Name = core.StringPtr("testString") + ingestionEngineModel.Endpoint = core.StringPtr("testString") + ingestionEngineModel.Origin = core.StringPtr("testString") + ingestionEngineModel.ExecuteConfig = executeConfigModel + ingestionEngineModel.BucketDetails = bucketDetailsModel + ingestionEngineModel.LogPath = core.StringPtr("testString") + + // Construct an instance of the CapacityDetails model + capacityDetailsModel := new(watsonxdatav3.CapacityDetails) + capacityDetailsModel.ID = CreateMockUUID("6f51248a-4cda-459a-b141-eb9b76bb6689") + + // Construct an instance of the CreateIngestionJobOptions model + createIngestionJobOptionsModel := new(watsonxdatav3.CreateIngestionJobOptions) + createIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") + createIngestionJobOptionsModel.ID = core.StringPtr("testString") + createIngestionJobOptionsModel.Source = sourceDetailsModel + createIngestionJobOptionsModel.Target = targetDetailsModel + createIngestionJobOptionsModel.Engine = ingestionEngineModel + createIngestionJobOptionsModel.EngineID = core.StringPtr("spark123") + createIngestionJobOptionsModel.ExecuteConfig = executeConfigModel + createIngestionJobOptionsModel.SourceIcebergTable = icebergSourceTableModel + createIngestionJobOptionsModel.PartitionBy = core.StringPtr("column1,column2") + createIngestionJobOptionsModel.Capacity = capacityDetailsModel + createIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) + result, response, operationErr := watsonxDataService.CreateIngestionJob(createIngestionJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -33498,127 +35249,45 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`DeleteIngestionJobs(deleteIngestionJobsOptions *DeleteIngestionJobsOptions)`, func() { - deleteIngestionJobsPath := "/ingestion_jobs/testString" - Context(`Using mock server endpoint`, func() { - BeforeEach(func() { - testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { - defer GinkgoRecover() - - // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(deleteIngestionJobsPath)) - Expect(req.Method).To(Equal("DELETE")) - - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - res.WriteHeader(204) - })) - }) - It(`Invoke DeleteIngestionJobs successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Invoke operation with nil options model (negative test) - response, operationErr := watsonxDataService.DeleteIngestionJobs(nil) - Expect(operationErr).NotTo(BeNil()) - Expect(response).To(BeNil()) - - // Construct an instance of the DeleteIngestionJobsOptions model - deleteIngestionJobsOptionsModel := new(watsonxdatav2.DeleteIngestionJobsOptions) - deleteIngestionJobsOptionsModel.JobID = core.StringPtr("testString") - deleteIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - - // Invoke operation with valid options model (positive test) - response, operationErr = watsonxDataService.DeleteIngestionJobs(deleteIngestionJobsOptionsModel) - Expect(operationErr).To(BeNil()) - Expect(response).ToNot(BeNil()) - }) - It(`Invoke DeleteIngestionJobs with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) - Expect(serviceErr).To(BeNil()) - Expect(watsonxDataService).ToNot(BeNil()) - - // Construct an instance of the DeleteIngestionJobsOptions model - deleteIngestionJobsOptionsModel := new(watsonxdatav2.DeleteIngestionJobsOptions) - deleteIngestionJobsOptionsModel.JobID = core.StringPtr("testString") - deleteIngestionJobsOptionsModel.AuthInstanceID = core.StringPtr("testString") - deleteIngestionJobsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} - // Invoke operation with empty URL (negative test) - err := watsonxDataService.SetServiceURL("") - Expect(err).To(BeNil()) - response, operationErr := watsonxDataService.DeleteIngestionJobs(deleteIngestionJobsOptionsModel) - Expect(operationErr).ToNot(BeNil()) - Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) - Expect(response).To(BeNil()) - // Construct a second instance of the DeleteIngestionJobsOptions model with no property values - deleteIngestionJobsOptionsModelNew := new(watsonxdatav2.DeleteIngestionJobsOptions) - // Invoke operation with invalid model (negative test) - response, operationErr = watsonxDataService.DeleteIngestionJobs(deleteIngestionJobsOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - }) - AfterEach(func() { - testServer.Close() - }) - }) - }) - Describe(`CreatePreviewIngestionFile(createPreviewIngestionFileOptions *CreatePreviewIngestionFileOptions) - Operation response error`, func() { - createPreviewIngestionFilePath := "/preview_ingestion_file" + Describe(`GetIngestionJob(getIngestionJobOptions *GetIngestionJobOptions) - Operation response error`, func() { + getIngestionJobPath := "/v3/lhingestion/api/v1/ingestion/jobs/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPreviewIngestionFilePath)) - Expect(req.Method).To(Equal("POST")) + Expect(req.URL.EscapedPath()).To(Equal(getIngestionJobPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke CreatePreviewIngestionFile with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetIngestionJob with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PreviewIngestionFilePrototypeCsvProperty model - previewIngestionFilePrototypeCsvPropertyModel := new(watsonxdatav2.PreviewIngestionFilePrototypeCsvProperty) - previewIngestionFilePrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - previewIngestionFilePrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - previewIngestionFilePrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - previewIngestionFilePrototypeCsvPropertyModel.Header = core.BoolPtr(true) - previewIngestionFilePrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") - - // Construct an instance of the CreatePreviewIngestionFileOptions model - createPreviewIngestionFileOptionsModel := new(watsonxdatav2.CreatePreviewIngestionFileOptions) - createPreviewIngestionFileOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPreviewIngestionFileOptionsModel.SourceDataFiles = core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createPreviewIngestionFileOptionsModel.CsvProperty = previewIngestionFilePrototypeCsvPropertyModel - createPreviewIngestionFileOptionsModel.SourceFileType = core.StringPtr("csv") - createPreviewIngestionFileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetIngestionJobOptions model + getIngestionJobOptionsModel := new(watsonxdatav3.GetIngestionJobOptions) + getIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") + getIngestionJobOptionsModel.ID = core.StringPtr("testString") + getIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.CreatePreviewIngestionFile(createPreviewIngestionFileOptionsModel) + result, response, operationErr := watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.CreatePreviewIngestionFile(createPreviewIngestionFileOptionsModel) + result, response, operationErr = watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -33628,32 +35297,16 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`CreatePreviewIngestionFile(createPreviewIngestionFileOptions *CreatePreviewIngestionFileOptions)`, func() { - createPreviewIngestionFilePath := "/preview_ingestion_file" + Describe(`GetIngestionJob(getIngestionJobOptions *GetIngestionJobOptions)`, func() { + getIngestionJobPath := "/v3/lhingestion/api/v1/ingestion/jobs/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPreviewIngestionFilePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getIngestionJobPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -33662,12 +35315,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"column_names": ["col1"], "column_types": ["int"], "file_name": "s3://demobucket/data/yellow_tripdata_2022-01.parquet", "rows": {"row_eight": ["Jane Doe"], "row_five": ["Jane Doe"], "row_four": ["Jane Doe"], "row_nine": ["Jane Doe"], "row_one": ["Jane Doe"], "row_seven": ["Jane Doe"], "row_six": ["Jane Doe"], "row_ten": ["Jane Doe"], "row_three": ["Jane Doe"], "row_two": ["Jane Doe"]}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"instance_id": "InstanceID", "job_id": "JobID", "application_id": "ApplicationID", "username": "Username", "start_timestamp": "2019-01-01T12:00:00.000Z", "end_timestamp": "2019-01-01T12:00:00.000Z", "status": "Status", "source_data_files": "SourceDataFiles", "target_table": "TargetTable", "details": "Details", "engine_logs": "EngineLogs", "engine_id": "EngineID", "engine_name": "EngineName", "partition_by": "column1,column2", "is_new_schema": false, "is_new_table": false}`) })) }) - It(`Invoke CreatePreviewIngestionFile successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetIngestionJob successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -33675,32 +35328,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the PreviewIngestionFilePrototypeCsvProperty model - previewIngestionFilePrototypeCsvPropertyModel := new(watsonxdatav2.PreviewIngestionFilePrototypeCsvProperty) - previewIngestionFilePrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - previewIngestionFilePrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - previewIngestionFilePrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - previewIngestionFilePrototypeCsvPropertyModel.Header = core.BoolPtr(true) - previewIngestionFilePrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") - - // Construct an instance of the CreatePreviewIngestionFileOptions model - createPreviewIngestionFileOptionsModel := new(watsonxdatav2.CreatePreviewIngestionFileOptions) - createPreviewIngestionFileOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPreviewIngestionFileOptionsModel.SourceDataFiles = core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createPreviewIngestionFileOptionsModel.CsvProperty = previewIngestionFilePrototypeCsvPropertyModel - createPreviewIngestionFileOptionsModel.SourceFileType = core.StringPtr("csv") - createPreviewIngestionFileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetIngestionJobOptions model + getIngestionJobOptionsModel := new(watsonxdatav3.GetIngestionJobOptions) + getIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") + getIngestionJobOptionsModel.ID = core.StringPtr("testString") + getIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.CreatePreviewIngestionFileWithContext(ctx, createPreviewIngestionFileOptionsModel) + _, _, operationErr := watsonxDataService.GetIngestionJobWithContext(ctx, getIngestionJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.CreatePreviewIngestionFile(createPreviewIngestionFileOptionsModel) + result, response, operationErr := watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -33708,7 +35351,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.CreatePreviewIngestionFileWithContext(ctx, createPreviewIngestionFileOptionsModel) + _, _, operationErr = watsonxDataService.GetIngestionJobWithContext(ctx, getIngestionJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -33722,35 +35365,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(createPreviewIngestionFilePath)) - Expect(req.Method).To(Equal("POST")) - - // For gzip-disabled operation, verify Content-Encoding is not set. - Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) - - // If there is a body, then make sure we can read it - bodyBuf := new(bytes.Buffer) - if req.Header.Get("Content-Encoding") == "gzip" { - body, err := core.NewGzipDecompressionReader(req.Body) - Expect(err).To(BeNil()) - _, err = bodyBuf.ReadFrom(body) - Expect(err).To(BeNil()) - } else { - _, err := bodyBuf.ReadFrom(req.Body) - Expect(err).To(BeNil()) - } - fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + Expect(req.URL.EscapedPath()).To(Equal(getIngestionJobPath)) + Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"column_names": ["col1"], "column_types": ["int"], "file_name": "s3://demobucket/data/yellow_tripdata_2022-01.parquet", "rows": {"row_eight": ["Jane Doe"], "row_five": ["Jane Doe"], "row_four": ["Jane Doe"], "row_nine": ["Jane Doe"], "row_one": ["Jane Doe"], "row_seven": ["Jane Doe"], "row_six": ["Jane Doe"], "row_ten": ["Jane Doe"], "row_three": ["Jane Doe"], "row_two": ["Jane Doe"]}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"instance_id": "InstanceID", "job_id": "JobID", "application_id": "ApplicationID", "username": "Username", "start_timestamp": "2019-01-01T12:00:00.000Z", "end_timestamp": "2019-01-01T12:00:00.000Z", "status": "Status", "source_data_files": "SourceDataFiles", "target_table": "TargetTable", "details": "Details", "engine_logs": "EngineLogs", "engine_id": "EngineID", "engine_name": "EngineName", "partition_by": "column1,column2", "is_new_schema": false, "is_new_table": false}`) })) }) - It(`Invoke CreatePreviewIngestionFile successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetIngestionJob successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -33758,69 +35385,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.CreatePreviewIngestionFile(nil) + result, response, operationErr := watsonxDataService.GetIngestionJob(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the PreviewIngestionFilePrototypeCsvProperty model - previewIngestionFilePrototypeCsvPropertyModel := new(watsonxdatav2.PreviewIngestionFilePrototypeCsvProperty) - previewIngestionFilePrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - previewIngestionFilePrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - previewIngestionFilePrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - previewIngestionFilePrototypeCsvPropertyModel.Header = core.BoolPtr(true) - previewIngestionFilePrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") - - // Construct an instance of the CreatePreviewIngestionFileOptions model - createPreviewIngestionFileOptionsModel := new(watsonxdatav2.CreatePreviewIngestionFileOptions) - createPreviewIngestionFileOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPreviewIngestionFileOptionsModel.SourceDataFiles = core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createPreviewIngestionFileOptionsModel.CsvProperty = previewIngestionFilePrototypeCsvPropertyModel - createPreviewIngestionFileOptionsModel.SourceFileType = core.StringPtr("csv") - createPreviewIngestionFileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetIngestionJobOptions model + getIngestionJobOptionsModel := new(watsonxdatav3.GetIngestionJobOptions) + getIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") + getIngestionJobOptionsModel.ID = core.StringPtr("testString") + getIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.CreatePreviewIngestionFile(createPreviewIngestionFileOptionsModel) + result, response, operationErr = watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke CreatePreviewIngestionFile with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetIngestionJob with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PreviewIngestionFilePrototypeCsvProperty model - previewIngestionFilePrototypeCsvPropertyModel := new(watsonxdatav2.PreviewIngestionFilePrototypeCsvProperty) - previewIngestionFilePrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - previewIngestionFilePrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - previewIngestionFilePrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - previewIngestionFilePrototypeCsvPropertyModel.Header = core.BoolPtr(true) - previewIngestionFilePrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") - - // Construct an instance of the CreatePreviewIngestionFileOptions model - createPreviewIngestionFileOptionsModel := new(watsonxdatav2.CreatePreviewIngestionFileOptions) - createPreviewIngestionFileOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPreviewIngestionFileOptionsModel.SourceDataFiles = core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createPreviewIngestionFileOptionsModel.CsvProperty = previewIngestionFilePrototypeCsvPropertyModel - createPreviewIngestionFileOptionsModel.SourceFileType = core.StringPtr("csv") - createPreviewIngestionFileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetIngestionJobOptions model + getIngestionJobOptionsModel := new(watsonxdatav3.GetIngestionJobOptions) + getIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") + getIngestionJobOptionsModel.ID = core.StringPtr("testString") + getIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.CreatePreviewIngestionFile(createPreviewIngestionFileOptionsModel) + result, response, operationErr := watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the CreatePreviewIngestionFileOptions model with no property values - createPreviewIngestionFileOptionsModelNew := new(watsonxdatav2.CreatePreviewIngestionFileOptions) + // Construct a second instance of the GetIngestionJobOptions model with no property values + getIngestionJobOptionsModelNew := new(watsonxdatav3.GetIngestionJobOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.CreatePreviewIngestionFile(createPreviewIngestionFileOptionsModelNew) + result, response, operationErr = watsonxDataService.GetIngestionJob(getIngestionJobOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -33835,35 +35442,25 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke CreatePreviewIngestionFile successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetIngestionJob successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the PreviewIngestionFilePrototypeCsvProperty model - previewIngestionFilePrototypeCsvPropertyModel := new(watsonxdatav2.PreviewIngestionFilePrototypeCsvProperty) - previewIngestionFilePrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - previewIngestionFilePrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - previewIngestionFilePrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - previewIngestionFilePrototypeCsvPropertyModel.Header = core.BoolPtr(true) - previewIngestionFilePrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") - - // Construct an instance of the CreatePreviewIngestionFileOptions model - createPreviewIngestionFileOptionsModel := new(watsonxdatav2.CreatePreviewIngestionFileOptions) - createPreviewIngestionFileOptionsModel.AuthInstanceID = core.StringPtr("testString") - createPreviewIngestionFileOptionsModel.SourceDataFiles = core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createPreviewIngestionFileOptionsModel.CsvProperty = previewIngestionFilePrototypeCsvPropertyModel - createPreviewIngestionFileOptionsModel.SourceFileType = core.StringPtr("csv") - createPreviewIngestionFileOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetIngestionJobOptions model + getIngestionJobOptionsModel := new(watsonxdatav3.GetIngestionJobOptions) + getIngestionJobOptionsModel.AuthInstanceID = core.StringPtr("testString") + getIngestionJobOptionsModel.ID = core.StringPtr("testString") + getIngestionJobOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.CreatePreviewIngestionFile(createPreviewIngestionFileOptionsModel) + result, response, operationErr := watsonxDataService.GetIngestionJob(getIngestionJobOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -33875,44 +35472,48 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetEndpoints(getEndpointsOptions *GetEndpointsOptions) - Operation response error`, func() { - getEndpointsPath := "/endpoints" + Describe(`ListResourceAccessPolicies(listResourceAccessPoliciesOptions *ListResourceAccessPoliciesOptions) - Operation response error`, func() { + listResourceAccessPoliciesPath := "/v1/access/access_policies" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getEndpointsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listResourceAccessPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["resource_type"]).To(Equal([]string{"catalog"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetEndpoints with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListResourceAccessPolicies with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetEndpointsOptions model - getEndpointsOptionsModel := new(watsonxdatav2.GetEndpointsOptions) - getEndpointsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getEndpointsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListResourceAccessPoliciesOptions model + listResourceAccessPoliciesOptionsModel := new(watsonxdatav3.ListResourceAccessPoliciesOptions) + listResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listResourceAccessPoliciesOptionsModel.ResourceType = core.StringPtr("catalog") + listResourceAccessPoliciesOptionsModel.ResourceID = []string{"testString"} + listResourceAccessPoliciesOptionsModel.ResourceName = []string{"testString"} + listResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetEndpoints(getEndpointsOptionsModel) + result, response, operationErr := watsonxDataService.ListResourceAccessPolicies(listResourceAccessPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetEndpoints(getEndpointsOptionsModel) + result, response, operationErr = watsonxDataService.ListResourceAccessPolicies(listResourceAccessPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -33922,30 +35523,31 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetEndpoints(getEndpointsOptions *GetEndpointsOptions)`, func() { - getEndpointsPath := "/endpoints" + Describe(`ListResourceAccessPolicies(listResourceAccessPoliciesOptions *ListResourceAccessPoliciesOptions)`, func() { + listResourceAccessPoliciesPath := "/v1/access/access_policies" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getEndpointsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listResourceAccessPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["resource_type"]).To(Equal([]string{"catalog"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"endpoints": [{"external_host": "https://cpg-svc.your-hostname.apps.your-domain.com", "service_type": "cpg"}]}`) + fmt.Fprintf(res, "%s", `{"access_policies": [{"metadata": {"created_at": "2025-08-05T12:34:56.000Z", "created_by": "creator", "last_modified_at": "2025-08-05T12:34:56.000Z", "last_modified_by": "modifier"}, "permissions": [{"action": "can_administer", "permission_type": "explicit"}], "resource": {"id": "presto01", "name": "hive_data", "type": "presto"}, "state": "active", "subject": {"type": "user", "value": "user1"}}], "account_id": "AccountID", "instance_id": "InstanceID", "limit": 20, "offset": 2, "total_count": 200}`) })) }) - It(`Invoke GetEndpoints successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListResourceAccessPolicies successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -33953,21 +35555,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetEndpointsOptions model - getEndpointsOptionsModel := new(watsonxdatav2.GetEndpointsOptions) - getEndpointsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getEndpointsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListResourceAccessPoliciesOptions model + listResourceAccessPoliciesOptionsModel := new(watsonxdatav3.ListResourceAccessPoliciesOptions) + listResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listResourceAccessPoliciesOptionsModel.ResourceType = core.StringPtr("catalog") + listResourceAccessPoliciesOptionsModel.ResourceID = []string{"testString"} + listResourceAccessPoliciesOptionsModel.ResourceName = []string{"testString"} + listResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetEndpointsWithContext(ctx, getEndpointsOptionsModel) + _, _, operationErr := watsonxDataService.ListResourceAccessPoliciesWithContext(ctx, listResourceAccessPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetEndpoints(getEndpointsOptionsModel) + result, response, operationErr := watsonxDataService.ListResourceAccessPolicies(listResourceAccessPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -33975,7 +35580,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetEndpointsWithContext(ctx, getEndpointsOptionsModel) + _, _, operationErr = watsonxDataService.ListResourceAccessPoliciesWithContext(ctx, listResourceAccessPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -33989,19 +35594,20 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getEndpointsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listResourceAccessPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["resource_type"]).To(Equal([]string{"catalog"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"endpoints": [{"external_host": "https://cpg-svc.your-hostname.apps.your-domain.com", "service_type": "cpg"}]}`) + fmt.Fprintf(res, "%s", `{"access_policies": [{"metadata": {"created_at": "2025-08-05T12:34:56.000Z", "created_by": "creator", "last_modified_at": "2025-08-05T12:34:56.000Z", "last_modified_by": "modifier"}, "permissions": [{"action": "can_administer", "permission_type": "explicit"}], "resource": {"id": "presto01", "name": "hive_data", "type": "presto"}, "state": "active", "subject": {"type": "user", "value": "user1"}}], "account_id": "AccountID", "instance_id": "InstanceID", "limit": 20, "offset": 2, "total_count": 200}`) })) }) - It(`Invoke GetEndpoints successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListResourceAccessPolicies successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -34009,39 +35615,45 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetEndpoints(nil) + result, response, operationErr := watsonxDataService.ListResourceAccessPolicies(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetEndpointsOptions model - getEndpointsOptionsModel := new(watsonxdatav2.GetEndpointsOptions) - getEndpointsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getEndpointsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListResourceAccessPoliciesOptions model + listResourceAccessPoliciesOptionsModel := new(watsonxdatav3.ListResourceAccessPoliciesOptions) + listResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listResourceAccessPoliciesOptionsModel.ResourceType = core.StringPtr("catalog") + listResourceAccessPoliciesOptionsModel.ResourceID = []string{"testString"} + listResourceAccessPoliciesOptionsModel.ResourceName = []string{"testString"} + listResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetEndpoints(getEndpointsOptionsModel) + result, response, operationErr = watsonxDataService.ListResourceAccessPolicies(listResourceAccessPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetEndpoints with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListResourceAccessPolicies with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetEndpointsOptions model - getEndpointsOptionsModel := new(watsonxdatav2.GetEndpointsOptions) - getEndpointsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getEndpointsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListResourceAccessPoliciesOptions model + listResourceAccessPoliciesOptionsModel := new(watsonxdatav3.ListResourceAccessPoliciesOptions) + listResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listResourceAccessPoliciesOptionsModel.ResourceType = core.StringPtr("catalog") + listResourceAccessPoliciesOptionsModel.ResourceID = []string{"testString"} + listResourceAccessPoliciesOptionsModel.ResourceName = []string{"testString"} + listResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetEndpoints(getEndpointsOptionsModel) + result, response, operationErr := watsonxDataService.ListResourceAccessPolicies(listResourceAccessPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -34060,21 +35672,24 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetEndpoints successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListResourceAccessPolicies successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetEndpointsOptions model - getEndpointsOptionsModel := new(watsonxdatav2.GetEndpointsOptions) - getEndpointsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getEndpointsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListResourceAccessPoliciesOptions model + listResourceAccessPoliciesOptionsModel := new(watsonxdatav3.ListResourceAccessPoliciesOptions) + listResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listResourceAccessPoliciesOptionsModel.ResourceType = core.StringPtr("catalog") + listResourceAccessPoliciesOptionsModel.ResourceID = []string{"testString"} + listResourceAccessPoliciesOptionsModel.ResourceName = []string{"testString"} + listResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetEndpoints(getEndpointsOptionsModel) + result, response, operationErr := watsonxDataService.ListResourceAccessPolicies(listResourceAccessPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -34086,48 +35701,66 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RegisterTable(registerTableOptions *RegisterTableOptions) - Operation response error`, func() { - registerTablePath := "/catalogs/testString/schemas/testString/register" + Describe(`BulkUpdateResourceAccessPolicies(bulkUpdateResourceAccessPoliciesOptions *BulkUpdateResourceAccessPoliciesOptions) - Operation response error`, func() { + bulkUpdateResourceAccessPoliciesPath := "/v1/access/access_policies/bulk_update" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(registerTablePath)) + Expect(req.URL.EscapedPath()).To(Equal(bulkUpdateResourceAccessPoliciesPath)) Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) + res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke RegisterTable with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke BulkUpdateResourceAccessPolicies with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RegisterTableOptions model - registerTableOptionsModel := new(watsonxdatav2.RegisterTableOptions) - registerTableOptionsModel.CatalogID = core.StringPtr("testString") - registerTableOptionsModel.SchemaID = core.StringPtr("testString") - registerTableOptionsModel.MetadataLocation = core.StringPtr("s3a://bucketname/path/to/table/metadata_location/_delta_log") - registerTableOptionsModel.TableName = core.StringPtr("table1") - registerTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - registerTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceDetailsBulkUpdate model + resourceDetailsBulkUpdateModel := new(watsonxdatav3.ResourceDetailsBulkUpdate) + resourceDetailsBulkUpdateModel.ID = core.StringPtr("presto01") + resourceDetailsBulkUpdateModel.Name = core.StringPtr("hive_data") + resourceDetailsBulkUpdateModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the SubjectBulkUpdate model + subjectBulkUpdateModel := new(watsonxdatav3.SubjectBulkUpdate) + subjectBulkUpdateModel.Permissions = []string{"testString"} + subjectBulkUpdateModel.Subject = subjectModel + + // Construct an instance of the AccessPolicyBulkUpdate model + accessPolicyBulkUpdateModel := new(watsonxdatav3.AccessPolicyBulkUpdate) + accessPolicyBulkUpdateModel.Resources = []watsonxdatav3.ResourceDetailsBulkUpdate{*resourceDetailsBulkUpdateModel} + accessPolicyBulkUpdateModel.Subjects = []watsonxdatav3.SubjectBulkUpdate{*subjectBulkUpdateModel} + + // Construct an instance of the BulkUpdateResourceAccessPoliciesOptions model + bulkUpdateResourceAccessPoliciesOptionsModel := new(watsonxdatav3.BulkUpdateResourceAccessPoliciesOptions) + bulkUpdateResourceAccessPoliciesOptionsModel.AccessPolicies = []watsonxdatav3.AccessPolicyBulkUpdate{*accessPolicyBulkUpdateModel} + bulkUpdateResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + bulkUpdateResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.RegisterTable(registerTableOptionsModel) + result, response, operationErr := watsonxDataService.BulkUpdateResourceAccessPolicies(bulkUpdateResourceAccessPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.RegisterTable(registerTableOptionsModel) + result, response, operationErr = watsonxDataService.BulkUpdateResourceAccessPolicies(bulkUpdateResourceAccessPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -34137,15 +35770,15 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`RegisterTable(registerTableOptions *RegisterTableOptions)`, func() { - registerTablePath := "/catalogs/testString/schemas/testString/register" + Describe(`BulkUpdateResourceAccessPolicies(bulkUpdateResourceAccessPoliciesOptions *BulkUpdateResourceAccessPoliciesOptions)`, func() { + bulkUpdateResourceAccessPoliciesPath := "/v1/access/access_policies/bulk_update" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(registerTablePath)) + Expect(req.URL.EscapedPath()).To(Equal(bulkUpdateResourceAccessPoliciesPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -34171,12 +35804,12 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"access_policies": [{"metadata": {"created_at": "2025-08-05T12:34:56.000Z", "created_by": "creator", "last_modified_at": "2025-08-05T12:34:56.000Z", "last_modified_by": "modifier"}, "permissions": [{"action": "can_administer", "permission_type": "explicit"}], "resource": {"id": "presto01", "name": "hive_data", "type": "presto"}, "state": "active", "subject": {"type": "user", "value": "user1"}}], "account_id": "AccountID", "instance_id": "InstanceID"}`) })) }) - It(`Invoke RegisterTable successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke BulkUpdateResourceAccessPolicies successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -34184,25 +35817,43 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the RegisterTableOptions model - registerTableOptionsModel := new(watsonxdatav2.RegisterTableOptions) - registerTableOptionsModel.CatalogID = core.StringPtr("testString") - registerTableOptionsModel.SchemaID = core.StringPtr("testString") - registerTableOptionsModel.MetadataLocation = core.StringPtr("s3a://bucketname/path/to/table/metadata_location/_delta_log") - registerTableOptionsModel.TableName = core.StringPtr("table1") - registerTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - registerTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceDetailsBulkUpdate model + resourceDetailsBulkUpdateModel := new(watsonxdatav3.ResourceDetailsBulkUpdate) + resourceDetailsBulkUpdateModel.ID = core.StringPtr("presto01") + resourceDetailsBulkUpdateModel.Name = core.StringPtr("hive_data") + resourceDetailsBulkUpdateModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the SubjectBulkUpdate model + subjectBulkUpdateModel := new(watsonxdatav3.SubjectBulkUpdate) + subjectBulkUpdateModel.Permissions = []string{"testString"} + subjectBulkUpdateModel.Subject = subjectModel + + // Construct an instance of the AccessPolicyBulkUpdate model + accessPolicyBulkUpdateModel := new(watsonxdatav3.AccessPolicyBulkUpdate) + accessPolicyBulkUpdateModel.Resources = []watsonxdatav3.ResourceDetailsBulkUpdate{*resourceDetailsBulkUpdateModel} + accessPolicyBulkUpdateModel.Subjects = []watsonxdatav3.SubjectBulkUpdate{*subjectBulkUpdateModel} + + // Construct an instance of the BulkUpdateResourceAccessPoliciesOptions model + bulkUpdateResourceAccessPoliciesOptionsModel := new(watsonxdatav3.BulkUpdateResourceAccessPoliciesOptions) + bulkUpdateResourceAccessPoliciesOptionsModel.AccessPolicies = []watsonxdatav3.AccessPolicyBulkUpdate{*accessPolicyBulkUpdateModel} + bulkUpdateResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + bulkUpdateResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.RegisterTableWithContext(ctx, registerTableOptionsModel) + _, _, operationErr := watsonxDataService.BulkUpdateResourceAccessPoliciesWithContext(ctx, bulkUpdateResourceAccessPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.RegisterTable(registerTableOptionsModel) + result, response, operationErr := watsonxDataService.BulkUpdateResourceAccessPolicies(bulkUpdateResourceAccessPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -34210,7 +35861,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.RegisterTableWithContext(ctx, registerTableOptionsModel) + _, _, operationErr = watsonxDataService.BulkUpdateResourceAccessPoliciesWithContext(ctx, bulkUpdateResourceAccessPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -34224,7 +35875,7 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(registerTablePath)) + Expect(req.URL.EscapedPath()).To(Equal(bulkUpdateResourceAccessPoliciesPath)) Expect(req.Method).To(Equal("POST")) // For gzip-disabled operation, verify Content-Encoding is not set. @@ -34247,12 +35898,12 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(201) - fmt.Fprintf(res, "%s", `{"response": {"message": "Message", "message_code": "MessageCode"}}`) + res.WriteHeader(200) + fmt.Fprintf(res, "%s", `{"access_policies": [{"metadata": {"created_at": "2025-08-05T12:34:56.000Z", "created_by": "creator", "last_modified_at": "2025-08-05T12:34:56.000Z", "last_modified_by": "modifier"}, "permissions": [{"action": "can_administer", "permission_type": "explicit"}], "resource": {"id": "presto01", "name": "hive_data", "type": "presto"}, "state": "active", "subject": {"type": "user", "value": "user1"}}], "account_id": "AccountID", "instance_id": "InstanceID"}`) })) }) - It(`Invoke RegisterTable successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke BulkUpdateResourceAccessPolicies successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -34260,58 +35911,87 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.RegisterTable(nil) + result, response, operationErr := watsonxDataService.BulkUpdateResourceAccessPolicies(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the RegisterTableOptions model - registerTableOptionsModel := new(watsonxdatav2.RegisterTableOptions) - registerTableOptionsModel.CatalogID = core.StringPtr("testString") - registerTableOptionsModel.SchemaID = core.StringPtr("testString") - registerTableOptionsModel.MetadataLocation = core.StringPtr("s3a://bucketname/path/to/table/metadata_location/_delta_log") - registerTableOptionsModel.TableName = core.StringPtr("table1") - registerTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - registerTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceDetailsBulkUpdate model + resourceDetailsBulkUpdateModel := new(watsonxdatav3.ResourceDetailsBulkUpdate) + resourceDetailsBulkUpdateModel.ID = core.StringPtr("presto01") + resourceDetailsBulkUpdateModel.Name = core.StringPtr("hive_data") + resourceDetailsBulkUpdateModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the SubjectBulkUpdate model + subjectBulkUpdateModel := new(watsonxdatav3.SubjectBulkUpdate) + subjectBulkUpdateModel.Permissions = []string{"testString"} + subjectBulkUpdateModel.Subject = subjectModel + + // Construct an instance of the AccessPolicyBulkUpdate model + accessPolicyBulkUpdateModel := new(watsonxdatav3.AccessPolicyBulkUpdate) + accessPolicyBulkUpdateModel.Resources = []watsonxdatav3.ResourceDetailsBulkUpdate{*resourceDetailsBulkUpdateModel} + accessPolicyBulkUpdateModel.Subjects = []watsonxdatav3.SubjectBulkUpdate{*subjectBulkUpdateModel} + + // Construct an instance of the BulkUpdateResourceAccessPoliciesOptions model + bulkUpdateResourceAccessPoliciesOptionsModel := new(watsonxdatav3.BulkUpdateResourceAccessPoliciesOptions) + bulkUpdateResourceAccessPoliciesOptionsModel.AccessPolicies = []watsonxdatav3.AccessPolicyBulkUpdate{*accessPolicyBulkUpdateModel} + bulkUpdateResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + bulkUpdateResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.RegisterTable(registerTableOptionsModel) + result, response, operationErr = watsonxDataService.BulkUpdateResourceAccessPolicies(bulkUpdateResourceAccessPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke RegisterTable with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke BulkUpdateResourceAccessPolicies with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RegisterTableOptions model - registerTableOptionsModel := new(watsonxdatav2.RegisterTableOptions) - registerTableOptionsModel.CatalogID = core.StringPtr("testString") - registerTableOptionsModel.SchemaID = core.StringPtr("testString") - registerTableOptionsModel.MetadataLocation = core.StringPtr("s3a://bucketname/path/to/table/metadata_location/_delta_log") - registerTableOptionsModel.TableName = core.StringPtr("table1") - registerTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - registerTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceDetailsBulkUpdate model + resourceDetailsBulkUpdateModel := new(watsonxdatav3.ResourceDetailsBulkUpdate) + resourceDetailsBulkUpdateModel.ID = core.StringPtr("presto01") + resourceDetailsBulkUpdateModel.Name = core.StringPtr("hive_data") + resourceDetailsBulkUpdateModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the SubjectBulkUpdate model + subjectBulkUpdateModel := new(watsonxdatav3.SubjectBulkUpdate) + subjectBulkUpdateModel.Permissions = []string{"testString"} + subjectBulkUpdateModel.Subject = subjectModel + + // Construct an instance of the AccessPolicyBulkUpdate model + accessPolicyBulkUpdateModel := new(watsonxdatav3.AccessPolicyBulkUpdate) + accessPolicyBulkUpdateModel.Resources = []watsonxdatav3.ResourceDetailsBulkUpdate{*resourceDetailsBulkUpdateModel} + accessPolicyBulkUpdateModel.Subjects = []watsonxdatav3.SubjectBulkUpdate{*subjectBulkUpdateModel} + + // Construct an instance of the BulkUpdateResourceAccessPoliciesOptions model + bulkUpdateResourceAccessPoliciesOptionsModel := new(watsonxdatav3.BulkUpdateResourceAccessPoliciesOptions) + bulkUpdateResourceAccessPoliciesOptionsModel.AccessPolicies = []watsonxdatav3.AccessPolicyBulkUpdate{*accessPolicyBulkUpdateModel} + bulkUpdateResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + bulkUpdateResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.RegisterTable(registerTableOptionsModel) + result, response, operationErr := watsonxDataService.BulkUpdateResourceAccessPolicies(bulkUpdateResourceAccessPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the RegisterTableOptions model with no property values - registerTableOptionsModelNew := new(watsonxdatav2.RegisterTableOptions) - // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.RegisterTable(registerTableOptionsModelNew) - Expect(operationErr).ToNot(BeNil()) - Expect(response).To(BeNil()) - Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -34323,28 +36003,46 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(201) + res.WriteHeader(200) })) }) - It(`Invoke RegisterTable successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke BulkUpdateResourceAccessPolicies successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the RegisterTableOptions model - registerTableOptionsModel := new(watsonxdatav2.RegisterTableOptions) - registerTableOptionsModel.CatalogID = core.StringPtr("testString") - registerTableOptionsModel.SchemaID = core.StringPtr("testString") - registerTableOptionsModel.MetadataLocation = core.StringPtr("s3a://bucketname/path/to/table/metadata_location/_delta_log") - registerTableOptionsModel.TableName = core.StringPtr("table1") - registerTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - registerTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceDetailsBulkUpdate model + resourceDetailsBulkUpdateModel := new(watsonxdatav3.ResourceDetailsBulkUpdate) + resourceDetailsBulkUpdateModel.ID = core.StringPtr("presto01") + resourceDetailsBulkUpdateModel.Name = core.StringPtr("hive_data") + resourceDetailsBulkUpdateModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the SubjectBulkUpdate model + subjectBulkUpdateModel := new(watsonxdatav3.SubjectBulkUpdate) + subjectBulkUpdateModel.Permissions = []string{"testString"} + subjectBulkUpdateModel.Subject = subjectModel + + // Construct an instance of the AccessPolicyBulkUpdate model + accessPolicyBulkUpdateModel := new(watsonxdatav3.AccessPolicyBulkUpdate) + accessPolicyBulkUpdateModel.Resources = []watsonxdatav3.ResourceDetailsBulkUpdate{*resourceDetailsBulkUpdateModel} + accessPolicyBulkUpdateModel.Subjects = []watsonxdatav3.SubjectBulkUpdate{*subjectBulkUpdateModel} + + // Construct an instance of the BulkUpdateResourceAccessPoliciesOptions model + bulkUpdateResourceAccessPoliciesOptionsModel := new(watsonxdatav3.BulkUpdateResourceAccessPoliciesOptions) + bulkUpdateResourceAccessPoliciesOptionsModel.AccessPolicies = []watsonxdatav3.AccessPolicyBulkUpdate{*accessPolicyBulkUpdateModel} + bulkUpdateResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + bulkUpdateResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.RegisterTable(registerTableOptionsModel) + result, response, operationErr := watsonxDataService.BulkUpdateResourceAccessPolicies(bulkUpdateResourceAccessPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -34356,16 +36054,132 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`LoadTable(loadTableOptions *LoadTableOptions) - Operation response error`, func() { - loadTablePath := "/catalogs/testString/schemas/testString/tables/testString/metadata" + Describe(`RevokeResourceAccessPolicies(revokeResourceAccessPoliciesOptions *RevokeResourceAccessPoliciesOptions)`, func() { + revokeResourceAccessPoliciesPath := "/v1/access/access_policies/revoke" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(revokeResourceAccessPoliciesPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.WriteHeader(204) + })) + }) + It(`Invoke RevokeResourceAccessPolicies successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.RevokeResourceAccessPolicies(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the ResourceDetails model + resourceDetailsModel := new(watsonxdatav3.ResourceDetails) + resourceDetailsModel.ID = core.StringPtr("presto01") + resourceDetailsModel.Name = core.StringPtr("hive_data") + resourceDetailsModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the SubjectRevoke model + subjectRevokeModel := new(watsonxdatav3.SubjectRevoke) + subjectRevokeModel.Permissions = []string{"testString"} + subjectRevokeModel.Subject = subjectModel + + // Construct an instance of the RevokeResourceAccessPoliciesOptions model + revokeResourceAccessPoliciesOptionsModel := new(watsonxdatav3.RevokeResourceAccessPoliciesOptions) + revokeResourceAccessPoliciesOptionsModel.Resources = []watsonxdatav3.ResourceDetails{*resourceDetailsModel} + revokeResourceAccessPoliciesOptionsModel.Subjects = []watsonxdatav3.SubjectRevoke{*subjectRevokeModel} + revokeResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + revokeResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.RevokeResourceAccessPolicies(revokeResourceAccessPoliciesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke RevokeResourceAccessPolicies with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the ResourceDetails model + resourceDetailsModel := new(watsonxdatav3.ResourceDetails) + resourceDetailsModel.ID = core.StringPtr("presto01") + resourceDetailsModel.Name = core.StringPtr("hive_data") + resourceDetailsModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the SubjectRevoke model + subjectRevokeModel := new(watsonxdatav3.SubjectRevoke) + subjectRevokeModel.Permissions = []string{"testString"} + subjectRevokeModel.Subject = subjectModel + + // Construct an instance of the RevokeResourceAccessPoliciesOptions model + revokeResourceAccessPoliciesOptionsModel := new(watsonxdatav3.RevokeResourceAccessPoliciesOptions) + revokeResourceAccessPoliciesOptionsModel.Resources = []watsonxdatav3.ResourceDetails{*resourceDetailsModel} + revokeResourceAccessPoliciesOptionsModel.Subjects = []watsonxdatav3.SubjectRevoke{*subjectRevokeModel} + revokeResourceAccessPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + revokeResourceAccessPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.RevokeResourceAccessPolicies(revokeResourceAccessPoliciesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptions *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) - Operation response error`, func() { + filterResourceAccessPoliciesOnUsersAndUsergroupsPath := "/v1/access/advanced_policy_search" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(loadTablePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(filterResourceAccessPoliciesOnUsersAndUsergroupsPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) res.Header().Set("Content-type", "application/json") @@ -34373,30 +36187,44 @@ var _ = Describe(`WatsonxDataV2`, func() { fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke LoadTable with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke FilterResourceAccessPoliciesOnUsersAndUsergroups with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the LoadTableOptions model - loadTableOptionsModel := new(watsonxdatav2.LoadTableOptions) - loadTableOptionsModel.CatalogID = core.StringPtr("testString") - loadTableOptionsModel.SchemaID = core.StringPtr("testString") - loadTableOptionsModel.TableID = core.StringPtr("testString") - loadTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - loadTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceDetails model + resourceDetailsModel := new(watsonxdatav3.ResourceDetails) + resourceDetailsModel.ID = core.StringPtr("presto01") + resourceDetailsModel.Name = core.StringPtr("hive_data") + resourceDetailsModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the AccessPoliciesSearch model + accessPoliciesSearchModel := new(watsonxdatav3.AccessPoliciesSearch) + accessPoliciesSearchModel.Resources = []watsonxdatav3.ResourceDetails{*resourceDetailsModel} + accessPoliciesSearchModel.SubjectsToSearch = []watsonxdatav3.Subject{*subjectModel} + + // Construct an instance of the FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions model + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel := new(watsonxdatav3.FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AccessPoliciesSearch = []watsonxdatav3.AccessPoliciesSearch{*accessPoliciesSearchModel} + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AuthInstanceID = core.StringPtr("testString") + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.LoadTable(loadTableOptionsModel) + result, response, operationErr := watsonxDataService.FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.LoadTable(loadTableOptionsModel) + result, response, operationErr = watsonxDataService.FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -34406,16 +36234,32 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`LoadTable(loadTableOptions *LoadTableOptions)`, func() { - loadTablePath := "/catalogs/testString/schemas/testString/tables/testString/metadata" + Describe(`FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptions *FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions)`, func() { + filterResourceAccessPoliciesOnUsersAndUsergroupsPath := "/v1/access/advanced_policy_search" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(loadTablePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(filterResourceAccessPoliciesOnUsersAndUsergroupsPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) @@ -34425,11 +36269,11 @@ var _ = Describe(`WatsonxDataV2`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata_location": "s3a://bucketname/path/to/table/metadata_location/_delta_log", "table_path": "s3a://bucketname/path/to/table"}`) + fmt.Fprintf(res, "%s", `{"access_policies": [{"metadata": {"created_at": "2025-08-05T12:34:56.000Z", "created_by": "creator", "last_modified_at": "2025-08-05T12:34:56.000Z", "last_modified_by": "modifier"}, "permissions": [{"action": "can_administer", "permission_type": "explicit"}], "resource": {"id": "presto01", "name": "hive_data", "type": "presto"}, "state": "active", "subject": {"type": "user", "value": "user1"}}], "account_id": "AccountID", "instance_id": "InstanceID", "limit": 20, "offset": 2, "total_count": 200}`) })) }) - It(`Invoke LoadTable successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke FilterResourceAccessPoliciesOnUsersAndUsergroups successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -34437,24 +36281,38 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the LoadTableOptions model - loadTableOptionsModel := new(watsonxdatav2.LoadTableOptions) - loadTableOptionsModel.CatalogID = core.StringPtr("testString") - loadTableOptionsModel.SchemaID = core.StringPtr("testString") - loadTableOptionsModel.TableID = core.StringPtr("testString") - loadTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - loadTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceDetails model + resourceDetailsModel := new(watsonxdatav3.ResourceDetails) + resourceDetailsModel.ID = core.StringPtr("presto01") + resourceDetailsModel.Name = core.StringPtr("hive_data") + resourceDetailsModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the AccessPoliciesSearch model + accessPoliciesSearchModel := new(watsonxdatav3.AccessPoliciesSearch) + accessPoliciesSearchModel.Resources = []watsonxdatav3.ResourceDetails{*resourceDetailsModel} + accessPoliciesSearchModel.SubjectsToSearch = []watsonxdatav3.Subject{*subjectModel} + + // Construct an instance of the FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions model + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel := new(watsonxdatav3.FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AccessPoliciesSearch = []watsonxdatav3.AccessPoliciesSearch{*accessPoliciesSearchModel} + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AuthInstanceID = core.StringPtr("testString") + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.LoadTableWithContext(ctx, loadTableOptionsModel) + _, _, operationErr := watsonxDataService.FilterResourceAccessPoliciesOnUsersAndUsergroupsWithContext(ctx, filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.LoadTable(loadTableOptionsModel) + result, response, operationErr := watsonxDataService.FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -34462,7 +36320,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.LoadTableWithContext(ctx, loadTableOptionsModel) + _, _, operationErr = watsonxDataService.FilterResourceAccessPoliciesOnUsersAndUsergroupsWithContext(ctx, filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -34476,19 +36334,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(loadTablePath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(filterResourceAccessPoliciesOnUsersAndUsergroupsPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"metadata_location": "s3a://bucketname/path/to/table/metadata_location/_delta_log", "table_path": "s3a://bucketname/path/to/table"}`) + fmt.Fprintf(res, "%s", `{"access_policies": [{"metadata": {"created_at": "2025-08-05T12:34:56.000Z", "created_by": "creator", "last_modified_at": "2025-08-05T12:34:56.000Z", "last_modified_by": "modifier"}, "permissions": [{"action": "can_administer", "permission_type": "explicit"}], "resource": {"id": "presto01", "name": "hive_data", "type": "presto"}, "state": "active", "subject": {"type": "user", "value": "user1"}}], "account_id": "AccountID", "instance_id": "InstanceID", "limit": 20, "offset": 2, "total_count": 200}`) })) }) - It(`Invoke LoadTable successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke FilterResourceAccessPoliciesOnUsersAndUsergroups successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -34496,53 +36370,81 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.LoadTable(nil) + result, response, operationErr := watsonxDataService.FilterResourceAccessPoliciesOnUsersAndUsergroups(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the LoadTableOptions model - loadTableOptionsModel := new(watsonxdatav2.LoadTableOptions) - loadTableOptionsModel.CatalogID = core.StringPtr("testString") - loadTableOptionsModel.SchemaID = core.StringPtr("testString") - loadTableOptionsModel.TableID = core.StringPtr("testString") - loadTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - loadTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceDetails model + resourceDetailsModel := new(watsonxdatav3.ResourceDetails) + resourceDetailsModel.ID = core.StringPtr("presto01") + resourceDetailsModel.Name = core.StringPtr("hive_data") + resourceDetailsModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the AccessPoliciesSearch model + accessPoliciesSearchModel := new(watsonxdatav3.AccessPoliciesSearch) + accessPoliciesSearchModel.Resources = []watsonxdatav3.ResourceDetails{*resourceDetailsModel} + accessPoliciesSearchModel.SubjectsToSearch = []watsonxdatav3.Subject{*subjectModel} + + // Construct an instance of the FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions model + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel := new(watsonxdatav3.FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AccessPoliciesSearch = []watsonxdatav3.AccessPoliciesSearch{*accessPoliciesSearchModel} + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AuthInstanceID = core.StringPtr("testString") + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.LoadTable(loadTableOptionsModel) + result, response, operationErr = watsonxDataService.FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke LoadTable with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke FilterResourceAccessPoliciesOnUsersAndUsergroups with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the LoadTableOptions model - loadTableOptionsModel := new(watsonxdatav2.LoadTableOptions) - loadTableOptionsModel.CatalogID = core.StringPtr("testString") - loadTableOptionsModel.SchemaID = core.StringPtr("testString") - loadTableOptionsModel.TableID = core.StringPtr("testString") - loadTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - loadTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceDetails model + resourceDetailsModel := new(watsonxdatav3.ResourceDetails) + resourceDetailsModel.ID = core.StringPtr("presto01") + resourceDetailsModel.Name = core.StringPtr("hive_data") + resourceDetailsModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the AccessPoliciesSearch model + accessPoliciesSearchModel := new(watsonxdatav3.AccessPoliciesSearch) + accessPoliciesSearchModel.Resources = []watsonxdatav3.ResourceDetails{*resourceDetailsModel} + accessPoliciesSearchModel.SubjectsToSearch = []watsonxdatav3.Subject{*subjectModel} + + // Construct an instance of the FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions model + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel := new(watsonxdatav3.FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AccessPoliciesSearch = []watsonxdatav3.AccessPoliciesSearch{*accessPoliciesSearchModel} + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AuthInstanceID = core.StringPtr("testString") + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.LoadTable(loadTableOptionsModel) + result, response, operationErr := watsonxDataService.FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the LoadTableOptions model with no property values - loadTableOptionsModelNew := new(watsonxdatav2.LoadTableOptions) + // Construct a second instance of the FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions model with no property values + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModelNew := new(watsonxdatav3.FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.LoadTable(loadTableOptionsModelNew) + result, response, operationErr = watsonxDataService.FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -34560,24 +36462,38 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke LoadTable successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke FilterResourceAccessPoliciesOnUsersAndUsergroups successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the LoadTableOptions model - loadTableOptionsModel := new(watsonxdatav2.LoadTableOptions) - loadTableOptionsModel.CatalogID = core.StringPtr("testString") - loadTableOptionsModel.SchemaID = core.StringPtr("testString") - loadTableOptionsModel.TableID = core.StringPtr("testString") - loadTableOptionsModel.AuthInstanceID = core.StringPtr("testString") - loadTableOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ResourceDetails model + resourceDetailsModel := new(watsonxdatav3.ResourceDetails) + resourceDetailsModel.ID = core.StringPtr("presto01") + resourceDetailsModel.Name = core.StringPtr("hive_data") + resourceDetailsModel.Type = core.StringPtr("presto") + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + + // Construct an instance of the AccessPoliciesSearch model + accessPoliciesSearchModel := new(watsonxdatav3.AccessPoliciesSearch) + accessPoliciesSearchModel.Resources = []watsonxdatav3.ResourceDetails{*resourceDetailsModel} + accessPoliciesSearchModel.SubjectsToSearch = []watsonxdatav3.Subject{*subjectModel} + + // Construct an instance of the FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions model + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel := new(watsonxdatav3.FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions) + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AccessPoliciesSearch = []watsonxdatav3.AccessPoliciesSearch{*accessPoliciesSearchModel} + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AuthInstanceID = core.StringPtr("testString") + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.LoadTable(loadTableOptionsModel) + result, response, operationErr := watsonxDataService.FilterResourceAccessPoliciesOnUsersAndUsergroups(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -34589,50 +36505,60 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetAllColumns(getAllColumnsOptions *GetAllColumnsOptions) - Operation response error`, func() { - getAllColumnsPath := "/columns" + Describe(`ListDataPolicies(listDataPoliciesOptions *ListDataPoliciesOptions) - Operation response error`, func() { + listDataPoliciesPath := "/v1/access/data_policies" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getAllColumnsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDataPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["table_name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) + // TODO: Add check for include_metadata query parameter + // TODO: Add check for include_rules query parameter + Expect(req.URL.Query()["bucket_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["service_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["data_artifact"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetAllColumns with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDataPolicies with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetAllColumnsOptions model - getAllColumnsOptionsModel := new(watsonxdatav2.GetAllColumnsOptions) - getAllColumnsOptionsModel.TableName = core.StringPtr("testString") - getAllColumnsOptionsModel.CatalogName = core.StringPtr("testString") - getAllColumnsOptionsModel.SchemaName = core.StringPtr("testString") - getAllColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getAllColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDataPoliciesOptions model + listDataPoliciesOptionsModel := new(watsonxdatav3.ListDataPoliciesOptions) + listDataPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDataPoliciesOptionsModel.CatalogName = core.StringPtr("testString") + listDataPoliciesOptionsModel.ResourceID = core.StringPtr("testString") + listDataPoliciesOptionsModel.Status = core.StringPtr("testString") + listDataPoliciesOptionsModel.IncludeMetadata = core.BoolPtr(true) + listDataPoliciesOptionsModel.IncludeRules = core.BoolPtr(true) + listDataPoliciesOptionsModel.BucketName = core.StringPtr("testString") + listDataPoliciesOptionsModel.ServiceName = core.StringPtr("testString") + listDataPoliciesOptionsModel.DataArtifact = core.StringPtr("testString") + listDataPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetAllColumns(getAllColumnsOptionsModel) + result, response, operationErr := watsonxDataService.ListDataPolicies(listDataPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetAllColumns(getAllColumnsOptionsModel) + result, response, operationErr = watsonxDataService.ListDataPolicies(listDataPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -34642,33 +36568,38 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetAllColumns(getAllColumnsOptions *GetAllColumnsOptions)`, func() { - getAllColumnsPath := "/columns" + Describe(`ListDataPolicies(listDataPoliciesOptions *ListDataPoliciesOptions)`, func() { + listDataPoliciesPath := "/v1/access/data_policies" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getAllColumnsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDataPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["table_name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) + // TODO: Add check for include_metadata query parameter + // TODO: Add check for include_rules query parameter + Expect(req.URL.Query()["bucket_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["service_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["data_artifact"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"columns": [{"bucket": "Bucket", "catalog": "Catalog", "columns": [{"column": "Column", "index": 5, "type": "Type"}], "owner": "Owner", "schema": "Schema", "table": "Table"}], "message": "Message", "message_code": "MessageCode"}`) + fmt.Fprintf(res, "%s", `{"data_policies": [{"catalog_name": "catalog1", "data_artifact": "schema1/table1/(column1|column2)", "description": "This is a data policy", "metadata": {"created_at": "timestamp", "creator": "creator", "modifier": "modifier", "pid": "pid", "updated_at": "timestamp", "version": "version"}, "policy_name": "policy1", "resource_id": "services/milvus/milvus1", "rule_count": 26, "rules": [{"actions": ["Actions"], "effect": "allow", "grantees": [{"key": "user_name", "type": "user_identity", "value": "user1"}], "transform_columns": {"mask_condition": "NIL", "mask_type": "mask_show_last_4", "mask_value": "NIL"}, "transform_rows": {"filter_condition": "NIL", "row_filter": "addr_country='US'"}}], "status": "active"}], "total_count": 2}`) })) }) - It(`Invoke GetAllColumns successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDataPolicies successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -34676,24 +36607,29 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetAllColumnsOptions model - getAllColumnsOptionsModel := new(watsonxdatav2.GetAllColumnsOptions) - getAllColumnsOptionsModel.TableName = core.StringPtr("testString") - getAllColumnsOptionsModel.CatalogName = core.StringPtr("testString") - getAllColumnsOptionsModel.SchemaName = core.StringPtr("testString") - getAllColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getAllColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDataPoliciesOptions model + listDataPoliciesOptionsModel := new(watsonxdatav3.ListDataPoliciesOptions) + listDataPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDataPoliciesOptionsModel.CatalogName = core.StringPtr("testString") + listDataPoliciesOptionsModel.ResourceID = core.StringPtr("testString") + listDataPoliciesOptionsModel.Status = core.StringPtr("testString") + listDataPoliciesOptionsModel.IncludeMetadata = core.BoolPtr(true) + listDataPoliciesOptionsModel.IncludeRules = core.BoolPtr(true) + listDataPoliciesOptionsModel.BucketName = core.StringPtr("testString") + listDataPoliciesOptionsModel.ServiceName = core.StringPtr("testString") + listDataPoliciesOptionsModel.DataArtifact = core.StringPtr("testString") + listDataPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetAllColumnsWithContext(ctx, getAllColumnsOptionsModel) + _, _, operationErr := watsonxDataService.ListDataPoliciesWithContext(ctx, listDataPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetAllColumns(getAllColumnsOptionsModel) + result, response, operationErr := watsonxDataService.ListDataPolicies(listDataPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -34701,7 +36637,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetAllColumnsWithContext(ctx, getAllColumnsOptionsModel) + _, _, operationErr = watsonxDataService.ListDataPoliciesWithContext(ctx, listDataPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -34715,22 +36651,27 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getAllColumnsPath)) + Expect(req.URL.EscapedPath()).To(Equal(listDataPoliciesPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["table_name"]).To(Equal([]string{"testString"})) Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["resource_id"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["status"]).To(Equal([]string{"testString"})) + // TODO: Add check for include_metadata query parameter + // TODO: Add check for include_rules query parameter + Expect(req.URL.Query()["bucket_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["service_name"]).To(Equal([]string{"testString"})) + Expect(req.URL.Query()["data_artifact"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"columns": [{"bucket": "Bucket", "catalog": "Catalog", "columns": [{"column": "Column", "index": 5, "type": "Type"}], "owner": "Owner", "schema": "Schema", "table": "Table"}], "message": "Message", "message_code": "MessageCode"}`) + fmt.Fprintf(res, "%s", `{"data_policies": [{"catalog_name": "catalog1", "data_artifact": "schema1/table1/(column1|column2)", "description": "This is a data policy", "metadata": {"created_at": "timestamp", "creator": "creator", "modifier": "modifier", "pid": "pid", "updated_at": "timestamp", "version": "version"}, "policy_name": "policy1", "resource_id": "services/milvus/milvus1", "rule_count": 26, "rules": [{"actions": ["Actions"], "effect": "allow", "grantees": [{"key": "user_name", "type": "user_identity", "value": "user1"}], "transform_columns": {"mask_condition": "NIL", "mask_type": "mask_show_last_4", "mask_value": "NIL"}, "transform_rows": {"filter_condition": "NIL", "row_filter": "addr_country='US'"}}], "status": "active"}], "total_count": 2}`) })) }) - It(`Invoke GetAllColumns successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDataPolicies successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -34738,45 +36679,55 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetAllColumns(nil) + result, response, operationErr := watsonxDataService.ListDataPolicies(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetAllColumnsOptions model - getAllColumnsOptionsModel := new(watsonxdatav2.GetAllColumnsOptions) - getAllColumnsOptionsModel.TableName = core.StringPtr("testString") - getAllColumnsOptionsModel.CatalogName = core.StringPtr("testString") - getAllColumnsOptionsModel.SchemaName = core.StringPtr("testString") - getAllColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getAllColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDataPoliciesOptions model + listDataPoliciesOptionsModel := new(watsonxdatav3.ListDataPoliciesOptions) + listDataPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDataPoliciesOptionsModel.CatalogName = core.StringPtr("testString") + listDataPoliciesOptionsModel.ResourceID = core.StringPtr("testString") + listDataPoliciesOptionsModel.Status = core.StringPtr("testString") + listDataPoliciesOptionsModel.IncludeMetadata = core.BoolPtr(true) + listDataPoliciesOptionsModel.IncludeRules = core.BoolPtr(true) + listDataPoliciesOptionsModel.BucketName = core.StringPtr("testString") + listDataPoliciesOptionsModel.ServiceName = core.StringPtr("testString") + listDataPoliciesOptionsModel.DataArtifact = core.StringPtr("testString") + listDataPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetAllColumns(getAllColumnsOptionsModel) + result, response, operationErr = watsonxDataService.ListDataPolicies(listDataPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetAllColumns with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDataPolicies with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetAllColumnsOptions model - getAllColumnsOptionsModel := new(watsonxdatav2.GetAllColumnsOptions) - getAllColumnsOptionsModel.TableName = core.StringPtr("testString") - getAllColumnsOptionsModel.CatalogName = core.StringPtr("testString") - getAllColumnsOptionsModel.SchemaName = core.StringPtr("testString") - getAllColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getAllColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDataPoliciesOptions model + listDataPoliciesOptionsModel := new(watsonxdatav3.ListDataPoliciesOptions) + listDataPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDataPoliciesOptionsModel.CatalogName = core.StringPtr("testString") + listDataPoliciesOptionsModel.ResourceID = core.StringPtr("testString") + listDataPoliciesOptionsModel.Status = core.StringPtr("testString") + listDataPoliciesOptionsModel.IncludeMetadata = core.BoolPtr(true) + listDataPoliciesOptionsModel.IncludeRules = core.BoolPtr(true) + listDataPoliciesOptionsModel.BucketName = core.StringPtr("testString") + listDataPoliciesOptionsModel.ServiceName = core.StringPtr("testString") + listDataPoliciesOptionsModel.DataArtifact = core.StringPtr("testString") + listDataPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetAllColumns(getAllColumnsOptionsModel) + result, response, operationErr := watsonxDataService.ListDataPolicies(listDataPoliciesOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) @@ -34795,24 +36746,29 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetAllColumns successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ListDataPolicies successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetAllColumnsOptions model - getAllColumnsOptionsModel := new(watsonxdatav2.GetAllColumnsOptions) - getAllColumnsOptionsModel.TableName = core.StringPtr("testString") - getAllColumnsOptionsModel.CatalogName = core.StringPtr("testString") - getAllColumnsOptionsModel.SchemaName = core.StringPtr("testString") - getAllColumnsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getAllColumnsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the ListDataPoliciesOptions model + listDataPoliciesOptionsModel := new(watsonxdatav3.ListDataPoliciesOptions) + listDataPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + listDataPoliciesOptionsModel.CatalogName = core.StringPtr("testString") + listDataPoliciesOptionsModel.ResourceID = core.StringPtr("testString") + listDataPoliciesOptionsModel.Status = core.StringPtr("testString") + listDataPoliciesOptionsModel.IncludeMetadata = core.BoolPtr(true) + listDataPoliciesOptionsModel.IncludeRules = core.BoolPtr(true) + listDataPoliciesOptionsModel.BucketName = core.StringPtr("testString") + listDataPoliciesOptionsModel.ServiceName = core.StringPtr("testString") + listDataPoliciesOptionsModel.DataArtifact = core.StringPtr("testString") + listDataPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetAllColumns(getAllColumnsOptionsModel) + result, response, operationErr := watsonxDataService.ListDataPolicies(listDataPoliciesOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -34824,46 +36780,77 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListAllSchemas(listAllSchemasOptions *ListAllSchemasOptions) - Operation response error`, func() { - listAllSchemasPath := "/schemas" + Describe(`CreateDataPolicy(createDataPolicyOptions *CreateDataPolicyOptions) - Operation response error`, func() { + createDataPolicyPath := "/v1/access/data_policies" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listAllSchemasPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createDataPolicyPath)) + Expect(req.Method).To(Equal("POST")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListAllSchemas with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateDataPolicy with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListAllSchemasOptions model - listAllSchemasOptionsModel := new(watsonxdatav2.ListAllSchemasOptions) - listAllSchemasOptionsModel.CatalogName = core.StringPtr("testString") - listAllSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + + // Construct an instance of the CreateDataPolicyOptions model + createDataPolicyOptionsModel := new(watsonxdatav3.CreateDataPolicyOptions) + createDataPolicyOptionsModel.DataArtifact = core.StringPtr("schema1/table1/(column1|column2)") + createDataPolicyOptionsModel.Rules = []watsonxdatav3.RuleV2{*ruleV2Model} + createDataPolicyOptionsModel.CatalogName = core.StringPtr("catalog1") + createDataPolicyOptionsModel.CatalogType = core.StringPtr("catalog1") + createDataPolicyOptionsModel.Description = core.StringPtr("policy description") + createDataPolicyOptionsModel.PolicyName = core.StringPtr("policy1") + createDataPolicyOptionsModel.ResourceID = core.StringPtr("catalog1") + createDataPolicyOptionsModel.Status = core.StringPtr("active") + createDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListAllSchemas(listAllSchemasOptionsModel) + result, response, operationErr := watsonxDataService.CreateDataPolicy(createDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListAllSchemas(listAllSchemasOptionsModel) + result, response, operationErr = watsonxDataService.CreateDataPolicy(createDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -34873,31 +36860,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListAllSchemas(listAllSchemasOptions *ListAllSchemasOptions)`, func() { - listAllSchemasPath := "/schemas" + Describe(`CreateDataPolicy(createDataPolicyOptions *CreateDataPolicyOptions)`, func() { + createDataPolicyPath := "/v1/access/data_policies" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listAllSchemasPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createDataPolicyPath)) + Expect(req.Method).To(Equal("POST")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode", "schemas": [{"bucket": "Bucket", "catalog": "Catalog", "owner": "Owner", "schema_name": "SchemaName"}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"catalog_name": "catalog1", "data_artifact": "schema1/table1/(column1|column2)", "description": "This is a data policy", "metadata": {"created_at": "timestamp", "creator": "creator", "modifier": "modifier", "pid": "pid", "updated_at": "timestamp", "version": "version"}, "policy_name": "policy1", "resource_id": "services/milvus/milvus1", "rule_count": 26, "rules": [{"actions": ["Actions"], "effect": "allow", "grantees": [{"key": "user_name", "type": "user_identity", "value": "user1"}], "transform_columns": {"mask_condition": "NIL", "mask_type": "mask_show_last_4", "mask_value": "NIL"}, "transform_rows": {"filter_condition": "NIL", "row_filter": "addr_country='US'"}}], "status": "active"}`) })) }) - It(`Invoke ListAllSchemas successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateDataPolicy successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -34905,22 +36907,54 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListAllSchemasOptions model - listAllSchemasOptionsModel := new(watsonxdatav2.ListAllSchemasOptions) - listAllSchemasOptionsModel.CatalogName = core.StringPtr("testString") - listAllSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + + // Construct an instance of the CreateDataPolicyOptions model + createDataPolicyOptionsModel := new(watsonxdatav3.CreateDataPolicyOptions) + createDataPolicyOptionsModel.DataArtifact = core.StringPtr("schema1/table1/(column1|column2)") + createDataPolicyOptionsModel.Rules = []watsonxdatav3.RuleV2{*ruleV2Model} + createDataPolicyOptionsModel.CatalogName = core.StringPtr("catalog1") + createDataPolicyOptionsModel.CatalogType = core.StringPtr("catalog1") + createDataPolicyOptionsModel.Description = core.StringPtr("policy description") + createDataPolicyOptionsModel.PolicyName = core.StringPtr("policy1") + createDataPolicyOptionsModel.ResourceID = core.StringPtr("catalog1") + createDataPolicyOptionsModel.Status = core.StringPtr("active") + createDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListAllSchemasWithContext(ctx, listAllSchemasOptionsModel) + _, _, operationErr := watsonxDataService.CreateDataPolicyWithContext(ctx, createDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListAllSchemas(listAllSchemasOptionsModel) + result, response, operationErr := watsonxDataService.CreateDataPolicy(createDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -34928,7 +36962,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListAllSchemasWithContext(ctx, listAllSchemasOptionsModel) + _, _, operationErr = watsonxDataService.CreateDataPolicyWithContext(ctx, createDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -34942,66 +36976,152 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listAllSchemasPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(createDataPolicyPath)) + Expect(req.Method).To(Equal("POST")) - Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) - Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - // Set mock response - res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode", "schemas": [{"bucket": "Bucket", "catalog": "Catalog", "owner": "Owner", "schema_name": "SchemaName"}]}`) - })) - }) - It(`Invoke ListAllSchemas successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: testServer.URL, - Authenticator: &core.NoAuthAuthenticator{}, - }) + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + // Set mock response + res.Header().Set("Content-type", "application/json") + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"catalog_name": "catalog1", "data_artifact": "schema1/table1/(column1|column2)", "description": "This is a data policy", "metadata": {"created_at": "timestamp", "creator": "creator", "modifier": "modifier", "pid": "pid", "updated_at": "timestamp", "version": "version"}, "policy_name": "policy1", "resource_id": "services/milvus/milvus1", "rule_count": 26, "rules": [{"actions": ["Actions"], "effect": "allow", "grantees": [{"key": "user_name", "type": "user_identity", "value": "user1"}], "transform_columns": {"mask_condition": "NIL", "mask_type": "mask_show_last_4", "mask_value": "NIL"}, "transform_rows": {"filter_condition": "NIL", "row_filter": "addr_country='US'"}}], "status": "active"}`) + })) + }) + It(`Invoke CreateDataPolicy successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListAllSchemas(nil) + result, response, operationErr := watsonxDataService.CreateDataPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListAllSchemasOptions model - listAllSchemasOptionsModel := new(watsonxdatav2.ListAllSchemasOptions) - listAllSchemasOptionsModel.CatalogName = core.StringPtr("testString") - listAllSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + + // Construct an instance of the CreateDataPolicyOptions model + createDataPolicyOptionsModel := new(watsonxdatav3.CreateDataPolicyOptions) + createDataPolicyOptionsModel.DataArtifact = core.StringPtr("schema1/table1/(column1|column2)") + createDataPolicyOptionsModel.Rules = []watsonxdatav3.RuleV2{*ruleV2Model} + createDataPolicyOptionsModel.CatalogName = core.StringPtr("catalog1") + createDataPolicyOptionsModel.CatalogType = core.StringPtr("catalog1") + createDataPolicyOptionsModel.Description = core.StringPtr("policy description") + createDataPolicyOptionsModel.PolicyName = core.StringPtr("policy1") + createDataPolicyOptionsModel.ResourceID = core.StringPtr("catalog1") + createDataPolicyOptionsModel.Status = core.StringPtr("active") + createDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListAllSchemas(listAllSchemasOptionsModel) + result, response, operationErr = watsonxDataService.CreateDataPolicy(createDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListAllSchemas with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateDataPolicy with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListAllSchemasOptions model - listAllSchemasOptionsModel := new(watsonxdatav2.ListAllSchemasOptions) - listAllSchemasOptionsModel.CatalogName = core.StringPtr("testString") - listAllSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + + // Construct an instance of the CreateDataPolicyOptions model + createDataPolicyOptionsModel := new(watsonxdatav3.CreateDataPolicyOptions) + createDataPolicyOptionsModel.DataArtifact = core.StringPtr("schema1/table1/(column1|column2)") + createDataPolicyOptionsModel.Rules = []watsonxdatav3.RuleV2{*ruleV2Model} + createDataPolicyOptionsModel.CatalogName = core.StringPtr("catalog1") + createDataPolicyOptionsModel.CatalogType = core.StringPtr("catalog1") + createDataPolicyOptionsModel.Description = core.StringPtr("policy description") + createDataPolicyOptionsModel.PolicyName = core.StringPtr("policy1") + createDataPolicyOptionsModel.ResourceID = core.StringPtr("catalog1") + createDataPolicyOptionsModel.Status = core.StringPtr("active") + createDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListAllSchemas(listAllSchemasOptionsModel) + result, response, operationErr := watsonxDataService.CreateDataPolicy(createDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the CreateDataPolicyOptions model with no property values + createDataPolicyOptionsModelNew := new(watsonxdatav3.CreateDataPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.CreateDataPolicy(createDataPolicyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -35013,25 +37133,57 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListAllSchemas successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke CreateDataPolicy successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListAllSchemasOptions model - listAllSchemasOptionsModel := new(watsonxdatav2.ListAllSchemasOptions) - listAllSchemasOptionsModel.CatalogName = core.StringPtr("testString") - listAllSchemasOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllSchemasOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + + // Construct an instance of the CreateDataPolicyOptions model + createDataPolicyOptionsModel := new(watsonxdatav3.CreateDataPolicyOptions) + createDataPolicyOptionsModel.DataArtifact = core.StringPtr("schema1/table1/(column1|column2)") + createDataPolicyOptionsModel.Rules = []watsonxdatav3.RuleV2{*ruleV2Model} + createDataPolicyOptionsModel.CatalogName = core.StringPtr("catalog1") + createDataPolicyOptionsModel.CatalogType = core.StringPtr("catalog1") + createDataPolicyOptionsModel.Description = core.StringPtr("policy description") + createDataPolicyOptionsModel.PolicyName = core.StringPtr("policy1") + createDataPolicyOptionsModel.ResourceID = core.StringPtr("catalog1") + createDataPolicyOptionsModel.Status = core.StringPtr("active") + createDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + createDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListAllSchemas(listAllSchemasOptionsModel) + result, response, operationErr := watsonxDataService.CreateDataPolicy(createDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -35043,47 +37195,112 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSchemaDetails(getSchemaDetailsOptions *GetSchemaDetailsOptions) - Operation response error`, func() { - getSchemaDetailsPath := "/schemas/testString" + Describe(`DeleteDataPolicies(deleteDataPoliciesOptions *DeleteDataPoliciesOptions)`, func() { + deleteDataPoliciesPath := "/v1/access/data_policies" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteDataPoliciesPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + Expect(req.URL.Query()["policies"]).To(Equal([]string{"testString"})) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteDataPolicies successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteDataPolicies(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteDataPoliciesOptions model + deleteDataPoliciesOptionsModel := new(watsonxdatav3.DeleteDataPoliciesOptions) + deleteDataPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteDataPoliciesOptionsModel.Policies = core.StringPtr("testString") + deleteDataPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteDataPolicies(deleteDataPoliciesOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteDataPolicies with error: Operation request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DeleteDataPoliciesOptions model + deleteDataPoliciesOptionsModel := new(watsonxdatav3.DeleteDataPoliciesOptions) + deleteDataPoliciesOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteDataPoliciesOptionsModel.Policies = core.StringPtr("testString") + deleteDataPoliciesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteDataPolicies(deleteDataPoliciesOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`GetDataPolicy(getDataPolicyOptions *GetDataPolicyOptions) - Operation response error`, func() { + getDataPolicyPath := "/v1/access/data_policies/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSchemaDetailsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDataPolicyPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetSchemaDetails with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetDataPolicy with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSchemaDetailsOptions model - getSchemaDetailsOptionsModel := new(watsonxdatav2.GetSchemaDetailsOptions) - getSchemaDetailsOptionsModel.SchemaName = core.StringPtr("testString") - getSchemaDetailsOptionsModel.CatalogName = core.StringPtr("testString") - getSchemaDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSchemaDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDataPolicyOptions model + getDataPolicyOptionsModel := new(watsonxdatav3.GetDataPolicyOptions) + getDataPolicyOptionsModel.Name = core.StringPtr("testString") + getDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + getDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetSchemaDetails(getSchemaDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetDataPolicy(getDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetSchemaDetails(getSchemaDetailsOptionsModel) + result, response, operationErr = watsonxDataService.GetDataPolicy(getDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -35093,31 +37310,30 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetSchemaDetails(getSchemaDetailsOptions *GetSchemaDetailsOptions)`, func() { - getSchemaDetailsPath := "/schemas/testString" + Describe(`GetDataPolicy(getDataPolicyOptions *GetDataPolicyOptions)`, func() { + getDataPolicyPath := "/v1/access/data_policies/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSchemaDetailsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDataPolicyPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bucket": "Bucket", "catalog": "Catalog", "message": "Message", "message_code": "MessageCode", "owner": "Owner", "schema": {"bucket": "Bucket", "catalog": "Catalog", "owner": "Owner", "schema_name": "SchemaName"}, "schema_name": "SchemaName"}`) + fmt.Fprintf(res, "%s", `{"catalog_name": "catalog1", "data_artifact": "schema1/table1/(column1|column2)", "description": "This is a data policy", "metadata": {"created_at": "timestamp", "creator": "creator", "modifier": "modifier", "pid": "pid", "updated_at": "timestamp", "version": "version"}, "policy_name": "policy1", "resource_id": "services/milvus/milvus1", "rule_count": 26, "rules": [{"actions": ["Actions"], "effect": "allow", "grantees": [{"key": "user_name", "type": "user_identity", "value": "user1"}], "transform_columns": {"mask_condition": "NIL", "mask_type": "mask_show_last_4", "mask_value": "NIL"}, "transform_rows": {"filter_condition": "NIL", "row_filter": "addr_country='US'"}}], "status": "active"}`) })) }) - It(`Invoke GetSchemaDetails successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetDataPolicy successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -35125,23 +37341,22 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetSchemaDetailsOptions model - getSchemaDetailsOptionsModel := new(watsonxdatav2.GetSchemaDetailsOptions) - getSchemaDetailsOptionsModel.SchemaName = core.StringPtr("testString") - getSchemaDetailsOptionsModel.CatalogName = core.StringPtr("testString") - getSchemaDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSchemaDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDataPolicyOptions model + getDataPolicyOptionsModel := new(watsonxdatav3.GetDataPolicyOptions) + getDataPolicyOptionsModel.Name = core.StringPtr("testString") + getDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + getDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetSchemaDetailsWithContext(ctx, getSchemaDetailsOptionsModel) + _, _, operationErr := watsonxDataService.GetDataPolicyWithContext(ctx, getDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetSchemaDetails(getSchemaDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetDataPolicy(getDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -35149,7 +37364,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetSchemaDetailsWithContext(ctx, getSchemaDetailsOptionsModel) + _, _, operationErr = watsonxDataService.GetDataPolicyWithContext(ctx, getDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -35163,20 +37378,19 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getSchemaDetailsPath)) + Expect(req.URL.EscapedPath()).To(Equal(getDataPolicyPath)) Expect(req.Method).To(Equal("GET")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"bucket": "Bucket", "catalog": "Catalog", "message": "Message", "message_code": "MessageCode", "owner": "Owner", "schema": {"bucket": "Bucket", "catalog": "Catalog", "owner": "Owner", "schema_name": "SchemaName"}, "schema_name": "SchemaName"}`) + fmt.Fprintf(res, "%s", `{"catalog_name": "catalog1", "data_artifact": "schema1/table1/(column1|column2)", "description": "This is a data policy", "metadata": {"created_at": "timestamp", "creator": "creator", "modifier": "modifier", "pid": "pid", "updated_at": "timestamp", "version": "version"}, "policy_name": "policy1", "resource_id": "services/milvus/milvus1", "rule_count": 26, "rules": [{"actions": ["Actions"], "effect": "allow", "grantees": [{"key": "user_name", "type": "user_identity", "value": "user1"}], "transform_columns": {"mask_condition": "NIL", "mask_type": "mask_show_last_4", "mask_value": "NIL"}, "transform_rows": {"filter_condition": "NIL", "row_filter": "addr_country='US'"}}], "status": "active"}`) })) }) - It(`Invoke GetSchemaDetails successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetDataPolicy successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -35184,51 +37398,49 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetSchemaDetails(nil) + result, response, operationErr := watsonxDataService.GetDataPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetSchemaDetailsOptions model - getSchemaDetailsOptionsModel := new(watsonxdatav2.GetSchemaDetailsOptions) - getSchemaDetailsOptionsModel.SchemaName = core.StringPtr("testString") - getSchemaDetailsOptionsModel.CatalogName = core.StringPtr("testString") - getSchemaDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSchemaDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDataPolicyOptions model + getDataPolicyOptionsModel := new(watsonxdatav3.GetDataPolicyOptions) + getDataPolicyOptionsModel.Name = core.StringPtr("testString") + getDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + getDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetSchemaDetails(getSchemaDetailsOptionsModel) + result, response, operationErr = watsonxDataService.GetDataPolicy(getDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetSchemaDetails with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetDataPolicy with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSchemaDetailsOptions model - getSchemaDetailsOptionsModel := new(watsonxdatav2.GetSchemaDetailsOptions) - getSchemaDetailsOptionsModel.SchemaName = core.StringPtr("testString") - getSchemaDetailsOptionsModel.CatalogName = core.StringPtr("testString") - getSchemaDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSchemaDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDataPolicyOptions model + getDataPolicyOptionsModel := new(watsonxdatav3.GetDataPolicyOptions) + getDataPolicyOptionsModel.Name = core.StringPtr("testString") + getDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + getDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetSchemaDetails(getSchemaDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetDataPolicy(getDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetSchemaDetailsOptions model with no property values - getSchemaDetailsOptionsModelNew := new(watsonxdatav2.GetSchemaDetailsOptions) + // Construct a second instance of the GetDataPolicyOptions model with no property values + getDataPolicyOptionsModelNew := new(watsonxdatav3.GetDataPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetSchemaDetails(getSchemaDetailsOptionsModelNew) + result, response, operationErr = watsonxDataService.GetDataPolicy(getDataPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -35246,23 +37458,22 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetSchemaDetails successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke GetDataPolicy successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetSchemaDetailsOptions model - getSchemaDetailsOptionsModel := new(watsonxdatav2.GetSchemaDetailsOptions) - getSchemaDetailsOptionsModel.SchemaName = core.StringPtr("testString") - getSchemaDetailsOptionsModel.CatalogName = core.StringPtr("testString") - getSchemaDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getSchemaDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the GetDataPolicyOptions model + getDataPolicyOptionsModel := new(watsonxdatav3.GetDataPolicyOptions) + getDataPolicyOptionsModel.Name = core.StringPtr("testString") + getDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + getDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetSchemaDetails(getSchemaDetailsOptionsModel) + result, response, operationErr := watsonxDataService.GetDataPolicy(getDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -35274,48 +37485,78 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListAllTables(listAllTablesOptions *ListAllTablesOptions) - Operation response error`, func() { - listAllTablesPath := "/tables" + Describe(`ReplaceDataPolicy(replaceDataPolicyOptions *ReplaceDataPolicyOptions) - Operation response error`, func() { + replaceDataPolicyPath := "/v1/access/data_policies/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listAllTablesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(replaceDataPolicyPath)) + Expect(req.Method).To(Equal("PUT")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) + res.WriteHeader(201) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke ListAllTables with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ReplaceDataPolicy with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListAllTablesOptions model - listAllTablesOptionsModel := new(watsonxdatav2.ListAllTablesOptions) - listAllTablesOptionsModel.CatalogName = core.StringPtr("testString") - listAllTablesOptionsModel.SchemaName = core.StringPtr("testString") - listAllTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + + // Construct an instance of the ReplaceDataPolicyOptions model + replaceDataPolicyOptionsModel := new(watsonxdatav3.ReplaceDataPolicyOptions) + replaceDataPolicyOptionsModel.Name = core.StringPtr("testString") + replaceDataPolicyOptionsModel.DataArtifact = core.StringPtr("schema1/table1/(column1|column2)") + replaceDataPolicyOptionsModel.Rules = []watsonxdatav3.RuleV2{*ruleV2Model} + replaceDataPolicyOptionsModel.CatalogName = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.CatalogType = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.Description = core.StringPtr("policy description") + replaceDataPolicyOptionsModel.PolicyName = core.StringPtr("policy1") + replaceDataPolicyOptionsModel.ResourceID = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.Status = core.StringPtr("active") + replaceDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.ListAllTables(listAllTablesOptionsModel) + result, response, operationErr := watsonxDataService.ReplaceDataPolicy(replaceDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.ListAllTables(listAllTablesOptionsModel) + result, response, operationErr = watsonxDataService.ReplaceDataPolicy(replaceDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -35325,32 +37566,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`ListAllTables(listAllTablesOptions *ListAllTablesOptions)`, func() { - listAllTablesPath := "/tables" + Describe(`ReplaceDataPolicy(replaceDataPolicyOptions *ReplaceDataPolicyOptions)`, func() { + replaceDataPolicyPath := "/v1/access/data_policies/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listAllTablesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(replaceDataPolicyPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode", "tables": [{"message": "Message", "message_code": "MessageCode", "tables": [{"bucket": "Bucket", "catalog": "Catalog", "columns": [{"column": "Column", "index": 5, "type": "Type"}], "owner": "Owner", "schema": "Schema", "table": "Table"}]}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"catalog_name": "catalog1", "data_artifact": "schema1/table1/(column1|column2)", "description": "This is a data policy", "metadata": {"created_at": "timestamp", "creator": "creator", "modifier": "modifier", "pid": "pid", "updated_at": "timestamp", "version": "version"}, "policy_name": "policy1", "resource_id": "services/milvus/milvus1", "rule_count": 26, "rules": [{"actions": ["Actions"], "effect": "allow", "grantees": [{"key": "user_name", "type": "user_identity", "value": "user1"}], "transform_columns": {"mask_condition": "NIL", "mask_type": "mask_show_last_4", "mask_value": "NIL"}, "transform_rows": {"filter_condition": "NIL", "row_filter": "addr_country='US'"}}], "status": "active"}`) })) }) - It(`Invoke ListAllTables successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ReplaceDataPolicy successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -35358,23 +37613,55 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the ListAllTablesOptions model - listAllTablesOptionsModel := new(watsonxdatav2.ListAllTablesOptions) - listAllTablesOptionsModel.CatalogName = core.StringPtr("testString") - listAllTablesOptionsModel.SchemaName = core.StringPtr("testString") - listAllTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + + // Construct an instance of the ReplaceDataPolicyOptions model + replaceDataPolicyOptionsModel := new(watsonxdatav3.ReplaceDataPolicyOptions) + replaceDataPolicyOptionsModel.Name = core.StringPtr("testString") + replaceDataPolicyOptionsModel.DataArtifact = core.StringPtr("schema1/table1/(column1|column2)") + replaceDataPolicyOptionsModel.Rules = []watsonxdatav3.RuleV2{*ruleV2Model} + replaceDataPolicyOptionsModel.CatalogName = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.CatalogType = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.Description = core.StringPtr("policy description") + replaceDataPolicyOptionsModel.PolicyName = core.StringPtr("policy1") + replaceDataPolicyOptionsModel.ResourceID = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.Status = core.StringPtr("active") + replaceDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.ListAllTablesWithContext(ctx, listAllTablesOptionsModel) + _, _, operationErr := watsonxDataService.ReplaceDataPolicyWithContext(ctx, replaceDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.ListAllTables(listAllTablesOptionsModel) + result, response, operationErr := watsonxDataService.ReplaceDataPolicy(replaceDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -35382,7 +37669,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.ListAllTablesWithContext(ctx, listAllTablesOptionsModel) + _, _, operationErr = watsonxDataService.ReplaceDataPolicyWithContext(ctx, replaceDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -35396,21 +37683,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(listAllTablesPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(replaceDataPolicyPath)) + Expect(req.Method).To(Equal("PUT")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") - res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode", "tables": [{"message": "Message", "message_code": "MessageCode", "tables": [{"bucket": "Bucket", "catalog": "Catalog", "columns": [{"column": "Column", "index": 5, "type": "Type"}], "owner": "Owner", "schema": "Schema", "table": "Table"}]}]}`) + res.WriteHeader(201) + fmt.Fprintf(res, "%s", `{"catalog_name": "catalog1", "data_artifact": "schema1/table1/(column1|column2)", "description": "This is a data policy", "metadata": {"created_at": "timestamp", "creator": "creator", "modifier": "modifier", "pid": "pid", "updated_at": "timestamp", "version": "version"}, "policy_name": "policy1", "resource_id": "services/milvus/milvus1", "rule_count": 26, "rules": [{"actions": ["Actions"], "effect": "allow", "grantees": [{"key": "user_name", "type": "user_identity", "value": "user1"}], "transform_columns": {"mask_condition": "NIL", "mask_type": "mask_show_last_4", "mask_value": "NIL"}, "transform_rows": {"filter_condition": "NIL", "row_filter": "addr_country='US'"}}], "status": "active"}`) })) }) - It(`Invoke ListAllTables successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ReplaceDataPolicy successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -35418,47 +37719,118 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.ListAllTables(nil) + result, response, operationErr := watsonxDataService.ReplaceDataPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the ListAllTablesOptions model - listAllTablesOptionsModel := new(watsonxdatav2.ListAllTablesOptions) - listAllTablesOptionsModel.CatalogName = core.StringPtr("testString") - listAllTablesOptionsModel.SchemaName = core.StringPtr("testString") - listAllTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + + // Construct an instance of the ReplaceDataPolicyOptions model + replaceDataPolicyOptionsModel := new(watsonxdatav3.ReplaceDataPolicyOptions) + replaceDataPolicyOptionsModel.Name = core.StringPtr("testString") + replaceDataPolicyOptionsModel.DataArtifact = core.StringPtr("schema1/table1/(column1|column2)") + replaceDataPolicyOptionsModel.Rules = []watsonxdatav3.RuleV2{*ruleV2Model} + replaceDataPolicyOptionsModel.CatalogName = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.CatalogType = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.Description = core.StringPtr("policy description") + replaceDataPolicyOptionsModel.PolicyName = core.StringPtr("policy1") + replaceDataPolicyOptionsModel.ResourceID = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.Status = core.StringPtr("active") + replaceDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.ListAllTables(listAllTablesOptionsModel) + result, response, operationErr = watsonxDataService.ReplaceDataPolicy(replaceDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke ListAllTables with error: Operation request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ReplaceDataPolicy with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListAllTablesOptions model - listAllTablesOptionsModel := new(watsonxdatav2.ListAllTablesOptions) - listAllTablesOptionsModel.CatalogName = core.StringPtr("testString") - listAllTablesOptionsModel.SchemaName = core.StringPtr("testString") - listAllTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + + // Construct an instance of the ReplaceDataPolicyOptions model + replaceDataPolicyOptionsModel := new(watsonxdatav3.ReplaceDataPolicyOptions) + replaceDataPolicyOptionsModel.Name = core.StringPtr("testString") + replaceDataPolicyOptionsModel.DataArtifact = core.StringPtr("schema1/table1/(column1|column2)") + replaceDataPolicyOptionsModel.Rules = []watsonxdatav3.RuleV2{*ruleV2Model} + replaceDataPolicyOptionsModel.CatalogName = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.CatalogType = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.Description = core.StringPtr("policy description") + replaceDataPolicyOptionsModel.PolicyName = core.StringPtr("policy1") + replaceDataPolicyOptionsModel.ResourceID = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.Status = core.StringPtr("active") + replaceDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.ListAllTables(listAllTablesOptionsModel) + result, response, operationErr := watsonxDataService.ReplaceDataPolicy(replaceDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) + // Construct a second instance of the ReplaceDataPolicyOptions model with no property values + replaceDataPolicyOptionsModelNew := new(watsonxdatav3.ReplaceDataPolicyOptions) + // Invoke operation with invalid model (negative test) + result, response, operationErr = watsonxDataService.ReplaceDataPolicy(replaceDataPolicyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + Expect(result).To(BeNil()) }) AfterEach(func() { testServer.Close() @@ -35470,26 +37842,58 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Set success status code with no respoonse body - res.WriteHeader(200) + res.WriteHeader(201) })) }) - It(`Invoke ListAllTables successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke ReplaceDataPolicy successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the ListAllTablesOptions model - listAllTablesOptionsModel := new(watsonxdatav2.ListAllTablesOptions) - listAllTablesOptionsModel.CatalogName = core.StringPtr("testString") - listAllTablesOptionsModel.SchemaName = core.StringPtr("testString") - listAllTablesOptionsModel.AuthInstanceID = core.StringPtr("testString") - listAllTablesOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + + // Construct an instance of the ReplaceDataPolicyOptions model + replaceDataPolicyOptionsModel := new(watsonxdatav3.ReplaceDataPolicyOptions) + replaceDataPolicyOptionsModel.Name = core.StringPtr("testString") + replaceDataPolicyOptionsModel.DataArtifact = core.StringPtr("schema1/table1/(column1|column2)") + replaceDataPolicyOptionsModel.Rules = []watsonxdatav3.RuleV2{*ruleV2Model} + replaceDataPolicyOptionsModel.CatalogName = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.CatalogType = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.Description = core.StringPtr("policy description") + replaceDataPolicyOptionsModel.PolicyName = core.StringPtr("policy1") + replaceDataPolicyOptionsModel.ResourceID = core.StringPtr("catalog1") + replaceDataPolicyOptionsModel.Status = core.StringPtr("active") + replaceDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + replaceDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.ListAllTables(listAllTablesOptionsModel) + result, response, operationErr := watsonxDataService.ReplaceDataPolicy(replaceDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -35501,49 +37905,125 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetTableDetails(getTableDetailsOptions *GetTableDetailsOptions) - Operation response error`, func() { - getTableDetailsPath := "/tables/testString" + Describe(`DeleteDataPolicy(deleteDataPolicyOptions *DeleteDataPolicyOptions)`, func() { + deleteDataPolicyPath := "/v1/access/data_policies/testString" + Context(`Using mock server endpoint`, func() { + BeforeEach(func() { + testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + defer GinkgoRecover() + + // Verify the contents of the request + Expect(req.URL.EscapedPath()).To(Equal(deleteDataPolicyPath)) + Expect(req.Method).To(Equal("DELETE")) + + Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) + Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) + res.WriteHeader(204) + })) + }) + It(`Invoke DeleteDataPolicy successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Invoke operation with nil options model (negative test) + response, operationErr := watsonxDataService.DeleteDataPolicy(nil) + Expect(operationErr).NotTo(BeNil()) + Expect(response).To(BeNil()) + + // Construct an instance of the DeleteDataPolicyOptions model + deleteDataPolicyOptionsModel := new(watsonxdatav3.DeleteDataPolicyOptions) + deleteDataPolicyOptionsModel.Name = core.StringPtr("testString") + deleteDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + + // Invoke operation with valid options model (positive test) + response, operationErr = watsonxDataService.DeleteDataPolicy(deleteDataPolicyOptionsModel) + Expect(operationErr).To(BeNil()) + Expect(response).ToNot(BeNil()) + }) + It(`Invoke DeleteDataPolicy with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: testServer.URL, + Authenticator: &core.NoAuthAuthenticator{}, + }) + Expect(serviceErr).To(BeNil()) + Expect(watsonxDataService).ToNot(BeNil()) + + // Construct an instance of the DeleteDataPolicyOptions model + deleteDataPolicyOptionsModel := new(watsonxdatav3.DeleteDataPolicyOptions) + deleteDataPolicyOptionsModel.Name = core.StringPtr("testString") + deleteDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + deleteDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Invoke operation with empty URL (negative test) + err := watsonxDataService.SetServiceURL("") + Expect(err).To(BeNil()) + response, operationErr := watsonxDataService.DeleteDataPolicy(deleteDataPolicyOptionsModel) + Expect(operationErr).ToNot(BeNil()) + Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) + Expect(response).To(BeNil()) + // Construct a second instance of the DeleteDataPolicyOptions model with no property values + deleteDataPolicyOptionsModelNew := new(watsonxdatav3.DeleteDataPolicyOptions) + // Invoke operation with invalid model (negative test) + response, operationErr = watsonxDataService.DeleteDataPolicy(deleteDataPolicyOptionsModelNew) + Expect(operationErr).ToNot(BeNil()) + Expect(response).To(BeNil()) + }) + AfterEach(func() { + testServer.Close() + }) + }) + }) + Describe(`UpdateDataPolicy(updateDataPolicyOptions *UpdateDataPolicyOptions) - Operation response error`, func() { + updateDataPolicyPath := "/v1/access/data_policies/testString" Context(`Using mock server endpoint with invalid JSON response`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getTableDetailsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateDataPolicyPath)) + Expect(req.Method).To(Equal("PATCH")) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) res.Header().Set("Content-type", "application/json") res.WriteHeader(200) fmt.Fprint(res, `} this is not valid json {`) })) }) - It(`Invoke GetTableDetails with error: Operation response processing error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateDataPolicy with error: Operation response processing error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetTableDetailsOptions model - getTableDetailsOptionsModel := new(watsonxdatav2.GetTableDetailsOptions) - getTableDetailsOptionsModel.TableName = core.StringPtr("testString") - getTableDetailsOptionsModel.CatalogName = core.StringPtr("testString") - getTableDetailsOptionsModel.SchemaName = core.StringPtr("testString") - getTableDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getTableDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" + + // Construct an instance of the UpdateDataPolicyOptions model + updateDataPolicyOptionsModel := new(watsonxdatav3.UpdateDataPolicyOptions) + updateDataPolicyOptionsModel.Name = core.StringPtr("testString") + updateDataPolicyOptionsModel.Body = []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel} + updateDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Expect response parsing to fail since we are receiving a text/plain response - result, response, operationErr := watsonxDataService.GetTableDetails(getTableDetailsOptionsModel) + result, response, operationErr := watsonxDataService.UpdateDataPolicy(updateDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) // Enable retries and test again watsonxDataService.EnableRetries(0, 0) - result, response, operationErr = watsonxDataService.GetTableDetails(getTableDetailsOptionsModel) + result, response, operationErr = watsonxDataService.UpdateDataPolicy(updateDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).To(BeNil()) @@ -35553,32 +38033,46 @@ var _ = Describe(`WatsonxDataV2`, func() { }) }) }) - Describe(`GetTableDetails(getTableDetailsOptions *GetTableDetailsOptions)`, func() { - getTableDetailsPath := "/tables/testString" + Describe(`UpdateDataPolicy(updateDataPolicyOptions *UpdateDataPolicyOptions)`, func() { + updateDataPolicyPath := "/v1/access/data_policies/testString" Context(`Using mock server endpoint with timeout`, func() { BeforeEach(func() { testServer = httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getTableDetailsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateDataPolicyPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) // Sleep a short time to support a timeout test time.Sleep(100 * time.Millisecond) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode", "tables": [{"bucket": "Bucket", "catalog": "Catalog", "columns": [{"column": "Column", "index": 5, "type": "Type"}], "owner": "Owner", "schema": "Schema", "table": "Table"}]}`) + fmt.Fprintf(res, "%s", `{"catalog_name": "catalog1", "data_artifact": "schema1/table1/(column1|column2)", "description": "This is a data policy", "metadata": {"created_at": "timestamp", "creator": "creator", "modifier": "modifier", "pid": "pid", "updated_at": "timestamp", "version": "version"}, "policy_name": "policy1", "resource_id": "services/milvus/milvus1", "rule_count": 26, "rules": [{"actions": ["Actions"], "effect": "allow", "grantees": [{"key": "user_name", "type": "user_identity", "value": "user1"}], "transform_columns": {"mask_condition": "NIL", "mask_type": "mask_show_last_4", "mask_value": "NIL"}, "transform_rows": {"filter_condition": "NIL", "row_filter": "addr_country='US'"}}], "status": "active"}`) })) }) - It(`Invoke GetTableDetails successfully with retries`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateDataPolicy successfully with retries`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -35586,24 +38080,30 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) watsonxDataService.EnableRetries(0, 0) - // Construct an instance of the GetTableDetailsOptions model - getTableDetailsOptionsModel := new(watsonxdatav2.GetTableDetailsOptions) - getTableDetailsOptionsModel.TableName = core.StringPtr("testString") - getTableDetailsOptionsModel.CatalogName = core.StringPtr("testString") - getTableDetailsOptionsModel.SchemaName = core.StringPtr("testString") - getTableDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getTableDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" + + // Construct an instance of the UpdateDataPolicyOptions model + updateDataPolicyOptionsModel := new(watsonxdatav3.UpdateDataPolicyOptions) + updateDataPolicyOptionsModel.Name = core.StringPtr("testString") + updateDataPolicyOptionsModel.Body = []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel} + updateDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with a Context to test a timeout error ctx, cancelFunc := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc() - _, _, operationErr := watsonxDataService.GetTableDetailsWithContext(ctx, getTableDetailsOptionsModel) + _, _, operationErr := watsonxDataService.UpdateDataPolicyWithContext(ctx, updateDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) // Disable retries and test again watsonxDataService.DisableRetries() - result, response, operationErr := watsonxDataService.GetTableDetails(getTableDetailsOptionsModel) + result, response, operationErr := watsonxDataService.UpdateDataPolicy(updateDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) @@ -35611,7 +38111,7 @@ var _ = Describe(`WatsonxDataV2`, func() { // Re-test the timeout error with retries disabled ctx, cancelFunc2 := context.WithTimeout(context.Background(), 80*time.Millisecond) defer cancelFunc2() - _, _, operationErr = watsonxDataService.GetTableDetailsWithContext(ctx, getTableDetailsOptionsModel) + _, _, operationErr = watsonxDataService.UpdateDataPolicyWithContext(ctx, updateDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring("deadline exceeded")) }) @@ -35625,21 +38125,35 @@ var _ = Describe(`WatsonxDataV2`, func() { defer GinkgoRecover() // Verify the contents of the request - Expect(req.URL.EscapedPath()).To(Equal(getTableDetailsPath)) - Expect(req.Method).To(Equal("GET")) + Expect(req.URL.EscapedPath()).To(Equal(updateDataPolicyPath)) + Expect(req.Method).To(Equal("PATCH")) + + // For gzip-disabled operation, verify Content-Encoding is not set. + Expect(req.Header.Get("Content-Encoding")).To(BeEmpty()) + + // If there is a body, then make sure we can read it + bodyBuf := new(bytes.Buffer) + if req.Header.Get("Content-Encoding") == "gzip" { + body, err := core.NewGzipDecompressionReader(req.Body) + Expect(err).To(BeNil()) + _, err = bodyBuf.ReadFrom(body) + Expect(err).To(BeNil()) + } else { + _, err := bodyBuf.ReadFrom(req.Body) + Expect(err).To(BeNil()) + } + fmt.Fprintf(GinkgoWriter, " Request body: %s", bodyBuf.String()) Expect(req.Header["Authinstanceid"]).ToNot(BeNil()) Expect(req.Header["Authinstanceid"][0]).To(Equal(fmt.Sprintf("%v", "testString"))) - Expect(req.URL.Query()["catalog_name"]).To(Equal([]string{"testString"})) - Expect(req.URL.Query()["schema_name"]).To(Equal([]string{"testString"})) // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"message": "Message", "message_code": "MessageCode", "tables": [{"bucket": "Bucket", "catalog": "Catalog", "columns": [{"column": "Column", "index": 5, "type": "Type"}], "owner": "Owner", "schema": "Schema", "table": "Table"}]}`) + fmt.Fprintf(res, "%s", `{"catalog_name": "catalog1", "data_artifact": "schema1/table1/(column1|column2)", "description": "This is a data policy", "metadata": {"created_at": "timestamp", "creator": "creator", "modifier": "modifier", "pid": "pid", "updated_at": "timestamp", "version": "version"}, "policy_name": "policy1", "resource_id": "services/milvus/milvus1", "rule_count": 26, "rules": [{"actions": ["Actions"], "effect": "allow", "grantees": [{"key": "user_name", "type": "user_identity", "value": "user1"}], "transform_columns": {"mask_condition": "NIL", "mask_type": "mask_show_last_4", "mask_value": "NIL"}, "transform_rows": {"filter_condition": "NIL", "row_filter": "addr_country='US'"}}], "status": "active"}`) })) }) - It(`Invoke GetTableDetails successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateDataPolicy successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) @@ -35647,53 +38161,65 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(watsonxDataService).ToNot(BeNil()) // Invoke operation with nil options model (negative test) - result, response, operationErr := watsonxDataService.GetTableDetails(nil) + result, response, operationErr := watsonxDataService.UpdateDataPolicy(nil) Expect(operationErr).NotTo(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct an instance of the GetTableDetailsOptions model - getTableDetailsOptionsModel := new(watsonxdatav2.GetTableDetailsOptions) - getTableDetailsOptionsModel.TableName = core.StringPtr("testString") - getTableDetailsOptionsModel.CatalogName = core.StringPtr("testString") - getTableDetailsOptionsModel.SchemaName = core.StringPtr("testString") - getTableDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getTableDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" + + // Construct an instance of the UpdateDataPolicyOptions model + updateDataPolicyOptionsModel := new(watsonxdatav3.UpdateDataPolicyOptions) + updateDataPolicyOptionsModel.Name = core.StringPtr("testString") + updateDataPolicyOptionsModel.Body = []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel} + updateDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with valid options model (positive test) - result, response, operationErr = watsonxDataService.GetTableDetails(getTableDetailsOptionsModel) + result, response, operationErr = watsonxDataService.UpdateDataPolicy(updateDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) Expect(result).ToNot(BeNil()) }) - It(`Invoke GetTableDetails with error: Operation validation and request error`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateDataPolicy with error: Operation validation and request error`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetTableDetailsOptions model - getTableDetailsOptionsModel := new(watsonxdatav2.GetTableDetailsOptions) - getTableDetailsOptionsModel.TableName = core.StringPtr("testString") - getTableDetailsOptionsModel.CatalogName = core.StringPtr("testString") - getTableDetailsOptionsModel.SchemaName = core.StringPtr("testString") - getTableDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getTableDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" + + // Construct an instance of the UpdateDataPolicyOptions model + updateDataPolicyOptionsModel := new(watsonxdatav3.UpdateDataPolicyOptions) + updateDataPolicyOptionsModel.Name = core.StringPtr("testString") + updateDataPolicyOptionsModel.Body = []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel} + updateDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation with empty URL (negative test) err := watsonxDataService.SetServiceURL("") Expect(err).To(BeNil()) - result, response, operationErr := watsonxDataService.GetTableDetails(getTableDetailsOptionsModel) + result, response, operationErr := watsonxDataService.UpdateDataPolicy(updateDataPolicyOptionsModel) Expect(operationErr).ToNot(BeNil()) Expect(operationErr.Error()).To(ContainSubstring(core.ERRORMSG_SERVICE_URL_MISSING)) Expect(response).To(BeNil()) Expect(result).To(BeNil()) - // Construct a second instance of the GetTableDetailsOptions model with no property values - getTableDetailsOptionsModelNew := new(watsonxdatav2.GetTableDetailsOptions) + // Construct a second instance of the UpdateDataPolicyOptions model with no property values + updateDataPolicyOptionsModelNew := new(watsonxdatav3.UpdateDataPolicyOptions) // Invoke operation with invalid model (negative test) - result, response, operationErr = watsonxDataService.GetTableDetails(getTableDetailsOptionsModelNew) + result, response, operationErr = watsonxDataService.UpdateDataPolicy(updateDataPolicyOptionsModelNew) Expect(operationErr).ToNot(BeNil()) Expect(response).To(BeNil()) Expect(result).To(BeNil()) @@ -35711,24 +38237,30 @@ var _ = Describe(`WatsonxDataV2`, func() { res.WriteHeader(200) })) }) - It(`Invoke GetTableDetails successfully`, func() { - watsonxDataService, serviceErr := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ + It(`Invoke UpdateDataPolicy successfully`, func() { + watsonxDataService, serviceErr := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ URL: testServer.URL, Authenticator: &core.NoAuthAuthenticator{}, }) Expect(serviceErr).To(BeNil()) Expect(watsonxDataService).ToNot(BeNil()) - // Construct an instance of the GetTableDetailsOptions model - getTableDetailsOptionsModel := new(watsonxdatav2.GetTableDetailsOptions) - getTableDetailsOptionsModel.TableName = core.StringPtr("testString") - getTableDetailsOptionsModel.CatalogName = core.StringPtr("testString") - getTableDetailsOptionsModel.SchemaName = core.StringPtr("testString") - getTableDetailsOptionsModel.AuthInstanceID = core.StringPtr("testString") - getTableDetailsOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" + + // Construct an instance of the UpdateDataPolicyOptions model + updateDataPolicyOptionsModel := new(watsonxdatav3.UpdateDataPolicyOptions) + updateDataPolicyOptionsModel.Name = core.StringPtr("testString") + updateDataPolicyOptionsModel.Body = []watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel} + updateDataPolicyOptionsModel.AuthInstanceID = core.StringPtr("testString") + updateDataPolicyOptionsModel.Headers = map[string]string{"x-custom-header": "x-custom-value"} // Invoke operation - result, response, operationErr := watsonxDataService.GetTableDetails(getTableDetailsOptionsModel) + result, response, operationErr := watsonxDataService.UpdateDataPolicy(updateDataPolicyOptionsModel) Expect(operationErr).To(BeNil()) Expect(response).ToNot(BeNil()) @@ -35742,260 +38274,355 @@ var _ = Describe(`WatsonxDataV2`, func() { }) Describe(`Model constructor tests`, func() { Context(`Using a service client instance`, func() { - watsonxDataService, _ := watsonxdatav2.NewWatsonxDataV2(&watsonxdatav2.WatsonxDataV2Options{ - URL: "http://watsonxdatav2modelgenerator.com", + watsonxDataService, _ := watsonxdatav3.NewWatsonxDataV3(&watsonxdatav3.WatsonxDataV3Options{ + URL: "http://watsonxdatav3modelgenerator.com", Authenticator: &core.NoAuthAuthenticator{}, }) - It(`Invoke NewAddBucketCatalogOptions successfully`, func() { - // Construct an instance of the AddBucketCatalogOptions model - bucketID := "testString" - addBucketCatalogOptionsModel := watsonxDataService.NewAddBucketCatalogOptions(bucketID) - addBucketCatalogOptionsModel.SetBucketID("testString") - addBucketCatalogOptionsModel.SetBasePath("/abc/def") - addBucketCatalogOptionsModel.SetCatalogName("sampleCatalog") - addBucketCatalogOptionsModel.SetCatalogTags([]string{"catalog_tag_1", "catalog_tag_2"}) - addBucketCatalogOptionsModel.SetCatalogType("iceberg") - addBucketCatalogOptionsModel.SetAuthInstanceID("testString") - addBucketCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(addBucketCatalogOptionsModel).ToNot(BeNil()) - Expect(addBucketCatalogOptionsModel.BucketID).To(Equal(core.StringPtr("testString"))) - Expect(addBucketCatalogOptionsModel.BasePath).To(Equal(core.StringPtr("/abc/def"))) - Expect(addBucketCatalogOptionsModel.CatalogName).To(Equal(core.StringPtr("sampleCatalog"))) - Expect(addBucketCatalogOptionsModel.CatalogTags).To(Equal([]string{"catalog_tag_1", "catalog_tag_2"})) - Expect(addBucketCatalogOptionsModel.CatalogType).To(Equal(core.StringPtr("iceberg"))) - Expect(addBucketCatalogOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(addBucketCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + It(`Invoke NewAddDatabaseCatalogOptions successfully`, func() { + // Construct an instance of the AddDatabaseCatalogOptions model + databaseID := "testString" + addDatabaseCatalogOptionsModel := watsonxDataService.NewAddDatabaseCatalogOptions(databaseID) + addDatabaseCatalogOptionsModel.SetDatabaseID("testString") + addDatabaseCatalogOptionsModel.SetCatalogName("sampleCatalog") + addDatabaseCatalogOptionsModel.SetAuthInstanceID("testString") + addDatabaseCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(addDatabaseCatalogOptionsModel).ToNot(BeNil()) + Expect(addDatabaseCatalogOptionsModel.DatabaseID).To(Equal(core.StringPtr("testString"))) + Expect(addDatabaseCatalogOptionsModel.CatalogName).To(Equal(core.StringPtr("sampleCatalog"))) + Expect(addDatabaseCatalogOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(addDatabaseCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewAddStorageCatalogOptions successfully`, func() { + // Construct an instance of the AddStorageCatalogOptions model + storageID := "testString" + addStorageCatalogOptionsCatalogTags := []string{"catalog_tag_1", "catalog_tag_2"} + addStorageCatalogOptionsModel := watsonxDataService.NewAddStorageCatalogOptions(storageID, addStorageCatalogOptionsCatalogTags) + addStorageCatalogOptionsModel.SetStorageID("testString") + addStorageCatalogOptionsModel.SetCatalogTags([]string{"catalog_tag_1", "catalog_tag_2"}) + addStorageCatalogOptionsModel.SetBasePath("/abc/def") + addStorageCatalogOptionsModel.SetCatalogName("sampleCatalog") + addStorageCatalogOptionsModel.SetCatalogType("iceberg") + addStorageCatalogOptionsModel.SetSkipMdsCall(false) + addStorageCatalogOptionsModel.SetAuthInstanceID("testString") + addStorageCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(addStorageCatalogOptionsModel).ToNot(BeNil()) + Expect(addStorageCatalogOptionsModel.StorageID).To(Equal(core.StringPtr("testString"))) + Expect(addStorageCatalogOptionsModel.CatalogTags).To(Equal([]string{"catalog_tag_1", "catalog_tag_2"})) + Expect(addStorageCatalogOptionsModel.BasePath).To(Equal(core.StringPtr("/abc/def"))) + Expect(addStorageCatalogOptionsModel.CatalogName).To(Equal(core.StringPtr("sampleCatalog"))) + Expect(addStorageCatalogOptionsModel.CatalogType).To(Equal(core.StringPtr("iceberg"))) + Expect(addStorageCatalogOptionsModel.SkipMdsCall).To(Equal(core.BoolPtr(false))) + Expect(addStorageCatalogOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(addStorageCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewAutoscalingConfig successfully`, func() { + typeVar := "cpu" + _model, err := watsonxDataService.NewAutoscalingConfig(typeVar) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) }) It(`Invoke NewBucketDetails successfully`, func() { - bucketName := "sample-bucket" - _model, err := watsonxDataService.NewBucketDetails(bucketName) + name := "testString" + typeVar := "adls_gen1" + _model, err := watsonxDataService.NewBucketDetails(name, typeVar) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewCreateActivateBucketOptions successfully`, func() { - // Construct an instance of the CreateActivateBucketOptions model - bucketID := "testString" - createActivateBucketOptionsModel := watsonxDataService.NewCreateActivateBucketOptions(bucketID) - createActivateBucketOptionsModel.SetBucketID("testString") - createActivateBucketOptionsModel.SetAuthInstanceID("testString") - createActivateBucketOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createActivateBucketOptionsModel).ToNot(BeNil()) - Expect(createActivateBucketOptionsModel.BucketID).To(Equal(core.StringPtr("testString"))) - Expect(createActivateBucketOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createActivateBucketOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateBucketRegistrationOptions successfully`, func() { - // Construct an instance of the BucketCatalog model - bucketCatalogModel := new(watsonxdatav2.BucketCatalog) - Expect(bucketCatalogModel).ToNot(BeNil()) - bucketCatalogModel.BasePath = core.StringPtr("/abc/def") - bucketCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - bucketCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - bucketCatalogModel.CatalogType = core.StringPtr("iceberg") - Expect(bucketCatalogModel.BasePath).To(Equal(core.StringPtr("/abc/def"))) - Expect(bucketCatalogModel.CatalogName).To(Equal(core.StringPtr("sampleCatalog"))) - Expect(bucketCatalogModel.CatalogTags).To(Equal([]string{"catalog_tag_1", "catalog_tag_2"})) - Expect(bucketCatalogModel.CatalogType).To(Equal(core.StringPtr("iceberg"))) - - // Construct an instance of the BucketDetails model - bucketDetailsModel := new(watsonxdatav2.BucketDetails) - Expect(bucketDetailsModel).ToNot(BeNil()) - bucketDetailsModel.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - bucketDetailsModel.BucketName = core.StringPtr("sample-bucket") - bucketDetailsModel.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - bucketDetailsModel.KeyFile = core.StringPtr("key_file") - bucketDetailsModel.Provider = core.StringPtr("ibm_cos") - bucketDetailsModel.Region = core.StringPtr("us-south") - bucketDetailsModel.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") - Expect(bucketDetailsModel.AccessKey).To(Equal(core.StringPtr("b9cbf248ea5c4c96947e64407108559j"))) - Expect(bucketDetailsModel.BucketName).To(Equal(core.StringPtr("sample-bucket"))) - Expect(bucketDetailsModel.Endpoint).To(Equal(core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/"))) - Expect(bucketDetailsModel.KeyFile).To(Equal(core.StringPtr("key_file"))) - Expect(bucketDetailsModel.Provider).To(Equal(core.StringPtr("ibm_cos"))) - Expect(bucketDetailsModel.Region).To(Equal(core.StringPtr("us-south"))) - Expect(bucketDetailsModel.SecretKey).To(Equal(core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87"))) - - // Construct an instance of the StorageDetails model - storageDetailsModel := new(watsonxdatav2.StorageDetails) - Expect(storageDetailsModel).ToNot(BeNil()) - storageDetailsModel.AccessKey = core.StringPtr("") - storageDetailsModel.ApplicationID = core.StringPtr("") - storageDetailsModel.AuthMode = core.StringPtr("") - storageDetailsModel.ContainerName = core.StringPtr("sample-container") - storageDetailsModel.DirectoryID = core.StringPtr("") - storageDetailsModel.Endpoint = core.StringPtr("abfss://@.dfs.core.windows.net/") - storageDetailsModel.SasToken = core.StringPtr("") - storageDetailsModel.SecretKey = core.StringPtr("secret_key") - storageDetailsModel.StorageAccountName = core.StringPtr("sample-storage") - Expect(storageDetailsModel.AccessKey).To(Equal(core.StringPtr(""))) - Expect(storageDetailsModel.ApplicationID).To(Equal(core.StringPtr(""))) - Expect(storageDetailsModel.AuthMode).To(Equal(core.StringPtr(""))) - Expect(storageDetailsModel.ContainerName).To(Equal(core.StringPtr("sample-container"))) - Expect(storageDetailsModel.DirectoryID).To(Equal(core.StringPtr(""))) - Expect(storageDetailsModel.Endpoint).To(Equal(core.StringPtr("abfss://@.dfs.core.windows.net/"))) - Expect(storageDetailsModel.SasToken).To(Equal(core.StringPtr(""))) - Expect(storageDetailsModel.SecretKey).To(Equal(core.StringPtr("secret_key"))) - Expect(storageDetailsModel.StorageAccountName).To(Equal(core.StringPtr("sample-storage"))) - - // Construct an instance of the CreateBucketRegistrationOptions model - createBucketRegistrationOptionsBucketType := "ibm_cos" - createBucketRegistrationOptionsDescription := "COS bucket for customer data" - createBucketRegistrationOptionsManagedBy := "ibm" - createBucketRegistrationOptionsModel := watsonxDataService.NewCreateBucketRegistrationOptions(createBucketRegistrationOptionsBucketType, createBucketRegistrationOptionsDescription, createBucketRegistrationOptionsManagedBy) - createBucketRegistrationOptionsModel.SetBucketType("ibm_cos") - createBucketRegistrationOptionsModel.SetDescription("COS bucket for customer data") - createBucketRegistrationOptionsModel.SetManagedBy("ibm") - createBucketRegistrationOptionsModel.SetAssociatedCatalog(bucketCatalogModel) - createBucketRegistrationOptionsModel.SetBucketDetails(bucketDetailsModel) - createBucketRegistrationOptionsModel.SetBucketDisplayName("sample-bucket-displayname") - createBucketRegistrationOptionsModel.SetRegion("us-south") - createBucketRegistrationOptionsModel.SetStorageDetails(storageDetailsModel) - createBucketRegistrationOptionsModel.SetTags([]string{"bucket-tag1", "bucket-tag2"}) - createBucketRegistrationOptionsModel.SetAuthInstanceID("testString") - createBucketRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createBucketRegistrationOptionsModel).ToNot(BeNil()) - Expect(createBucketRegistrationOptionsModel.BucketType).To(Equal(core.StringPtr("ibm_cos"))) - Expect(createBucketRegistrationOptionsModel.Description).To(Equal(core.StringPtr("COS bucket for customer data"))) - Expect(createBucketRegistrationOptionsModel.ManagedBy).To(Equal(core.StringPtr("ibm"))) - Expect(createBucketRegistrationOptionsModel.AssociatedCatalog).To(Equal(bucketCatalogModel)) - Expect(createBucketRegistrationOptionsModel.BucketDetails).To(Equal(bucketDetailsModel)) - Expect(createBucketRegistrationOptionsModel.BucketDisplayName).To(Equal(core.StringPtr("sample-bucket-displayname"))) - Expect(createBucketRegistrationOptionsModel.Region).To(Equal(core.StringPtr("us-south"))) - Expect(createBucketRegistrationOptionsModel.StorageDetails).To(Equal(storageDetailsModel)) - Expect(createBucketRegistrationOptionsModel.Tags).To(Equal([]string{"bucket-tag1", "bucket-tag2"})) - Expect(createBucketRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createBucketRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + It(`Invoke NewBulkUpdateResourceAccessPoliciesOptions successfully`, func() { + // Construct an instance of the ResourceDetailsBulkUpdate model + resourceDetailsBulkUpdateModel := new(watsonxdatav3.ResourceDetailsBulkUpdate) + Expect(resourceDetailsBulkUpdateModel).ToNot(BeNil()) + resourceDetailsBulkUpdateModel.ID = core.StringPtr("presto01") + resourceDetailsBulkUpdateModel.Name = core.StringPtr("hive_data") + resourceDetailsBulkUpdateModel.Type = core.StringPtr("presto") + Expect(resourceDetailsBulkUpdateModel.ID).To(Equal(core.StringPtr("presto01"))) + Expect(resourceDetailsBulkUpdateModel.Name).To(Equal(core.StringPtr("hive_data"))) + Expect(resourceDetailsBulkUpdateModel.Type).To(Equal(core.StringPtr("presto"))) + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + Expect(subjectModel).ToNot(BeNil()) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + Expect(subjectModel.Type).To(Equal(core.StringPtr("user"))) + Expect(subjectModel.Value).To(Equal(core.StringPtr("user1"))) + + // Construct an instance of the SubjectBulkUpdate model + subjectBulkUpdateModel := new(watsonxdatav3.SubjectBulkUpdate) + Expect(subjectBulkUpdateModel).ToNot(BeNil()) + subjectBulkUpdateModel.Permissions = []string{"testString"} + subjectBulkUpdateModel.Subject = subjectModel + Expect(subjectBulkUpdateModel.Permissions).To(Equal([]string{"testString"})) + Expect(subjectBulkUpdateModel.Subject).To(Equal(subjectModel)) + + // Construct an instance of the AccessPolicyBulkUpdate model + accessPolicyBulkUpdateModel := new(watsonxdatav3.AccessPolicyBulkUpdate) + Expect(accessPolicyBulkUpdateModel).ToNot(BeNil()) + accessPolicyBulkUpdateModel.Resources = []watsonxdatav3.ResourceDetailsBulkUpdate{*resourceDetailsBulkUpdateModel} + accessPolicyBulkUpdateModel.Subjects = []watsonxdatav3.SubjectBulkUpdate{*subjectBulkUpdateModel} + Expect(accessPolicyBulkUpdateModel.Resources).To(Equal([]watsonxdatav3.ResourceDetailsBulkUpdate{*resourceDetailsBulkUpdateModel})) + Expect(accessPolicyBulkUpdateModel.Subjects).To(Equal([]watsonxdatav3.SubjectBulkUpdate{*subjectBulkUpdateModel})) + + // Construct an instance of the BulkUpdateResourceAccessPoliciesOptions model + bulkUpdateResourceAccessPoliciesOptionsModel := watsonxDataService.NewBulkUpdateResourceAccessPoliciesOptions() + bulkUpdateResourceAccessPoliciesOptionsModel.SetAccessPolicies([]watsonxdatav3.AccessPolicyBulkUpdate{*accessPolicyBulkUpdateModel}) + bulkUpdateResourceAccessPoliciesOptionsModel.SetAuthInstanceID("testString") + bulkUpdateResourceAccessPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(bulkUpdateResourceAccessPoliciesOptionsModel).ToNot(BeNil()) + Expect(bulkUpdateResourceAccessPoliciesOptionsModel.AccessPolicies).To(Equal([]watsonxdatav3.AccessPolicyBulkUpdate{*accessPolicyBulkUpdateModel})) + Expect(bulkUpdateResourceAccessPoliciesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(bulkUpdateResourceAccessPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewCatalogs successfully`, func() { + catalogNames := []string{"iceberg_data", "hive_data"} + _model, err := watsonxDataService.NewCatalogs(catalogNames) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewCoordinatorNodeDescriptionBody successfully`, func() { + nodeType := "starter" + quantity := int64(1) + _model, err := watsonxDataService.NewCoordinatorNodeDescriptionBody(nodeType, quantity) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) }) It(`Invoke NewCreateColumnsOptions successfully`, func() { // Construct an instance of the Column model - columnModel := new(watsonxdatav2.Column) + columnModel := new(watsonxdatav3.Column) Expect(columnModel).ToNot(BeNil()) - columnModel.ColumnName = core.StringPtr("expenses") - columnModel.Comment = core.StringPtr("expenses column") - columnModel.Extra = core.StringPtr("varchar") + columnModel.Comment = core.StringPtr("Expenses column for each department") + columnModel.Extra = core.StringPtr("AUTO_INCREMENT") columnModel.Length = core.StringPtr("30") - columnModel.Scale = core.StringPtr("2") + columnModel.Name = core.StringPtr("expenses") columnModel.Precision = core.StringPtr("10") + columnModel.Scale = core.StringPtr("2") columnModel.Type = core.StringPtr("varchar") - Expect(columnModel.ColumnName).To(Equal(core.StringPtr("expenses"))) - Expect(columnModel.Comment).To(Equal(core.StringPtr("expenses column"))) - Expect(columnModel.Extra).To(Equal(core.StringPtr("varchar"))) + Expect(columnModel.Comment).To(Equal(core.StringPtr("Expenses column for each department"))) + Expect(columnModel.Extra).To(Equal(core.StringPtr("AUTO_INCREMENT"))) Expect(columnModel.Length).To(Equal(core.StringPtr("30"))) - Expect(columnModel.Scale).To(Equal(core.StringPtr("2"))) + Expect(columnModel.Name).To(Equal(core.StringPtr("expenses"))) Expect(columnModel.Precision).To(Equal(core.StringPtr("10"))) + Expect(columnModel.Scale).To(Equal(core.StringPtr("2"))) Expect(columnModel.Type).To(Equal(core.StringPtr("varchar"))) // Construct an instance of the CreateColumnsOptions model engineID := "testString" - catalogID := "testString" - schemaID := "testString" - tableID := "testString" - createColumnsOptionsModel := watsonxDataService.NewCreateColumnsOptions(engineID, catalogID, schemaID, tableID) + catalogName := "testString" + schemaName := "testString" + tableName := "testString" + createColumnsOptionsModel := watsonxDataService.NewCreateColumnsOptions(engineID, catalogName, schemaName, tableName) createColumnsOptionsModel.SetEngineID("testString") - createColumnsOptionsModel.SetCatalogID("testString") - createColumnsOptionsModel.SetSchemaID("testString") - createColumnsOptionsModel.SetTableID("testString") - createColumnsOptionsModel.SetColumns([]watsonxdatav2.Column{*columnModel}) + createColumnsOptionsModel.SetCatalogName("testString") + createColumnsOptionsModel.SetSchemaName("testString") + createColumnsOptionsModel.SetTableName("testString") + createColumnsOptionsModel.SetColumns([]watsonxdatav3.Column{*columnModel}) createColumnsOptionsModel.SetAuthInstanceID("testString") createColumnsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createColumnsOptionsModel).ToNot(BeNil()) Expect(createColumnsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(createColumnsOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(createColumnsOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) - Expect(createColumnsOptionsModel.TableID).To(Equal(core.StringPtr("testString"))) - Expect(createColumnsOptionsModel.Columns).To(Equal([]watsonxdatav2.Column{*columnModel})) + Expect(createColumnsOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(createColumnsOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(createColumnsOptionsModel.TableName).To(Equal(core.StringPtr("testString"))) + Expect(createColumnsOptionsModel.Columns).To(Equal([]watsonxdatav3.Column{*columnModel})) Expect(createColumnsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createColumnsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreateDataPolicyOptions successfully`, func() { + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + Expect(ruleGranteeModel).ToNot(BeNil()) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + Expect(ruleGranteeModel.Key).To(Equal(core.StringPtr("user_name"))) + Expect(ruleGranteeModel.Type).To(Equal(core.StringPtr("user_identity"))) + Expect(ruleGranteeModel.Value).To(Equal(core.StringPtr("user1"))) + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + Expect(transformColumnPropertiesModel).ToNot(BeNil()) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + Expect(transformColumnPropertiesModel.MaskCondition).To(Equal(core.StringPtr("NIL"))) + Expect(transformColumnPropertiesModel.MaskType).To(Equal(core.StringPtr("mask_show_last_4"))) + Expect(transformColumnPropertiesModel.MaskValue).To(Equal(core.StringPtr("NIL"))) + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + Expect(rowFilterPropertiesModel).ToNot(BeNil()) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + Expect(rowFilterPropertiesModel.FilterCondition).To(Equal(core.StringPtr("NIL"))) + Expect(rowFilterPropertiesModel.RowFilter).To(Equal(core.StringPtr("addr_country='US'"))) + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + Expect(ruleV2Model).ToNot(BeNil()) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + Expect(ruleV2Model.Actions).To(Equal([]string{"alter", "create"})) + Expect(ruleV2Model.Effect).To(Equal(core.StringPtr("allow"))) + Expect(ruleV2Model.Grantees).To(Equal([]watsonxdatav3.RuleGrantee{*ruleGranteeModel})) + Expect(ruleV2Model.TransformColumns).To(Equal(transformColumnPropertiesModel)) + Expect(ruleV2Model.TransformRows).To(Equal(rowFilterPropertiesModel)) + + // Construct an instance of the CreateDataPolicyOptions model + createDataPolicyOptionsDataArtifact := "schema1/table1/(column1|column2)" + createDataPolicyOptionsRules := []watsonxdatav3.RuleV2{} + createDataPolicyOptionsModel := watsonxDataService.NewCreateDataPolicyOptions(createDataPolicyOptionsDataArtifact, createDataPolicyOptionsRules) + createDataPolicyOptionsModel.SetDataArtifact("schema1/table1/(column1|column2)") + createDataPolicyOptionsModel.SetRules([]watsonxdatav3.RuleV2{*ruleV2Model}) + createDataPolicyOptionsModel.SetCatalogName("catalog1") + createDataPolicyOptionsModel.SetCatalogType("catalog1") + createDataPolicyOptionsModel.SetDescription("policy description") + createDataPolicyOptionsModel.SetPolicyName("policy1") + createDataPolicyOptionsModel.SetResourceID("catalog1") + createDataPolicyOptionsModel.SetStatus("active") + createDataPolicyOptionsModel.SetAuthInstanceID("testString") + createDataPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createDataPolicyOptionsModel).ToNot(BeNil()) + Expect(createDataPolicyOptionsModel.DataArtifact).To(Equal(core.StringPtr("schema1/table1/(column1|column2)"))) + Expect(createDataPolicyOptionsModel.Rules).To(Equal([]watsonxdatav3.RuleV2{*ruleV2Model})) + Expect(createDataPolicyOptionsModel.CatalogName).To(Equal(core.StringPtr("catalog1"))) + Expect(createDataPolicyOptionsModel.CatalogType).To(Equal(core.StringPtr("catalog1"))) + Expect(createDataPolicyOptionsModel.Description).To(Equal(core.StringPtr("policy description"))) + Expect(createDataPolicyOptionsModel.PolicyName).To(Equal(core.StringPtr("policy1"))) + Expect(createDataPolicyOptionsModel.ResourceID).To(Equal(core.StringPtr("catalog1"))) + Expect(createDataPolicyOptionsModel.Status).To(Equal(core.StringPtr("active"))) + Expect(createDataPolicyOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(createDataPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCreateDatabaseRegistrationOptions successfully`, func() { - // Construct an instance of the DatabaseCatalog model - databaseCatalogModel := new(watsonxdatav2.DatabaseCatalog) - Expect(databaseCatalogModel).ToNot(BeNil()) - databaseCatalogModel.CatalogName = core.StringPtr("sampleCatalog") - databaseCatalogModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - databaseCatalogModel.CatalogType = core.StringPtr("iceberg") - Expect(databaseCatalogModel.CatalogName).To(Equal(core.StringPtr("sampleCatalog"))) - Expect(databaseCatalogModel.CatalogTags).To(Equal([]string{"catalog_tag_1", "catalog_tag_2"})) - Expect(databaseCatalogModel.CatalogType).To(Equal(core.StringPtr("iceberg"))) - - // Construct an instance of the DatabaseDetails model - databaseDetailsModel := new(watsonxdatav2.DatabaseDetails) - Expect(databaseDetailsModel).ToNot(BeNil()) - databaseDetailsModel.AuthenticationType = core.StringPtr("LDAP") - databaseDetailsModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.Certificate = core.StringPtr("contents of a pem/crt file") - databaseDetailsModel.CertificateExtension = core.StringPtr("pem/crt") - databaseDetailsModel.ConnectionMethod = core.StringPtr("basic, apikey") - databaseDetailsModel.ConnectionMode = core.StringPtr("service_name") - databaseDetailsModel.ConnectionModeValue = core.StringPtr("orclpdb") - databaseDetailsModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") - databaseDetailsModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") - databaseDetailsModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") - databaseDetailsModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") - databaseDetailsModel.CpdHostname = core.StringPtr("samplecpdhostname") - databaseDetailsModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") - databaseDetailsModel.DatabaseName = core.StringPtr("new_database") - databaseDetailsModel.Hostname = core.StringPtr("db2@.com") - databaseDetailsModel.HostnameInCertificate = core.StringPtr("samplehostname") - databaseDetailsModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") - databaseDetailsModel.InformixServer = core.StringPtr("ol_informix1410") - databaseDetailsModel.Password = core.StringPtr("samplepassword") - databaseDetailsModel.Port = core.Int64Ptr(int64(4553)) - databaseDetailsModel.ProjectID = core.StringPtr("conops-bigquery") - databaseDetailsModel.Sasl = core.BoolPtr(true) - databaseDetailsModel.ServiceApiKey = core.StringPtr("sampleapikey") - databaseDetailsModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") - databaseDetailsModel.ServicePassword = core.StringPtr("samplepassword") - databaseDetailsModel.ServicePort = core.Int64Ptr(int64(443)) - databaseDetailsModel.ServiceSsl = core.BoolPtr(true) - databaseDetailsModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") - databaseDetailsModel.ServiceUsername = core.StringPtr("sampleusername") - databaseDetailsModel.Ssl = core.BoolPtr(true) - databaseDetailsModel.Tables = core.StringPtr("kafka_table_name") - databaseDetailsModel.Username = core.StringPtr("sampleuser") - databaseDetailsModel.ValidateServerCertificate = core.BoolPtr(true) - databaseDetailsModel.VerifyHostName = core.BoolPtr(true) - Expect(databaseDetailsModel.AuthenticationType).To(Equal(core.StringPtr("LDAP"))) - Expect(databaseDetailsModel.BrokerAuthenticationPassword).To(Equal(core.StringPtr("samplepassword"))) - Expect(databaseDetailsModel.BrokerAuthenticationType).To(Equal(core.StringPtr("PASSWORD"))) - Expect(databaseDetailsModel.BrokerAuthenticationUser).To(Equal(core.StringPtr("sampleuser"))) - Expect(databaseDetailsModel.Certificate).To(Equal(core.StringPtr("contents of a pem/crt file"))) - Expect(databaseDetailsModel.CertificateExtension).To(Equal(core.StringPtr("pem/crt"))) - Expect(databaseDetailsModel.ConnectionMethod).To(Equal(core.StringPtr("basic, apikey"))) - Expect(databaseDetailsModel.ConnectionMode).To(Equal(core.StringPtr("service_name"))) - Expect(databaseDetailsModel.ConnectionModeValue).To(Equal(core.StringPtr("orclpdb"))) - Expect(databaseDetailsModel.ConnectionType).To(Equal(core.StringPtr("JDBC, Arrow flight"))) - Expect(databaseDetailsModel.ControllerAuthenticationPassword).To(Equal(core.StringPtr("samplepassword"))) - Expect(databaseDetailsModel.ControllerAuthenticationType).To(Equal(core.StringPtr("PASSWORD"))) - Expect(databaseDetailsModel.ControllerAuthenticationUser).To(Equal(core.StringPtr("sampleuser"))) - Expect(databaseDetailsModel.CpdHostname).To(Equal(core.StringPtr("samplecpdhostname"))) - Expect(databaseDetailsModel.CredentialsKey).To(Equal(core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......"))) - Expect(databaseDetailsModel.DatabaseName).To(Equal(core.StringPtr("new_database"))) - Expect(databaseDetailsModel.Hostname).To(Equal(core.StringPtr("db2@.com"))) - Expect(databaseDetailsModel.HostnameInCertificate).To(Equal(core.StringPtr("samplehostname"))) - Expect(databaseDetailsModel.Hosts).To(Equal(core.StringPtr("abc.com:1234,xyz.com:4321"))) - Expect(databaseDetailsModel.InformixServer).To(Equal(core.StringPtr("ol_informix1410"))) - Expect(databaseDetailsModel.Password).To(Equal(core.StringPtr("samplepassword"))) - Expect(databaseDetailsModel.Port).To(Equal(core.Int64Ptr(int64(4553)))) - Expect(databaseDetailsModel.ProjectID).To(Equal(core.StringPtr("conops-bigquery"))) - Expect(databaseDetailsModel.Sasl).To(Equal(core.BoolPtr(true))) - Expect(databaseDetailsModel.ServiceApiKey).To(Equal(core.StringPtr("sampleapikey"))) - Expect(databaseDetailsModel.ServiceHostname).To(Equal(core.StringPtr("api.dataplatform.dev.cloud.ibm.com"))) - Expect(databaseDetailsModel.ServicePassword).To(Equal(core.StringPtr("samplepassword"))) - Expect(databaseDetailsModel.ServicePort).To(Equal(core.Int64Ptr(int64(443)))) - Expect(databaseDetailsModel.ServiceSsl).To(Equal(core.BoolPtr(true))) - Expect(databaseDetailsModel.ServiceTokenURL).To(Equal(core.StringPtr("sampletoakenurl"))) - Expect(databaseDetailsModel.ServiceUsername).To(Equal(core.StringPtr("sampleusername"))) - Expect(databaseDetailsModel.Ssl).To(Equal(core.BoolPtr(true))) - Expect(databaseDetailsModel.Tables).To(Equal(core.StringPtr("kafka_table_name"))) - Expect(databaseDetailsModel.Username).To(Equal(core.StringPtr("sampleuser"))) - Expect(databaseDetailsModel.ValidateServerCertificate).To(Equal(core.BoolPtr(true))) - Expect(databaseDetailsModel.VerifyHostName).To(Equal(core.BoolPtr(true))) + // Construct an instance of the DatabaseCatalogPrototype model + databaseCatalogPrototypeModel := new(watsonxdatav3.DatabaseCatalogPrototype) + Expect(databaseCatalogPrototypeModel).ToNot(BeNil()) + databaseCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + databaseCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + Expect(databaseCatalogPrototypeModel.CatalogName).To(Equal(core.StringPtr("sampleCatalog"))) + Expect(databaseCatalogPrototypeModel.CatalogType).To(Equal(core.StringPtr("iceberg"))) + + // Construct an instance of the SecretDetails model + secretDetailsModel := new(watsonxdatav3.SecretDetails) + Expect(secretDetailsModel).ToNot(BeNil()) + secretDetailsModel.Key = core.StringPtr("secret key") + secretDetailsModel.SecretName = core.StringPtr("secret name") + secretDetailsModel.SecretUrn = core.StringPtr("secret urn") + Expect(secretDetailsModel.Key).To(Equal(core.StringPtr("secret key"))) + Expect(secretDetailsModel.SecretName).To(Equal(core.StringPtr("secret name"))) + Expect(secretDetailsModel.SecretUrn).To(Equal(core.StringPtr("secret urn"))) + + // Construct an instance of the DatabaseDetailsPrototype model + databaseDetailsPrototypeModel := new(watsonxdatav3.DatabaseDetailsPrototype) + Expect(databaseDetailsPrototypeModel).ToNot(BeNil()) + databaseDetailsPrototypeModel.AuthenticationType = core.StringPtr("LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword") + databaseDetailsPrototypeModel.AuthenticationValue = core.StringPtr("LDAP") + databaseDetailsPrototypeModel.AuthenticationValueKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.BrokerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.BrokerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.BrokerHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.BrokerPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.Certificate = core.StringPtr("exampleCertificate") + databaseDetailsPrototypeModel.CertificateExtension = core.StringPtr("pem") + databaseDetailsPrototypeModel.ConnectionMethod = core.StringPtr("basic, apikey") + databaseDetailsPrototypeModel.ConnectionMode = core.StringPtr("service_name") + databaseDetailsPrototypeModel.ConnectionModeValue = core.StringPtr("orclpdb") + databaseDetailsPrototypeModel.ConnectionType = core.StringPtr("JDBC, Arrow flight") + databaseDetailsPrototypeModel.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ControllerAuthenticationType = core.StringPtr("PASSWORD") + databaseDetailsPrototypeModel.ControllerAuthenticationUser = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.CoordinatorHost = core.StringPtr("samplehost") + databaseDetailsPrototypeModel.CoordinatorPort = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.CpdHostname = core.StringPtr("samplecpdhostname") + databaseDetailsPrototypeModel.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") + databaseDetailsPrototypeModel.DomainName = core.StringPtr("conops-mssql.conops.local") + databaseDetailsPrototypeModel.Hostname = core.StringPtr("http://db2@localhost:9900.com") + databaseDetailsPrototypeModel.HostnameInCertificate = core.StringPtr("samplehostname") + databaseDetailsPrototypeModel.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") + databaseDetailsPrototypeModel.InformixServer = core.StringPtr("ol_informix1410") + databaseDetailsPrototypeModel.Name = core.StringPtr("new_database") + databaseDetailsPrototypeModel.Password = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.PasswordKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Port = core.Int64Ptr(int64(4553)) + databaseDetailsPrototypeModel.ProjectID = core.StringPtr("conops-bigquery") + databaseDetailsPrototypeModel.Sasl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SaslMechanism = core.StringPtr("plain") + databaseDetailsPrototypeModel.SchemaName = core.StringPtr("sampleSchema") + databaseDetailsPrototypeModel.Schemas = core.StringPtr("redis__name") + databaseDetailsPrototypeModel.ServiceApiKey = core.StringPtr("sampleapikey") + databaseDetailsPrototypeModel.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") + databaseDetailsPrototypeModel.ServicePassword = core.StringPtr("samplepassword") + databaseDetailsPrototypeModel.ServicePort = core.Int64Ptr(int64(443)) + databaseDetailsPrototypeModel.ServiceSsl = core.BoolPtr(true) + databaseDetailsPrototypeModel.ServiceTokenURL = core.StringPtr("sampletoakenurl") + databaseDetailsPrototypeModel.ServiceUsername = core.StringPtr("sampleusername") + databaseDetailsPrototypeModel.Ssl = core.BoolPtr(true) + databaseDetailsPrototypeModel.SslcertificateKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.Tables = core.StringPtr("kafka_table_name, redis_table_name") + databaseDetailsPrototypeModel.Username = core.StringPtr("sampleuser") + databaseDetailsPrototypeModel.UsernameKeyVault = secretDetailsModel + databaseDetailsPrototypeModel.ValidateServerCertificate = core.BoolPtr(true) + databaseDetailsPrototypeModel.VaultEnabled = core.BoolPtr(true) + databaseDetailsPrototypeModel.VerifyHostName = core.BoolPtr(true) + databaseDetailsPrototypeModel.WarehouseName = core.StringPtr("samplewrehouse") + Expect(databaseDetailsPrototypeModel.AuthenticationType).To(Equal(core.StringPtr("LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword"))) + Expect(databaseDetailsPrototypeModel.AuthenticationValue).To(Equal(core.StringPtr("LDAP"))) + Expect(databaseDetailsPrototypeModel.AuthenticationValueKeyVault).To(Equal(secretDetailsModel)) + Expect(databaseDetailsPrototypeModel.BrokerAuthenticationPassword).To(Equal(core.StringPtr("samplepassword"))) + Expect(databaseDetailsPrototypeModel.BrokerAuthenticationType).To(Equal(core.StringPtr("PASSWORD"))) + Expect(databaseDetailsPrototypeModel.BrokerAuthenticationUser).To(Equal(core.StringPtr("sampleuser"))) + Expect(databaseDetailsPrototypeModel.BrokerHost).To(Equal(core.StringPtr("samplehost"))) + Expect(databaseDetailsPrototypeModel.BrokerPort).To(Equal(core.Int64Ptr(int64(4553)))) + Expect(databaseDetailsPrototypeModel.Certificate).To(Equal(core.StringPtr("exampleCertificate"))) + Expect(databaseDetailsPrototypeModel.CertificateExtension).To(Equal(core.StringPtr("pem"))) + Expect(databaseDetailsPrototypeModel.ConnectionMethod).To(Equal(core.StringPtr("basic, apikey"))) + Expect(databaseDetailsPrototypeModel.ConnectionMode).To(Equal(core.StringPtr("service_name"))) + Expect(databaseDetailsPrototypeModel.ConnectionModeValue).To(Equal(core.StringPtr("orclpdb"))) + Expect(databaseDetailsPrototypeModel.ConnectionType).To(Equal(core.StringPtr("JDBC, Arrow flight"))) + Expect(databaseDetailsPrototypeModel.ControllerAuthenticationPassword).To(Equal(core.StringPtr("samplepassword"))) + Expect(databaseDetailsPrototypeModel.ControllerAuthenticationType).To(Equal(core.StringPtr("PASSWORD"))) + Expect(databaseDetailsPrototypeModel.ControllerAuthenticationUser).To(Equal(core.StringPtr("sampleuser"))) + Expect(databaseDetailsPrototypeModel.CoordinatorHost).To(Equal(core.StringPtr("samplehost"))) + Expect(databaseDetailsPrototypeModel.CoordinatorPort).To(Equal(core.Int64Ptr(int64(4553)))) + Expect(databaseDetailsPrototypeModel.CpdHostname).To(Equal(core.StringPtr("samplecpdhostname"))) + Expect(databaseDetailsPrototypeModel.CredentialsKey).To(Equal(core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......"))) + Expect(databaseDetailsPrototypeModel.DomainName).To(Equal(core.StringPtr("conops-mssql.conops.local"))) + Expect(databaseDetailsPrototypeModel.Hostname).To(Equal(core.StringPtr("http://db2@localhost:9900.com"))) + Expect(databaseDetailsPrototypeModel.HostnameInCertificate).To(Equal(core.StringPtr("samplehostname"))) + Expect(databaseDetailsPrototypeModel.Hosts).To(Equal(core.StringPtr("abc.com:1234,xyz.com:4321"))) + Expect(databaseDetailsPrototypeModel.InformixServer).To(Equal(core.StringPtr("ol_informix1410"))) + Expect(databaseDetailsPrototypeModel.Name).To(Equal(core.StringPtr("new_database"))) + Expect(databaseDetailsPrototypeModel.Password).To(Equal(core.StringPtr("samplepassword"))) + Expect(databaseDetailsPrototypeModel.PasswordKeyVault).To(Equal(secretDetailsModel)) + Expect(databaseDetailsPrototypeModel.Port).To(Equal(core.Int64Ptr(int64(4553)))) + Expect(databaseDetailsPrototypeModel.ProjectID).To(Equal(core.StringPtr("conops-bigquery"))) + Expect(databaseDetailsPrototypeModel.Sasl).To(Equal(core.BoolPtr(true))) + Expect(databaseDetailsPrototypeModel.SaslMechanism).To(Equal(core.StringPtr("plain"))) + Expect(databaseDetailsPrototypeModel.SchemaName).To(Equal(core.StringPtr("sampleSchema"))) + Expect(databaseDetailsPrototypeModel.Schemas).To(Equal(core.StringPtr("redis__name"))) + Expect(databaseDetailsPrototypeModel.ServiceApiKey).To(Equal(core.StringPtr("sampleapikey"))) + Expect(databaseDetailsPrototypeModel.ServiceHostname).To(Equal(core.StringPtr("api.dataplatform.dev.cloud.ibm.com"))) + Expect(databaseDetailsPrototypeModel.ServicePassword).To(Equal(core.StringPtr("samplepassword"))) + Expect(databaseDetailsPrototypeModel.ServicePort).To(Equal(core.Int64Ptr(int64(443)))) + Expect(databaseDetailsPrototypeModel.ServiceSsl).To(Equal(core.BoolPtr(true))) + Expect(databaseDetailsPrototypeModel.ServiceTokenURL).To(Equal(core.StringPtr("sampletoakenurl"))) + Expect(databaseDetailsPrototypeModel.ServiceUsername).To(Equal(core.StringPtr("sampleusername"))) + Expect(databaseDetailsPrototypeModel.Ssl).To(Equal(core.BoolPtr(true))) + Expect(databaseDetailsPrototypeModel.SslcertificateKeyVault).To(Equal(secretDetailsModel)) + Expect(databaseDetailsPrototypeModel.Tables).To(Equal(core.StringPtr("kafka_table_name, redis_table_name"))) + Expect(databaseDetailsPrototypeModel.Username).To(Equal(core.StringPtr("sampleuser"))) + Expect(databaseDetailsPrototypeModel.UsernameKeyVault).To(Equal(secretDetailsModel)) + Expect(databaseDetailsPrototypeModel.ValidateServerCertificate).To(Equal(core.BoolPtr(true))) + Expect(databaseDetailsPrototypeModel.VaultEnabled).To(Equal(core.BoolPtr(true))) + Expect(databaseDetailsPrototypeModel.VerifyHostName).To(Equal(core.BoolPtr(true))) + Expect(databaseDetailsPrototypeModel.WarehouseName).To(Equal(core.StringPtr("samplewrehouse"))) // Construct an instance of the DatabaseRegistrationPrototypeDatabasePropertiesItems model - databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems) + databaseRegistrationPrototypeDatabasePropertiesItemsModel := new(watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems) Expect(databaseRegistrationPrototypeDatabasePropertiesItemsModel).ToNot(BeNil()) databaseRegistrationPrototypeDatabasePropertiesItemsModel.Encrypt = core.BoolPtr(true) databaseRegistrationPrototypeDatabasePropertiesItemsModel.Key = core.StringPtr("abc") @@ -36005,102 +38632,71 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(databaseRegistrationPrototypeDatabasePropertiesItemsModel.Value).To(Equal(core.StringPtr("xyz"))) // Construct an instance of the CreateDatabaseRegistrationOptions model - createDatabaseRegistrationOptionsDatabaseDisplayName := "new_database" - createDatabaseRegistrationOptionsDatabaseType := "db2" - createDatabaseRegistrationOptionsModel := watsonxDataService.NewCreateDatabaseRegistrationOptions(createDatabaseRegistrationOptionsDatabaseDisplayName, createDatabaseRegistrationOptionsDatabaseType) - createDatabaseRegistrationOptionsModel.SetDatabaseDisplayName("new_database") - createDatabaseRegistrationOptionsModel.SetDatabaseType("db2") - createDatabaseRegistrationOptionsModel.SetAssociatedCatalog(databaseCatalogModel) - createDatabaseRegistrationOptionsModel.SetCreatedOn("1686792721") - createDatabaseRegistrationOptionsModel.SetDatabaseDetails(databaseDetailsModel) - createDatabaseRegistrationOptionsModel.SetDatabaseProperties([]watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel}) + createDatabaseRegistrationOptionsDisplayName := "new_database" + createDatabaseRegistrationOptionsType := "db2" + createDatabaseRegistrationOptionsModel := watsonxDataService.NewCreateDatabaseRegistrationOptions(createDatabaseRegistrationOptionsDisplayName, createDatabaseRegistrationOptionsType) + createDatabaseRegistrationOptionsModel.SetDisplayName("new_database") + createDatabaseRegistrationOptionsModel.SetType("db2") + createDatabaseRegistrationOptionsModel.SetAssociatedCatalog(databaseCatalogPrototypeModel) + createDatabaseRegistrationOptionsModel.SetConnection(databaseDetailsPrototypeModel) + createDatabaseRegistrationOptionsModel.SetCreatedAt("1686792721") createDatabaseRegistrationOptionsModel.SetDescription("db2 extenal database description") + createDatabaseRegistrationOptionsModel.SetProperties([]watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel}) + createDatabaseRegistrationOptionsModel.SetSourceAssetID("cc85d899-9ec3-496a-be36-99cabc62f123") + createDatabaseRegistrationOptionsModel.SetSourceCatalogID("cc85d899-9ec3-496a-be36-99cff962f000") + createDatabaseRegistrationOptionsModel.SetSourceProjectID("cc85d899-9ec3-496a-be36-99cff9000116") createDatabaseRegistrationOptionsModel.SetTags([]string{"testdatabase", "userdatabase"}) + createDatabaseRegistrationOptionsModel.SetTargetCatalogID("cc85d899-9ec3-496a-be36-99cff9000116") createDatabaseRegistrationOptionsModel.SetAuthInstanceID("testString") createDatabaseRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createDatabaseRegistrationOptionsModel).ToNot(BeNil()) - Expect(createDatabaseRegistrationOptionsModel.DatabaseDisplayName).To(Equal(core.StringPtr("new_database"))) - Expect(createDatabaseRegistrationOptionsModel.DatabaseType).To(Equal(core.StringPtr("db2"))) - Expect(createDatabaseRegistrationOptionsModel.AssociatedCatalog).To(Equal(databaseCatalogModel)) - Expect(createDatabaseRegistrationOptionsModel.CreatedOn).To(Equal(core.StringPtr("1686792721"))) - Expect(createDatabaseRegistrationOptionsModel.DatabaseDetails).To(Equal(databaseDetailsModel)) - Expect(createDatabaseRegistrationOptionsModel.DatabaseProperties).To(Equal([]watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel})) + Expect(createDatabaseRegistrationOptionsModel.DisplayName).To(Equal(core.StringPtr("new_database"))) + Expect(createDatabaseRegistrationOptionsModel.Type).To(Equal(core.StringPtr("db2"))) + Expect(createDatabaseRegistrationOptionsModel.AssociatedCatalog).To(Equal(databaseCatalogPrototypeModel)) + Expect(createDatabaseRegistrationOptionsModel.Connection).To(Equal(databaseDetailsPrototypeModel)) + Expect(createDatabaseRegistrationOptionsModel.CreatedAt).To(Equal(core.StringPtr("1686792721"))) Expect(createDatabaseRegistrationOptionsModel.Description).To(Equal(core.StringPtr("db2 extenal database description"))) + Expect(createDatabaseRegistrationOptionsModel.Properties).To(Equal([]watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems{*databaseRegistrationPrototypeDatabasePropertiesItemsModel})) + Expect(createDatabaseRegistrationOptionsModel.SourceAssetID).To(Equal(core.StringPtr("cc85d899-9ec3-496a-be36-99cabc62f123"))) + Expect(createDatabaseRegistrationOptionsModel.SourceCatalogID).To(Equal(core.StringPtr("cc85d899-9ec3-496a-be36-99cff962f000"))) + Expect(createDatabaseRegistrationOptionsModel.SourceProjectID).To(Equal(core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116"))) Expect(createDatabaseRegistrationOptionsModel.Tags).To(Equal([]string{"testdatabase", "userdatabase"})) + Expect(createDatabaseRegistrationOptionsModel.TargetCatalogID).To(Equal(core.StringPtr("cc85d899-9ec3-496a-be36-99cff9000116"))) Expect(createDatabaseRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createDatabaseRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateDb2EngineOptions successfully`, func() { // Construct an instance of the Db2EngineDetailsBody model - db2EngineDetailsBodyModel := new(watsonxdatav2.Db2EngineDetailsBody) + db2EngineDetailsBodyModel := new(watsonxdatav3.Db2EngineDetailsBody) Expect(db2EngineDetailsBodyModel).ToNot(BeNil()) db2EngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") Expect(db2EngineDetailsBodyModel.ConnectionString).To(Equal(core.StringPtr("1.2.3.4"))) // Construct an instance of the CreateDb2EngineOptions model + var createDb2EngineOptionsConfiguration *watsonxdatav3.Db2EngineDetailsBody = nil + createDb2EngineOptionsDisplayName := "sampleEngine" createDb2EngineOptionsOrigin := "external" - createDb2EngineOptionsModel := watsonxDataService.NewCreateDb2EngineOptions(createDb2EngineOptionsOrigin) + createDb2EngineOptionsModel := watsonxDataService.NewCreateDb2EngineOptions(createDb2EngineOptionsConfiguration, createDb2EngineOptionsDisplayName, createDb2EngineOptionsOrigin) + createDb2EngineOptionsModel.SetConfiguration(db2EngineDetailsBodyModel) + createDb2EngineOptionsModel.SetDisplayName("sampleEngine") createDb2EngineOptionsModel.SetOrigin("external") createDb2EngineOptionsModel.SetDescription("db2 engine description") - createDb2EngineOptionsModel.SetEngineDetails(db2EngineDetailsBodyModel) - createDb2EngineOptionsModel.SetEngineDisplayName("sampleEngine") createDb2EngineOptionsModel.SetTags([]string{"tag1", "tag2"}) createDb2EngineOptionsModel.SetAuthInstanceID("testString") createDb2EngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createDb2EngineOptionsModel).ToNot(BeNil()) + Expect(createDb2EngineOptionsModel.Configuration).To(Equal(db2EngineDetailsBodyModel)) + Expect(createDb2EngineOptionsModel.DisplayName).To(Equal(core.StringPtr("sampleEngine"))) Expect(createDb2EngineOptionsModel.Origin).To(Equal(core.StringPtr("external"))) Expect(createDb2EngineOptionsModel.Description).To(Equal(core.StringPtr("db2 engine description"))) - Expect(createDb2EngineOptionsModel.EngineDetails).To(Equal(db2EngineDetailsBodyModel)) - Expect(createDb2EngineOptionsModel.EngineDisplayName).To(Equal(core.StringPtr("sampleEngine"))) Expect(createDb2EngineOptionsModel.Tags).To(Equal([]string{"tag1", "tag2"})) Expect(createDb2EngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createDb2EngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewCreateDriverRegistrationOptions successfully`, func() { - // Construct an instance of the CreateDriverRegistrationOptions model - driver := CreateMockReader("This is a mock file.") - driverName := "testString" - connectionType := "testString" - createDriverRegistrationOptionsModel := watsonxDataService.NewCreateDriverRegistrationOptions(driver, driverName, connectionType) - createDriverRegistrationOptionsModel.SetDriver(CreateMockReader("This is a mock file.")) - createDriverRegistrationOptionsModel.SetDriverName("testString") - createDriverRegistrationOptionsModel.SetConnectionType("testString") - createDriverRegistrationOptionsModel.SetDriverContentType("testString") - createDriverRegistrationOptionsModel.SetVersion("testString") - createDriverRegistrationOptionsModel.SetAuthInstanceID("testString") - createDriverRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createDriverRegistrationOptionsModel).ToNot(BeNil()) - Expect(createDriverRegistrationOptionsModel.Driver).To(Equal(CreateMockReader("This is a mock file."))) - Expect(createDriverRegistrationOptionsModel.DriverName).To(Equal(core.StringPtr("testString"))) - Expect(createDriverRegistrationOptionsModel.ConnectionType).To(Equal(core.StringPtr("testString"))) - Expect(createDriverRegistrationOptionsModel.DriverContentType).To(Equal(core.StringPtr("testString"))) - Expect(createDriverRegistrationOptionsModel.Version).To(Equal(core.StringPtr("testString"))) - Expect(createDriverRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createDriverRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateExecuteQueryOptions successfully`, func() { - // Construct an instance of the CreateExecuteQueryOptions model - engineID := "testString" - createExecuteQueryOptionsSqlString := "select expenses from expenditure" - createExecuteQueryOptionsModel := watsonxDataService.NewCreateExecuteQueryOptions(engineID, createExecuteQueryOptionsSqlString) - createExecuteQueryOptionsModel.SetEngineID("testString") - createExecuteQueryOptionsModel.SetSqlString("select expenses from expenditure") - createExecuteQueryOptionsModel.SetCatalogName("sampleCatalog") - createExecuteQueryOptionsModel.SetSchemaName("SampleSchema1") - createExecuteQueryOptionsModel.SetAuthInstanceID("testString") - createExecuteQueryOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createExecuteQueryOptionsModel).ToNot(BeNil()) - Expect(createExecuteQueryOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(createExecuteQueryOptionsModel.SqlString).To(Equal(core.StringPtr("select expenses from expenditure"))) - Expect(createExecuteQueryOptionsModel.CatalogName).To(Equal(core.StringPtr("sampleCatalog"))) - Expect(createExecuteQueryOptionsModel.SchemaName).To(Equal(core.StringPtr("SampleSchema1"))) - Expect(createExecuteQueryOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createExecuteQueryOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewCreateHdfsStorageOptions successfully`, func() { // Construct an instance of the CreateHdfsStorageOptions model - bucketDisplayName := "testString" - bucketType := "testString" + displayName := "testString" + typeVar := "testString" hmsThriftURI := "testString" hmsThriftPort := int64(1) coreSite := "testString" @@ -36108,9 +38704,9 @@ var _ = Describe(`WatsonxDataV2`, func() { kerberos := "testString" catalogName := "testString" catalogType := "testString" - createHdfsStorageOptionsModel := watsonxDataService.NewCreateHdfsStorageOptions(bucketDisplayName, bucketType, hmsThriftURI, hmsThriftPort, coreSite, hdfsSite, kerberos, catalogName, catalogType) - createHdfsStorageOptionsModel.SetBucketDisplayName("testString") - createHdfsStorageOptionsModel.SetBucketType("testString") + createHdfsStorageOptionsModel := watsonxDataService.NewCreateHdfsStorageOptions(displayName, typeVar, hmsThriftURI, hmsThriftPort, coreSite, hdfsSite, kerberos, catalogName, catalogType) + createHdfsStorageOptionsModel.SetDisplayName("testString") + createHdfsStorageOptionsModel.SetType("testString") createHdfsStorageOptionsModel.SetHmsThriftURI("testString") createHdfsStorageOptionsModel.SetHmsThriftPort(int64(1)) createHdfsStorageOptionsModel.SetCoreSite("testString") @@ -36127,12 +38723,12 @@ var _ = Describe(`WatsonxDataV2`, func() { createHdfsStorageOptionsModel.SetHiveClientPrincipal("testString") createHdfsStorageOptionsModel.SetHdfsPrincipal("testString") createHdfsStorageOptionsModel.SetDescription("testString") - createHdfsStorageOptionsModel.SetCreatedOn("testString") + createHdfsStorageOptionsModel.SetCreatedAt("testString") createHdfsStorageOptionsModel.SetAuthInstanceID("testString") createHdfsStorageOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createHdfsStorageOptionsModel).ToNot(BeNil()) - Expect(createHdfsStorageOptionsModel.BucketDisplayName).To(Equal(core.StringPtr("testString"))) - Expect(createHdfsStorageOptionsModel.BucketType).To(Equal(core.StringPtr("testString"))) + Expect(createHdfsStorageOptionsModel.DisplayName).To(Equal(core.StringPtr("testString"))) + Expect(createHdfsStorageOptionsModel.Type).To(Equal(core.StringPtr("testString"))) Expect(createHdfsStorageOptionsModel.HmsThriftURI).To(Equal(core.StringPtr("testString"))) Expect(createHdfsStorageOptionsModel.HmsThriftPort).To(Equal(core.Int64Ptr(int64(1)))) Expect(createHdfsStorageOptionsModel.CoreSite).To(Equal(core.StringPtr("testString"))) @@ -36149,603 +38745,695 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(createHdfsStorageOptionsModel.HiveClientPrincipal).To(Equal(core.StringPtr("testString"))) Expect(createHdfsStorageOptionsModel.HdfsPrincipal).To(Equal(core.StringPtr("testString"))) Expect(createHdfsStorageOptionsModel.Description).To(Equal(core.StringPtr("testString"))) - Expect(createHdfsStorageOptionsModel.CreatedOn).To(Equal(core.StringPtr("testString"))) + Expect(createHdfsStorageOptionsModel.CreatedAt).To(Equal(core.StringPtr("testString"))) Expect(createHdfsStorageOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createHdfsStorageOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewCreateIngestionJobsLocalFilesOptions successfully`, func() { - // Construct an instance of the CreateIngestionJobsLocalFilesOptions model - authInstanceID := "testString" - sourceDataFile := CreateMockReader("This is a mock file.") - targetTable := "testString" - jobID := "testString" - username := "testString" - createIngestionJobsLocalFilesOptionsModel := watsonxDataService.NewCreateIngestionJobsLocalFilesOptions(authInstanceID, sourceDataFile, targetTable, jobID, username) - createIngestionJobsLocalFilesOptionsModel.SetAuthInstanceID("testString") - createIngestionJobsLocalFilesOptionsModel.SetSourceDataFile(CreateMockReader("This is a mock file.")) - createIngestionJobsLocalFilesOptionsModel.SetTargetTable("testString") - createIngestionJobsLocalFilesOptionsModel.SetJobID("testString") - createIngestionJobsLocalFilesOptionsModel.SetUsername("testString") - createIngestionJobsLocalFilesOptionsModel.SetSourceDataFileContentType("testString") - createIngestionJobsLocalFilesOptionsModel.SetSourceFileType("csv") - createIngestionJobsLocalFilesOptionsModel.SetCsvProperty("testString") - createIngestionJobsLocalFilesOptionsModel.SetCreateIfNotExist(false) - createIngestionJobsLocalFilesOptionsModel.SetValidateCsvHeader(false) - createIngestionJobsLocalFilesOptionsModel.SetExecuteConfig("testString") - createIngestionJobsLocalFilesOptionsModel.SetEngineID("testString") - createIngestionJobsLocalFilesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createIngestionJobsLocalFilesOptionsModel).ToNot(BeNil()) - Expect(createIngestionJobsLocalFilesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createIngestionJobsLocalFilesOptionsModel.SourceDataFile).To(Equal(CreateMockReader("This is a mock file."))) - Expect(createIngestionJobsLocalFilesOptionsModel.TargetTable).To(Equal(core.StringPtr("testString"))) - Expect(createIngestionJobsLocalFilesOptionsModel.JobID).To(Equal(core.StringPtr("testString"))) - Expect(createIngestionJobsLocalFilesOptionsModel.Username).To(Equal(core.StringPtr("testString"))) - Expect(createIngestionJobsLocalFilesOptionsModel.SourceDataFileContentType).To(Equal(core.StringPtr("testString"))) - Expect(createIngestionJobsLocalFilesOptionsModel.SourceFileType).To(Equal(core.StringPtr("csv"))) - Expect(createIngestionJobsLocalFilesOptionsModel.CsvProperty).To(Equal(core.StringPtr("testString"))) - Expect(createIngestionJobsLocalFilesOptionsModel.CreateIfNotExist).To(Equal(core.BoolPtr(false))) - Expect(createIngestionJobsLocalFilesOptionsModel.ValidateCsvHeader).To(Equal(core.BoolPtr(false))) - Expect(createIngestionJobsLocalFilesOptionsModel.ExecuteConfig).To(Equal(core.StringPtr("testString"))) - Expect(createIngestionJobsLocalFilesOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(createIngestionJobsLocalFilesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateIngestionJobsOptions successfully`, func() { - // Construct an instance of the IngestionJobPrototypeCsvProperty model - ingestionJobPrototypeCsvPropertyModel := new(watsonxdatav2.IngestionJobPrototypeCsvProperty) - Expect(ingestionJobPrototypeCsvPropertyModel).ToNot(BeNil()) - ingestionJobPrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - ingestionJobPrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - ingestionJobPrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - ingestionJobPrototypeCsvPropertyModel.Header = core.BoolPtr(true) - ingestionJobPrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") - Expect(ingestionJobPrototypeCsvPropertyModel.Encoding).To(Equal(core.StringPtr("utf-8"))) - Expect(ingestionJobPrototypeCsvPropertyModel.EscapeCharacter).To(Equal(core.StringPtr("\\\\"))) - Expect(ingestionJobPrototypeCsvPropertyModel.FieldDelimiter).To(Equal(core.StringPtr(","))) - Expect(ingestionJobPrototypeCsvPropertyModel.Header).To(Equal(core.BoolPtr(true))) - Expect(ingestionJobPrototypeCsvPropertyModel.LineDelimiter).To(Equal(core.StringPtr("\\n"))) - - // Construct an instance of the IngestionJobPrototypeExecuteConfig model - ingestionJobPrototypeExecuteConfigModel := new(watsonxdatav2.IngestionJobPrototypeExecuteConfig) - Expect(ingestionJobPrototypeExecuteConfigModel).ToNot(BeNil()) - ingestionJobPrototypeExecuteConfigModel.DriverCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.DriverMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) - ingestionJobPrototypeExecuteConfigModel.ExecutorMemory = core.StringPtr("2G") - ingestionJobPrototypeExecuteConfigModel.NumExecutors = core.Int64Ptr(int64(1)) - Expect(ingestionJobPrototypeExecuteConfigModel.DriverCores).To(Equal(core.Int64Ptr(int64(1)))) - Expect(ingestionJobPrototypeExecuteConfigModel.DriverMemory).To(Equal(core.StringPtr("2G"))) - Expect(ingestionJobPrototypeExecuteConfigModel.ExecutorCores).To(Equal(core.Int64Ptr(int64(1)))) - Expect(ingestionJobPrototypeExecuteConfigModel.ExecutorMemory).To(Equal(core.StringPtr("2G"))) - Expect(ingestionJobPrototypeExecuteConfigModel.NumExecutors).To(Equal(core.Int64Ptr(int64(1)))) - - // Construct an instance of the CreateIngestionJobsOptions model + It(`Invoke NewCreateIngestionJobOptions successfully`, func() { + // Construct an instance of the SchemaTransformation model + schemaTransformationModel := new(watsonxdatav3.SchemaTransformation) + Expect(schemaTransformationModel).ToNot(BeNil()) + schemaTransformationModel.OldColumn = core.StringPtr("old_column_name") + schemaTransformationModel.NewColumn = core.StringPtr("new_column_name") + schemaTransformationModel.NewType = core.StringPtr("string") + Expect(schemaTransformationModel.OldColumn).To(Equal(core.StringPtr("old_column_name"))) + Expect(schemaTransformationModel.NewColumn).To(Equal(core.StringPtr("new_column_name"))) + Expect(schemaTransformationModel.NewType).To(Equal(core.StringPtr("string"))) + + // Construct an instance of the BucketDetails model + bucketDetailsModel := new(watsonxdatav3.BucketDetails) + Expect(bucketDetailsModel).ToNot(BeNil()) + bucketDetailsModel.AccessKey = core.StringPtr("testString") + bucketDetailsModel.AccountName = core.StringPtr("testString") + bucketDetailsModel.ApplicationID = core.StringPtr("testString") + bucketDetailsModel.ContainerName = core.StringPtr("testString") + bucketDetailsModel.DirectoryID = core.StringPtr("testString") + bucketDetailsModel.Endpoint = core.StringPtr("testString") + bucketDetailsModel.Region = core.StringPtr("testString") + bucketDetailsModel.SecretKey = core.StringPtr("testString") + bucketDetailsModel.AuthMode = core.StringPtr("aws_assume_role") + bucketDetailsModel.RoleArn = core.StringPtr("testString") + bucketDetailsModel.ManagedBy = core.StringPtr("testString") + bucketDetailsModel.Name = core.StringPtr("testString") + bucketDetailsModel.Type = core.StringPtr("adls_gen1") + Expect(bucketDetailsModel.AccessKey).To(Equal(core.StringPtr("testString"))) + Expect(bucketDetailsModel.AccountName).To(Equal(core.StringPtr("testString"))) + Expect(bucketDetailsModel.ApplicationID).To(Equal(core.StringPtr("testString"))) + Expect(bucketDetailsModel.ContainerName).To(Equal(core.StringPtr("testString"))) + Expect(bucketDetailsModel.DirectoryID).To(Equal(core.StringPtr("testString"))) + Expect(bucketDetailsModel.Endpoint).To(Equal(core.StringPtr("testString"))) + Expect(bucketDetailsModel.Region).To(Equal(core.StringPtr("testString"))) + Expect(bucketDetailsModel.SecretKey).To(Equal(core.StringPtr("testString"))) + Expect(bucketDetailsModel.AuthMode).To(Equal(core.StringPtr("aws_assume_role"))) + Expect(bucketDetailsModel.RoleArn).To(Equal(core.StringPtr("testString"))) + Expect(bucketDetailsModel.ManagedBy).To(Equal(core.StringPtr("testString"))) + Expect(bucketDetailsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(bucketDetailsModel.Type).To(Equal(core.StringPtr("adls_gen1"))) + + // Construct an instance of the IcebergSourceTable model + icebergSourceTableModel := new(watsonxdatav3.IcebergSourceTable) + Expect(icebergSourceTableModel).ToNot(BeNil()) + icebergSourceTableModel.SchemaName = core.StringPtr("testString") + icebergSourceTableModel.TableName = core.StringPtr("testString") + icebergSourceTableModel.CatalogName = core.StringPtr("testString") + icebergSourceTableModel.WarehouseName = core.StringPtr("testString") + icebergSourceTableModel.SnapshotID = core.Int64Ptr(int64(0)) + Expect(icebergSourceTableModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(icebergSourceTableModel.TableName).To(Equal(core.StringPtr("testString"))) + Expect(icebergSourceTableModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(icebergSourceTableModel.WarehouseName).To(Equal(core.StringPtr("testString"))) + Expect(icebergSourceTableModel.SnapshotID).To(Equal(core.Int64Ptr(int64(0)))) + + // Construct an instance of the DbConnectionModel model + dbConnectionModelModel := new(watsonxdatav3.DbConnectionModel) + Expect(dbConnectionModelModel).ToNot(BeNil()) + dbConnectionModelModel.DatabaseID = core.StringPtr("testString") + dbConnectionModelModel.DbType = core.StringPtr("testString") + dbConnectionModelModel.Host = core.StringPtr("testString") + dbConnectionModelModel.Port = core.StringPtr("testString") + dbConnectionModelModel.DbName = core.StringPtr("testString") + dbConnectionModelModel.DbUsername = core.StringPtr("testString") + dbConnectionModelModel.Password = core.StringPtr("testString") + dbConnectionModelModel.AuthenticationValue = core.StringPtr("testString") + dbConnectionModelModel.IsSsl = core.BoolPtr(false) + dbConnectionModelModel.CertExtension = core.StringPtr("testString") + dbConnectionModelModel.CertContent = core.StringPtr("testString") + dbConnectionModelModel.ConnectionMode = core.StringPtr("testString") + dbConnectionModelModel.ConnectionModeValue = core.StringPtr("testString") + dbConnectionModelModel.JdbcURL = core.StringPtr("testString") + Expect(dbConnectionModelModel.DatabaseID).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.DbType).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.Host).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.Port).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.DbName).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.DbUsername).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.Password).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.AuthenticationValue).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.IsSsl).To(Equal(core.BoolPtr(false))) + Expect(dbConnectionModelModel.CertExtension).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.CertContent).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.ConnectionMode).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.ConnectionModeValue).To(Equal(core.StringPtr("testString"))) + Expect(dbConnectionModelModel.JdbcURL).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the FileFormatProperties model + fileFormatPropertiesModel := new(watsonxdatav3.FileFormatProperties) + Expect(fileFormatPropertiesModel).ToNot(BeNil()) + fileFormatPropertiesModel.Encoding = core.StringPtr("testString") + fileFormatPropertiesModel.EscapeCharacter = core.StringPtr("testString") + fileFormatPropertiesModel.FieldDelimiter = core.StringPtr("testString") + fileFormatPropertiesModel.Header = core.BoolPtr(true) + fileFormatPropertiesModel.LineDelimiter = core.StringPtr("testString") + Expect(fileFormatPropertiesModel.Encoding).To(Equal(core.StringPtr("testString"))) + Expect(fileFormatPropertiesModel.EscapeCharacter).To(Equal(core.StringPtr("testString"))) + Expect(fileFormatPropertiesModel.FieldDelimiter).To(Equal(core.StringPtr("testString"))) + Expect(fileFormatPropertiesModel.Header).To(Equal(core.BoolPtr(true))) + Expect(fileFormatPropertiesModel.LineDelimiter).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the SourceDetails model + sourceDetailsModel := new(watsonxdatav3.SourceDetails) + Expect(sourceDetailsModel).ToNot(BeNil()) + sourceDetailsModel.FilePaths = core.StringPtr("testString") + sourceDetailsModel.FileType = core.StringPtr("csv") + sourceDetailsModel.SourceType = core.StringPtr("STORAGE") + sourceDetailsModel.SchemaTransformations = []watsonxdatav3.SchemaTransformation{*schemaTransformationModel} + sourceDetailsModel.SchemaName = core.StringPtr("testString") + sourceDetailsModel.TableName = core.StringPtr("testString") + sourceDetailsModel.BucketDetails = bucketDetailsModel + sourceDetailsModel.IcebergSourceTable = icebergSourceTableModel + sourceDetailsModel.SourceDatabase = dbConnectionModelModel + sourceDetailsModel.FileFormatProperties = fileFormatPropertiesModel + sourceDetailsModel.IsLocalIngestion = core.BoolPtr(false) + Expect(sourceDetailsModel.FilePaths).To(Equal(core.StringPtr("testString"))) + Expect(sourceDetailsModel.FileType).To(Equal(core.StringPtr("csv"))) + Expect(sourceDetailsModel.SourceType).To(Equal(core.StringPtr("STORAGE"))) + Expect(sourceDetailsModel.SchemaTransformations).To(Equal([]watsonxdatav3.SchemaTransformation{*schemaTransformationModel})) + Expect(sourceDetailsModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(sourceDetailsModel.TableName).To(Equal(core.StringPtr("testString"))) + Expect(sourceDetailsModel.BucketDetails).To(Equal(bucketDetailsModel)) + Expect(sourceDetailsModel.IcebergSourceTable).To(Equal(icebergSourceTableModel)) + Expect(sourceDetailsModel.SourceDatabase).To(Equal(dbConnectionModelModel)) + Expect(sourceDetailsModel.FileFormatProperties).To(Equal(fileFormatPropertiesModel)) + Expect(sourceDetailsModel.IsLocalIngestion).To(Equal(core.BoolPtr(false))) + + // Construct an instance of the TargetDetails model + targetDetailsModel := new(watsonxdatav3.TargetDetails) + Expect(targetDetailsModel).ToNot(BeNil()) + targetDetailsModel.Catalog = core.StringPtr("testString") + targetDetailsModel.Schema = core.StringPtr("testString") + targetDetailsModel.Table = core.StringPtr("testString") + targetDetailsModel.WriteMode = core.StringPtr("testString") + targetDetailsModel.MergeOnRead = core.BoolPtr(false) + targetDetailsModel.SchemaMode = core.StringPtr("testString") + targetDetailsModel.SchemaInfer = core.BoolPtr(true) + targetDetailsModel.CatalogURI = core.StringPtr("testString") + targetDetailsModel.BucketDetails = bucketDetailsModel + targetDetailsModel.Location = core.StringPtr("testString") + targetDetailsModel.IsNewSchema = core.BoolPtr(false) + targetDetailsModel.IsNewTable = core.BoolPtr(false) + Expect(targetDetailsModel.Catalog).To(Equal(core.StringPtr("testString"))) + Expect(targetDetailsModel.Schema).To(Equal(core.StringPtr("testString"))) + Expect(targetDetailsModel.Table).To(Equal(core.StringPtr("testString"))) + Expect(targetDetailsModel.WriteMode).To(Equal(core.StringPtr("testString"))) + Expect(targetDetailsModel.MergeOnRead).To(Equal(core.BoolPtr(false))) + Expect(targetDetailsModel.SchemaMode).To(Equal(core.StringPtr("testString"))) + Expect(targetDetailsModel.SchemaInfer).To(Equal(core.BoolPtr(true))) + Expect(targetDetailsModel.CatalogURI).To(Equal(core.StringPtr("testString"))) + Expect(targetDetailsModel.BucketDetails).To(Equal(bucketDetailsModel)) + Expect(targetDetailsModel.Location).To(Equal(core.StringPtr("testString"))) + Expect(targetDetailsModel.IsNewSchema).To(Equal(core.BoolPtr(false))) + Expect(targetDetailsModel.IsNewTable).To(Equal(core.BoolPtr(false))) + + // Construct an instance of the ExecuteConfig model + executeConfigModel := new(watsonxdatav3.ExecuteConfig) + Expect(executeConfigModel).ToNot(BeNil()) + executeConfigModel.DriverMemory = core.StringPtr("testString") + executeConfigModel.DriverCores = core.Int64Ptr(int64(1)) + executeConfigModel.ExecutorMemory = core.StringPtr("testString") + executeConfigModel.ExecutorCores = core.Int64Ptr(int64(1)) + executeConfigModel.NumExecutors = core.Int64Ptr(int64(1)) + Expect(executeConfigModel.DriverMemory).To(Equal(core.StringPtr("testString"))) + Expect(executeConfigModel.DriverCores).To(Equal(core.Int64Ptr(int64(1)))) + Expect(executeConfigModel.ExecutorMemory).To(Equal(core.StringPtr("testString"))) + Expect(executeConfigModel.ExecutorCores).To(Equal(core.Int64Ptr(int64(1)))) + Expect(executeConfigModel.NumExecutors).To(Equal(core.Int64Ptr(int64(1)))) + + // Construct an instance of the IngestionEngine model + ingestionEngineModel := new(watsonxdatav3.IngestionEngine) + Expect(ingestionEngineModel).ToNot(BeNil()) + ingestionEngineModel.EngineID = core.StringPtr("testString") + ingestionEngineModel.Name = core.StringPtr("testString") + ingestionEngineModel.Endpoint = core.StringPtr("testString") + ingestionEngineModel.Origin = core.StringPtr("testString") + ingestionEngineModel.ExecuteConfig = executeConfigModel + ingestionEngineModel.BucketDetails = bucketDetailsModel + ingestionEngineModel.LogPath = core.StringPtr("testString") + Expect(ingestionEngineModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(ingestionEngineModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(ingestionEngineModel.Endpoint).To(Equal(core.StringPtr("testString"))) + Expect(ingestionEngineModel.Origin).To(Equal(core.StringPtr("testString"))) + Expect(ingestionEngineModel.ExecuteConfig).To(Equal(executeConfigModel)) + Expect(ingestionEngineModel.BucketDetails).To(Equal(bucketDetailsModel)) + Expect(ingestionEngineModel.LogPath).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the CapacityDetails model + capacityDetailsModel := new(watsonxdatav3.CapacityDetails) + Expect(capacityDetailsModel).ToNot(BeNil()) + capacityDetailsModel.ID = CreateMockUUID("6f51248a-4cda-459a-b141-eb9b76bb6689") + Expect(capacityDetailsModel.ID).To(Equal(CreateMockUUID("6f51248a-4cda-459a-b141-eb9b76bb6689"))) + + // Construct an instance of the CreateIngestionJobOptions model authInstanceID := "testString" - createIngestionJobsOptionsJobID := "ingestion-1699459946935" - createIngestionJobsOptionsSourceDataFiles := "s3://demobucket/data/yellow_tripdata_2022-01.parquet" - createIngestionJobsOptionsTargetTable := "demodb.test.targettable" - createIngestionJobsOptionsUsername := "user1" - createIngestionJobsOptionsModel := watsonxDataService.NewCreateIngestionJobsOptions(authInstanceID, createIngestionJobsOptionsJobID, createIngestionJobsOptionsSourceDataFiles, createIngestionJobsOptionsTargetTable, createIngestionJobsOptionsUsername) - createIngestionJobsOptionsModel.SetAuthInstanceID("testString") - createIngestionJobsOptionsModel.SetJobID("ingestion-1699459946935") - createIngestionJobsOptionsModel.SetSourceDataFiles("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createIngestionJobsOptionsModel.SetTargetTable("demodb.test.targettable") - createIngestionJobsOptionsModel.SetUsername("user1") - createIngestionJobsOptionsModel.SetCreateIfNotExist(false) - createIngestionJobsOptionsModel.SetCsvProperty(ingestionJobPrototypeCsvPropertyModel) - createIngestionJobsOptionsModel.SetEngineID("spark123") - createIngestionJobsOptionsModel.SetExecuteConfig(ingestionJobPrototypeExecuteConfigModel) - createIngestionJobsOptionsModel.SetPartitionBy("col1, col2") - createIngestionJobsOptionsModel.SetSchema("{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}") - createIngestionJobsOptionsModel.SetSourceFileType("csv") - createIngestionJobsOptionsModel.SetValidateCsvHeader(false) - createIngestionJobsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createIngestionJobsOptionsModel).ToNot(BeNil()) - Expect(createIngestionJobsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createIngestionJobsOptionsModel.JobID).To(Equal(core.StringPtr("ingestion-1699459946935"))) - Expect(createIngestionJobsOptionsModel.SourceDataFiles).To(Equal(core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet"))) - Expect(createIngestionJobsOptionsModel.TargetTable).To(Equal(core.StringPtr("demodb.test.targettable"))) - Expect(createIngestionJobsOptionsModel.Username).To(Equal(core.StringPtr("user1"))) - Expect(createIngestionJobsOptionsModel.CreateIfNotExist).To(Equal(core.BoolPtr(false))) - Expect(createIngestionJobsOptionsModel.CsvProperty).To(Equal(ingestionJobPrototypeCsvPropertyModel)) - Expect(createIngestionJobsOptionsModel.EngineID).To(Equal(core.StringPtr("spark123"))) - Expect(createIngestionJobsOptionsModel.ExecuteConfig).To(Equal(ingestionJobPrototypeExecuteConfigModel)) - Expect(createIngestionJobsOptionsModel.PartitionBy).To(Equal(core.StringPtr("col1, col2"))) - Expect(createIngestionJobsOptionsModel.Schema).To(Equal(core.StringPtr("{\"type\":\"struct\",\"schema-id\":0,\"fields\":[{\"id\":1,\"name\":\"ID\",\"required\":true,\"type\":\"int\"},{\"id\":2,\"name\":\"Name\",\"required\":true,\"type\":\"string\"}]}"))) - Expect(createIngestionJobsOptionsModel.SourceFileType).To(Equal(core.StringPtr("csv"))) - Expect(createIngestionJobsOptionsModel.ValidateCsvHeader).To(Equal(core.BoolPtr(false))) - Expect(createIngestionJobsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + createIngestionJobOptionsID := "testString" + var createIngestionJobOptionsSource *watsonxdatav3.SourceDetails = nil + var createIngestionJobOptionsTarget *watsonxdatav3.TargetDetails = nil + createIngestionJobOptionsModel := watsonxDataService.NewCreateIngestionJobOptions(authInstanceID, createIngestionJobOptionsID, createIngestionJobOptionsSource, createIngestionJobOptionsTarget) + createIngestionJobOptionsModel.SetAuthInstanceID("testString") + createIngestionJobOptionsModel.SetID("testString") + createIngestionJobOptionsModel.SetSource(sourceDetailsModel) + createIngestionJobOptionsModel.SetTarget(targetDetailsModel) + createIngestionJobOptionsModel.SetEngine(ingestionEngineModel) + createIngestionJobOptionsModel.SetEngineID("spark123") + createIngestionJobOptionsModel.SetExecuteConfig(executeConfigModel) + createIngestionJobOptionsModel.SetSourceIcebergTable(icebergSourceTableModel) + createIngestionJobOptionsModel.SetPartitionBy("column1,column2") + createIngestionJobOptionsModel.SetCapacity(capacityDetailsModel) + createIngestionJobOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createIngestionJobOptionsModel).ToNot(BeNil()) + Expect(createIngestionJobOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(createIngestionJobOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(createIngestionJobOptionsModel.Source).To(Equal(sourceDetailsModel)) + Expect(createIngestionJobOptionsModel.Target).To(Equal(targetDetailsModel)) + Expect(createIngestionJobOptionsModel.Engine).To(Equal(ingestionEngineModel)) + Expect(createIngestionJobOptionsModel.EngineID).To(Equal(core.StringPtr("spark123"))) + Expect(createIngestionJobOptionsModel.ExecuteConfig).To(Equal(executeConfigModel)) + Expect(createIngestionJobOptionsModel.SourceIcebergTable).To(Equal(icebergSourceTableModel)) + Expect(createIngestionJobOptionsModel.PartitionBy).To(Equal(core.StringPtr("column1,column2"))) + Expect(createIngestionJobOptionsModel.Capacity).To(Equal(capacityDetailsModel)) + Expect(createIngestionJobOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateIntegrationOptions successfully`, func() { + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + Expect(catalogsModel).ToNot(BeNil()) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + Expect(catalogsModel.CatalogNames).To(Equal([]string{"iceberg_data", "hive_data"})) + // Construct an instance of the CreateIntegrationOptions model createIntegrationOptionsModel := watsonxDataService.NewCreateIntegrationOptions() - createIntegrationOptionsModel.SetAccessToken("testString") - createIntegrationOptionsModel.SetApikey("testString") - createIntegrationOptionsModel.SetCrossAccountIntegration(true) + createIntegrationOptionsModel.SetAccessToken("Header.Payload.Signature") + createIntegrationOptionsModel.SetApikey("apikey") + createIntegrationOptionsModel.SetCatalogs(catalogsModel) + createIntegrationOptionsModel.SetCertificate("certificate_content_base64_encoded") + createIntegrationOptionsModel.SetCertificateExtension("pem") + createIntegrationOptionsModel.SetConnectionMode("external") + createIntegrationOptionsModel.SetCrossAccountIntegration(false) createIntegrationOptionsModel.SetEnableDataPolicyWithinWxd(false) - createIntegrationOptionsModel.SetIkcUserAccountID("testString") + createIntegrationOptionsModel.SetIkcUserAccountID("ikc_user_account_id") createIntegrationOptionsModel.SetPassword("password") - createIntegrationOptionsModel.SetResource("resource_name") - createIntegrationOptionsModel.SetServiceType("ranger") - createIntegrationOptionsModel.SetStorageCatalogs([]string{"testString"}) - createIntegrationOptionsModel.SetURL("http://abcd.efgh.com:9876/") + createIntegrationOptionsModel.SetPolicyCacheTimeConfiguration("123456789") + createIntegrationOptionsModel.SetResource("presto01") + createIntegrationOptionsModel.SetSsl(true) + createIntegrationOptionsModel.SetType("ranger") + createIntegrationOptionsModel.SetURL("https://abcd.efgh.com") createIntegrationOptionsModel.SetUsername("username") createIntegrationOptionsModel.SetAuthInstanceID("testString") createIntegrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createIntegrationOptionsModel).ToNot(BeNil()) - Expect(createIntegrationOptionsModel.AccessToken).To(Equal(core.StringPtr("testString"))) - Expect(createIntegrationOptionsModel.Apikey).To(Equal(core.StringPtr("testString"))) - Expect(createIntegrationOptionsModel.CrossAccountIntegration).To(Equal(core.BoolPtr(true))) + Expect(createIntegrationOptionsModel.AccessToken).To(Equal(core.StringPtr("Header.Payload.Signature"))) + Expect(createIntegrationOptionsModel.Apikey).To(Equal(core.StringPtr("apikey"))) + Expect(createIntegrationOptionsModel.Catalogs).To(Equal(catalogsModel)) + Expect(createIntegrationOptionsModel.Certificate).To(Equal(core.StringPtr("certificate_content_base64_encoded"))) + Expect(createIntegrationOptionsModel.CertificateExtension).To(Equal(core.StringPtr("pem"))) + Expect(createIntegrationOptionsModel.ConnectionMode).To(Equal(core.StringPtr("external"))) + Expect(createIntegrationOptionsModel.CrossAccountIntegration).To(Equal(core.BoolPtr(false))) Expect(createIntegrationOptionsModel.EnableDataPolicyWithinWxd).To(Equal(core.BoolPtr(false))) - Expect(createIntegrationOptionsModel.IkcUserAccountID).To(Equal(core.StringPtr("testString"))) + Expect(createIntegrationOptionsModel.IkcUserAccountID).To(Equal(core.StringPtr("ikc_user_account_id"))) Expect(createIntegrationOptionsModel.Password).To(Equal(core.StringPtr("password"))) - Expect(createIntegrationOptionsModel.Resource).To(Equal(core.StringPtr("resource_name"))) - Expect(createIntegrationOptionsModel.ServiceType).To(Equal(core.StringPtr("ranger"))) - Expect(createIntegrationOptionsModel.StorageCatalogs).To(Equal([]string{"testString"})) - Expect(createIntegrationOptionsModel.URL).To(Equal(core.StringPtr("http://abcd.efgh.com:9876/"))) + Expect(createIntegrationOptionsModel.PolicyCacheTimeConfiguration).To(Equal(core.StringPtr("123456789"))) + Expect(createIntegrationOptionsModel.Resource).To(Equal(core.StringPtr("presto01"))) + Expect(createIntegrationOptionsModel.Ssl).To(Equal(core.BoolPtr(true))) + Expect(createIntegrationOptionsModel.Type).To(Equal(core.StringPtr("ranger"))) + Expect(createIntegrationOptionsModel.URL).To(Equal(core.StringPtr("https://abcd.efgh.com"))) Expect(createIntegrationOptionsModel.Username).To(Equal(core.StringPtr("username"))) Expect(createIntegrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createIntegrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateMilvusServiceOptions successfully`, func() { // Construct an instance of the CreateMilvusServiceOptions model - createMilvusServiceOptionsBucketName := "Sample bucket name" + createMilvusServiceOptionsDisplayName := "sampleService" createMilvusServiceOptionsOrigin := "native" - createMilvusServiceOptionsRootPath := "Sample path" - createMilvusServiceOptionsServiceDisplayName := "sampleService" - createMilvusServiceOptionsModel := watsonxDataService.NewCreateMilvusServiceOptions(createMilvusServiceOptionsBucketName, createMilvusServiceOptionsOrigin, createMilvusServiceOptionsRootPath, createMilvusServiceOptionsServiceDisplayName) - createMilvusServiceOptionsModel.SetBucketName("Sample bucket name") + createMilvusServiceOptionsRootPath := "Sample/path" + createMilvusServiceOptionsTshirtSize := "small" + createMilvusServiceOptionsModel := watsonxDataService.NewCreateMilvusServiceOptions(createMilvusServiceOptionsDisplayName, createMilvusServiceOptionsOrigin, createMilvusServiceOptionsRootPath, createMilvusServiceOptionsTshirtSize) + createMilvusServiceOptionsModel.SetDisplayName("sampleService") createMilvusServiceOptionsModel.SetOrigin("native") - createMilvusServiceOptionsModel.SetRootPath("Sample path") - createMilvusServiceOptionsModel.SetServiceDisplayName("sampleService") - createMilvusServiceOptionsModel.SetBucketType("Sample bucket type") + createMilvusServiceOptionsModel.SetRootPath("Sample/path") + createMilvusServiceOptionsModel.SetTshirtSize("small") + createMilvusServiceOptionsModel.SetDcCpu(float64(0.01)) + createMilvusServiceOptionsModel.SetDcMemory(float64(0.01)) + createMilvusServiceOptionsModel.SetDcReplicas(int64(1)) createMilvusServiceOptionsModel.SetDescription("milvus service for running sql queries") + createMilvusServiceOptionsModel.SetDwCpu(float64(0.01)) + createMilvusServiceOptionsModel.SetDwMemory(float64(0.01)) + createMilvusServiceOptionsModel.SetDwReplicas(int64(1)) + createMilvusServiceOptionsModel.SetEtcdCpu(float64(0.01)) + createMilvusServiceOptionsModel.SetEtcdMemory(float64(0.01)) + createMilvusServiceOptionsModel.SetID("milvus123") + createMilvusServiceOptionsModel.SetIndexType("ivf_sq8") + createMilvusServiceOptionsModel.SetIwCpu(float64(0.01)) + createMilvusServiceOptionsModel.SetIwMemory(float64(0.01)) + createMilvusServiceOptionsModel.SetIwReplicas(int64(1)) + createMilvusServiceOptionsModel.SetKafkaCpu(float64(0.01)) + createMilvusServiceOptionsModel.SetKafkaMemory(float64(0.01)) + createMilvusServiceOptionsModel.SetProxyCpu(float64(0.01)) + createMilvusServiceOptionsModel.SetProxyMemory(float64(0.01)) + createMilvusServiceOptionsModel.SetProxyReplicas(int64(1)) + createMilvusServiceOptionsModel.SetQcCpu(float64(0.01)) + createMilvusServiceOptionsModel.SetQcMemory(float64(0.01)) + createMilvusServiceOptionsModel.SetQcReplicas(int64(1)) + createMilvusServiceOptionsModel.SetQwCpu(float64(0.01)) + createMilvusServiceOptionsModel.SetQwMemory(float64(0.01)) + createMilvusServiceOptionsModel.SetQwReplicas(int64(1)) + createMilvusServiceOptionsModel.SetRcCpu(float64(0.01)) + createMilvusServiceOptionsModel.SetRcMemory(float64(0.01)) + createMilvusServiceOptionsModel.SetRcReplicas(int64(1)) + createMilvusServiceOptionsModel.SetStorageName("Sample_storage_name") createMilvusServiceOptionsModel.SetTags([]string{"tag1", "tag2"}) - createMilvusServiceOptionsModel.SetTshirtSize("small") + createMilvusServiceOptionsModel.SetVector(int64(1)) + createMilvusServiceOptionsModel.SetVectorDimension(int64(384)) createMilvusServiceOptionsModel.SetAuthInstanceID("testString") createMilvusServiceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createMilvusServiceOptionsModel).ToNot(BeNil()) - Expect(createMilvusServiceOptionsModel.BucketName).To(Equal(core.StringPtr("Sample bucket name"))) + Expect(createMilvusServiceOptionsModel.DisplayName).To(Equal(core.StringPtr("sampleService"))) Expect(createMilvusServiceOptionsModel.Origin).To(Equal(core.StringPtr("native"))) - Expect(createMilvusServiceOptionsModel.RootPath).To(Equal(core.StringPtr("Sample path"))) - Expect(createMilvusServiceOptionsModel.ServiceDisplayName).To(Equal(core.StringPtr("sampleService"))) - Expect(createMilvusServiceOptionsModel.BucketType).To(Equal(core.StringPtr("Sample bucket type"))) + Expect(createMilvusServiceOptionsModel.RootPath).To(Equal(core.StringPtr("Sample/path"))) + Expect(createMilvusServiceOptionsModel.TshirtSize).To(Equal(core.StringPtr("small"))) + Expect(createMilvusServiceOptionsModel.DcCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.DcMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.DcReplicas).To(Equal(core.Int64Ptr(int64(1)))) Expect(createMilvusServiceOptionsModel.Description).To(Equal(core.StringPtr("milvus service for running sql queries"))) + Expect(createMilvusServiceOptionsModel.DwCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.DwMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.DwReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceOptionsModel.EtcdCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.EtcdMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.ID).To(Equal(core.StringPtr("milvus123"))) + Expect(createMilvusServiceOptionsModel.IndexType).To(Equal(core.StringPtr("ivf_sq8"))) + Expect(createMilvusServiceOptionsModel.IwCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.IwMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.IwReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceOptionsModel.KafkaCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.KafkaMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.ProxyCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.ProxyMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.ProxyReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceOptionsModel.QcCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.QcMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.QcReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceOptionsModel.QwCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.QwMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.QwReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceOptionsModel.RcCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.RcMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceOptionsModel.RcReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceOptionsModel.StorageName).To(Equal(core.StringPtr("Sample_storage_name"))) Expect(createMilvusServiceOptionsModel.Tags).To(Equal([]string{"tag1", "tag2"})) - Expect(createMilvusServiceOptionsModel.TshirtSize).To(Equal(core.StringPtr("small"))) + Expect(createMilvusServiceOptionsModel.Vector).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceOptionsModel.VectorDimension).To(Equal(core.Int64Ptr(int64(384)))) Expect(createMilvusServiceOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createMilvusServiceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateMilvusServicePauseOptions successfully`, func() { // Construct an instance of the CreateMilvusServicePauseOptions model - serviceID := "testString" - createMilvusServicePauseOptionsModel := watsonxDataService.NewCreateMilvusServicePauseOptions(serviceID) - createMilvusServicePauseOptionsModel.SetServiceID("testString") + id := "testString" + createMilvusServicePauseOptionsModel := watsonxDataService.NewCreateMilvusServicePauseOptions(id) + createMilvusServicePauseOptionsModel.SetID("testString") createMilvusServicePauseOptionsModel.SetAuthInstanceID("testString") createMilvusServicePauseOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createMilvusServicePauseOptionsModel).ToNot(BeNil()) - Expect(createMilvusServicePauseOptionsModel.ServiceID).To(Equal(core.StringPtr("testString"))) + Expect(createMilvusServicePauseOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(createMilvusServicePauseOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createMilvusServicePauseOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateMilvusServiceResumeOptions successfully`, func() { // Construct an instance of the CreateMilvusServiceResumeOptions model - serviceID := "testString" - createMilvusServiceResumeOptionsModel := watsonxDataService.NewCreateMilvusServiceResumeOptions(serviceID) - createMilvusServiceResumeOptionsModel.SetServiceID("testString") + id := "testString" + createMilvusServiceResumeOptionsModel := watsonxDataService.NewCreateMilvusServiceResumeOptions(id) + createMilvusServiceResumeOptionsModel.SetID("testString") createMilvusServiceResumeOptionsModel.SetAuthInstanceID("testString") createMilvusServiceResumeOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createMilvusServiceResumeOptionsModel).ToNot(BeNil()) - Expect(createMilvusServiceResumeOptionsModel.ServiceID).To(Equal(core.StringPtr("testString"))) + Expect(createMilvusServiceResumeOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(createMilvusServiceResumeOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createMilvusServiceResumeOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateMilvusServiceScaleOptions successfully`, func() { // Construct an instance of the CreateMilvusServiceScaleOptions model - serviceID := "testString" - createMilvusServiceScaleOptionsModel := watsonxDataService.NewCreateMilvusServiceScaleOptions(serviceID) - createMilvusServiceScaleOptionsModel.SetServiceID("testString") + id := "testString" + createMilvusServiceScaleOptionsTshirtSize := "small" + createMilvusServiceScaleOptionsModel := watsonxDataService.NewCreateMilvusServiceScaleOptions(id, createMilvusServiceScaleOptionsTshirtSize) + createMilvusServiceScaleOptionsModel.SetID("testString") createMilvusServiceScaleOptionsModel.SetTshirtSize("small") + createMilvusServiceScaleOptionsModel.SetDcCpu(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetDcMemory(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetDcReplicas(int64(1)) + createMilvusServiceScaleOptionsModel.SetDwCpu(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetDwMemory(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetDwReplicas(int64(1)) + createMilvusServiceScaleOptionsModel.SetEtcdCpu(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetEtcdMemory(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetIndexType("flat") + createMilvusServiceScaleOptionsModel.SetIwCpu(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetIwMemory(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetIwReplicas(int64(1)) + createMilvusServiceScaleOptionsModel.SetKafkaCpu(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetKafkaMemory(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetProxyCpu(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetProxyMemory(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetProxyReplicas(int64(1)) + createMilvusServiceScaleOptionsModel.SetQcCpu(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetQcMemory(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetQcReplicas(int64(1)) + createMilvusServiceScaleOptionsModel.SetQwCpu(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetQwMemory(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetQwReplicas(int64(1)) + createMilvusServiceScaleOptionsModel.SetRcCpu(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetRcMemory(float64(0.01)) + createMilvusServiceScaleOptionsModel.SetRcReplicas(int64(1)) + createMilvusServiceScaleOptionsModel.SetVector(int64(1)) + createMilvusServiceScaleOptionsModel.SetVectorDimension(int64(384)) createMilvusServiceScaleOptionsModel.SetAuthInstanceID("testString") createMilvusServiceScaleOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createMilvusServiceScaleOptionsModel).ToNot(BeNil()) - Expect(createMilvusServiceScaleOptionsModel.ServiceID).To(Equal(core.StringPtr("testString"))) + Expect(createMilvusServiceScaleOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(createMilvusServiceScaleOptionsModel.TshirtSize).To(Equal(core.StringPtr("small"))) + Expect(createMilvusServiceScaleOptionsModel.DcCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.DcMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.DcReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceScaleOptionsModel.DwCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.DwMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.DwReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceScaleOptionsModel.EtcdCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.EtcdMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.IndexType).To(Equal(core.StringPtr("flat"))) + Expect(createMilvusServiceScaleOptionsModel.IwCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.IwMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.IwReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceScaleOptionsModel.KafkaCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.KafkaMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.ProxyCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.ProxyMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.ProxyReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceScaleOptionsModel.QcCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.QcMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.QcReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceScaleOptionsModel.QwCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.QwMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.QwReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceScaleOptionsModel.RcCpu).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.RcMemory).To(Equal(core.Float64Ptr(float64(0.01)))) + Expect(createMilvusServiceScaleOptionsModel.RcReplicas).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceScaleOptionsModel.Vector).To(Equal(core.Int64Ptr(int64(1)))) + Expect(createMilvusServiceScaleOptionsModel.VectorDimension).To(Equal(core.Int64Ptr(int64(384)))) Expect(createMilvusServiceScaleOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createMilvusServiceScaleOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateNetezzaEngineOptions successfully`, func() { - // Construct an instance of the NetezzaEngineDetailsBody model - netezzaEngineDetailsBodyModel := new(watsonxdatav2.NetezzaEngineDetailsBody) - Expect(netezzaEngineDetailsBodyModel).ToNot(BeNil()) - netezzaEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - Expect(netezzaEngineDetailsBodyModel.ConnectionString).To(Equal(core.StringPtr("1.2.3.4"))) + // Construct an instance of the NetezzaEngineConfigurationBody model + netezzaEngineConfigurationBodyModel := new(watsonxdatav3.NetezzaEngineConfigurationBody) + Expect(netezzaEngineConfigurationBodyModel).ToNot(BeNil()) + netezzaEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + Expect(netezzaEngineConfigurationBodyModel.ConnectionString).To(Equal(core.StringPtr("1.2.3.4"))) // Construct an instance of the CreateNetezzaEngineOptions model + var createNetezzaEngineOptionsConfiguration *watsonxdatav3.NetezzaEngineConfigurationBody = nil + createNetezzaEngineOptionsDisplayName := "sampleEngine" createNetezzaEngineOptionsOrigin := "external" - createNetezzaEngineOptionsModel := watsonxDataService.NewCreateNetezzaEngineOptions(createNetezzaEngineOptionsOrigin) + createNetezzaEngineOptionsModel := watsonxDataService.NewCreateNetezzaEngineOptions(createNetezzaEngineOptionsConfiguration, createNetezzaEngineOptionsDisplayName, createNetezzaEngineOptionsOrigin) + createNetezzaEngineOptionsModel.SetConfiguration(netezzaEngineConfigurationBodyModel) + createNetezzaEngineOptionsModel.SetDisplayName("sampleEngine") createNetezzaEngineOptionsModel.SetOrigin("external") createNetezzaEngineOptionsModel.SetDescription("netezza engine description") - createNetezzaEngineOptionsModel.SetEngineDetails(netezzaEngineDetailsBodyModel) - createNetezzaEngineOptionsModel.SetEngineDisplayName("sampleEngine") createNetezzaEngineOptionsModel.SetTags([]string{"tag1", "tag2"}) createNetezzaEngineOptionsModel.SetAuthInstanceID("testString") createNetezzaEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createNetezzaEngineOptionsModel).ToNot(BeNil()) + Expect(createNetezzaEngineOptionsModel.Configuration).To(Equal(netezzaEngineConfigurationBodyModel)) + Expect(createNetezzaEngineOptionsModel.DisplayName).To(Equal(core.StringPtr("sampleEngine"))) Expect(createNetezzaEngineOptionsModel.Origin).To(Equal(core.StringPtr("external"))) Expect(createNetezzaEngineOptionsModel.Description).To(Equal(core.StringPtr("netezza engine description"))) - Expect(createNetezzaEngineOptionsModel.EngineDetails).To(Equal(netezzaEngineDetailsBodyModel)) - Expect(createNetezzaEngineOptionsModel.EngineDisplayName).To(Equal(core.StringPtr("sampleEngine"))) Expect(createNetezzaEngineOptionsModel.Tags).To(Equal([]string{"tag1", "tag2"})) Expect(createNetezzaEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createNetezzaEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateOtherEngineOptions successfully`, func() { - // Construct an instance of the OtherEngineDetailsBody model - otherEngineDetailsBodyModel := new(watsonxdatav2.OtherEngineDetailsBody) - Expect(otherEngineDetailsBodyModel).ToNot(BeNil()) - otherEngineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - otherEngineDetailsBodyModel.EngineType = core.StringPtr("netezza") - Expect(otherEngineDetailsBodyModel.ConnectionString).To(Equal(core.StringPtr("1.2.3.4"))) - Expect(otherEngineDetailsBodyModel.EngineType).To(Equal(core.StringPtr("netezza"))) + // Construct an instance of the OtherEngineConfigurationBody model + otherEngineConfigurationBodyModel := new(watsonxdatav3.OtherEngineConfigurationBody) + Expect(otherEngineConfigurationBodyModel).ToNot(BeNil()) + otherEngineConfigurationBodyModel.ConnectionString = core.StringPtr("1.2.3.4") + otherEngineConfigurationBodyModel.Type = core.StringPtr("netezza") + Expect(otherEngineConfigurationBodyModel.ConnectionString).To(Equal(core.StringPtr("1.2.3.4"))) + Expect(otherEngineConfigurationBodyModel.Type).To(Equal(core.StringPtr("netezza"))) // Construct an instance of the CreateOtherEngineOptions model - var createOtherEngineOptionsEngineDetails *watsonxdatav2.OtherEngineDetailsBody = nil - createOtherEngineOptionsEngineDisplayName := "sampleEngine01" - createOtherEngineOptionsModel := watsonxDataService.NewCreateOtherEngineOptions(createOtherEngineOptionsEngineDetails, createOtherEngineOptionsEngineDisplayName) - createOtherEngineOptionsModel.SetEngineDetails(otherEngineDetailsBodyModel) - createOtherEngineOptionsModel.SetEngineDisplayName("sampleEngine01") - createOtherEngineOptionsModel.SetDescription("external engine description") + var createOtherEngineOptionsConfiguration *watsonxdatav3.OtherEngineConfigurationBody = nil + createOtherEngineOptionsDisplayName := "sampleEngine01" + createOtherEngineOptionsOrigin := "external" + createOtherEngineOptionsModel := watsonxDataService.NewCreateOtherEngineOptions(createOtherEngineOptionsConfiguration, createOtherEngineOptionsDisplayName, createOtherEngineOptionsOrigin) + createOtherEngineOptionsModel.SetConfiguration(otherEngineConfigurationBodyModel) + createOtherEngineOptionsModel.SetDisplayName("sampleEngine01") createOtherEngineOptionsModel.SetOrigin("external") + createOtherEngineOptionsModel.SetDescription("external engine description") createOtherEngineOptionsModel.SetTags([]string{"tag1", "tag2"}) createOtherEngineOptionsModel.SetAuthInstanceID("testString") createOtherEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createOtherEngineOptionsModel).ToNot(BeNil()) - Expect(createOtherEngineOptionsModel.EngineDetails).To(Equal(otherEngineDetailsBodyModel)) - Expect(createOtherEngineOptionsModel.EngineDisplayName).To(Equal(core.StringPtr("sampleEngine01"))) - Expect(createOtherEngineOptionsModel.Description).To(Equal(core.StringPtr("external engine description"))) + Expect(createOtherEngineOptionsModel.Configuration).To(Equal(otherEngineConfigurationBodyModel)) + Expect(createOtherEngineOptionsModel.DisplayName).To(Equal(core.StringPtr("sampleEngine01"))) Expect(createOtherEngineOptionsModel.Origin).To(Equal(core.StringPtr("external"))) + Expect(createOtherEngineOptionsModel.Description).To(Equal(core.StringPtr("external engine description"))) Expect(createOtherEngineOptionsModel.Tags).To(Equal([]string{"tag1", "tag2"})) Expect(createOtherEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createOtherEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreatePrestissimoEngineCatalogsOptions successfully`, func() { // Construct an instance of the CreatePrestissimoEngineCatalogsOptions model - engineID := "testString" - createPrestissimoEngineCatalogsOptionsModel := watsonxDataService.NewCreatePrestissimoEngineCatalogsOptions(engineID) - createPrestissimoEngineCatalogsOptionsModel.SetEngineID("testString") - createPrestissimoEngineCatalogsOptionsModel.SetCatalogName("testString") + id := "testString" + createPrestissimoEngineCatalogsOptionsCatalogNames := []string{"iceberg_catalog"} + createPrestissimoEngineCatalogsOptionsModel := watsonxDataService.NewCreatePrestissimoEngineCatalogsOptions(id, createPrestissimoEngineCatalogsOptionsCatalogNames) + createPrestissimoEngineCatalogsOptionsModel.SetID("testString") + createPrestissimoEngineCatalogsOptionsModel.SetCatalogNames([]string{"iceberg_catalog"}) createPrestissimoEngineCatalogsOptionsModel.SetAuthInstanceID("testString") createPrestissimoEngineCatalogsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createPrestissimoEngineCatalogsOptionsModel).ToNot(BeNil()) - Expect(createPrestissimoEngineCatalogsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(createPrestissimoEngineCatalogsOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(createPrestissimoEngineCatalogsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(createPrestissimoEngineCatalogsOptionsModel.CatalogNames).To(Equal([]string{"iceberg_catalog"})) Expect(createPrestissimoEngineCatalogsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createPrestissimoEngineCatalogsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreatePrestissimoEngineOptions successfully`, func() { - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - Expect(prestissimoNodeDescriptionBodyModel).ToNot(BeNil()) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - Expect(prestissimoNodeDescriptionBodyModel.NodeType).To(Equal(core.StringPtr("worker"))) - Expect(prestissimoNodeDescriptionBodyModel.Quantity).To(Equal(core.Int64Ptr(int64(38)))) - - // Construct an instance of the PrestissimoEndpoints model - prestissimoEndpointsModel := new(watsonxdatav2.PrestissimoEndpoints) - Expect(prestissimoEndpointsModel).ToNot(BeNil()) - prestissimoEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/") - prestissimoEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") - prestissimoEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-") - prestissimoEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") - prestissimoEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") - prestissimoEndpointsModel.ViewHistoryServer = core.StringPtr("testString") - prestissimoEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") - Expect(prestissimoEndpointsModel.ApplicationsApi).To(Equal(core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/"))) - Expect(prestissimoEndpointsModel.HistoryServerEndpoint).To(Equal(core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server"))) - Expect(prestissimoEndpointsModel.SparkAccessEndpoint).To(Equal(core.StringPtr("$HOST/analytics-engine/details/spark-"))) - Expect(prestissimoEndpointsModel.SparkJobsV4Endpoint).To(Equal(core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications"))) - Expect(prestissimoEndpointsModel.SparkKernelEndpoint).To(Equal(core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels"))) - Expect(prestissimoEndpointsModel.ViewHistoryServer).To(Equal(core.StringPtr("testString"))) - Expect(prestissimoEndpointsModel.WxdApplicationEndpoint).To(Equal(core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications"))) + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + Expect(nodeDescriptionModel).ToNot(BeNil()) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + Expect(nodeDescriptionModel.NodeType).To(Equal(core.StringPtr("worker"))) + Expect(nodeDescriptionModel.Quantity).To(Equal(core.Int64Ptr(int64(1)))) // Construct an instance of the PrestissimoEngineDetails model - prestissimoEngineDetailsModel := new(watsonxdatav2.PrestissimoEngineDetails) + prestissimoEngineDetailsModel := new(watsonxdatav3.PrestissimoEngineDetails) Expect(prestissimoEngineDetailsModel).ToNot(BeNil()) - prestissimoEngineDetailsModel.ApiKey = core.StringPtr("") - prestissimoEngineDetailsModel.ConnectionString = core.StringPtr("1.2.3.4") - prestissimoEngineDetailsModel.Coordinator = prestissimoNodeDescriptionBodyModel - prestissimoEngineDetailsModel.Endpoints = prestissimoEndpointsModel - prestissimoEngineDetailsModel.InstanceID = core.StringPtr("instance_id") - prestissimoEngineDetailsModel.ManagedBy = core.StringPtr("fully/self") - prestissimoEngineDetailsModel.MetastoreHost = core.StringPtr("1.2.3.4") + prestissimoEngineDetailsModel.Coordinator = nodeDescriptionModel prestissimoEngineDetailsModel.SizeConfig = core.StringPtr("starter") - prestissimoEngineDetailsModel.Worker = prestissimoNodeDescriptionBodyModel - Expect(prestissimoEngineDetailsModel.ApiKey).To(Equal(core.StringPtr(""))) - Expect(prestissimoEngineDetailsModel.ConnectionString).To(Equal(core.StringPtr("1.2.3.4"))) - Expect(prestissimoEngineDetailsModel.Coordinator).To(Equal(prestissimoNodeDescriptionBodyModel)) - Expect(prestissimoEngineDetailsModel.Endpoints).To(Equal(prestissimoEndpointsModel)) - Expect(prestissimoEngineDetailsModel.InstanceID).To(Equal(core.StringPtr("instance_id"))) - Expect(prestissimoEngineDetailsModel.ManagedBy).To(Equal(core.StringPtr("fully/self"))) - Expect(prestissimoEngineDetailsModel.MetastoreHost).To(Equal(core.StringPtr("1.2.3.4"))) + prestissimoEngineDetailsModel.Worker = nodeDescriptionModel + Expect(prestissimoEngineDetailsModel.Coordinator).To(Equal(nodeDescriptionModel)) Expect(prestissimoEngineDetailsModel.SizeConfig).To(Equal(core.StringPtr("starter"))) - Expect(prestissimoEngineDetailsModel.Worker).To(Equal(prestissimoNodeDescriptionBodyModel)) + Expect(prestissimoEngineDetailsModel.Worker).To(Equal(nodeDescriptionModel)) // Construct an instance of the CreatePrestissimoEngineOptions model + var createPrestissimoEngineOptionsConfiguration *watsonxdatav3.PrestissimoEngineDetails = nil + createPrestissimoEngineOptionsDisplayName := "sampleEngine" createPrestissimoEngineOptionsOrigin := "native" - createPrestissimoEngineOptionsModel := watsonxDataService.NewCreatePrestissimoEngineOptions(createPrestissimoEngineOptionsOrigin) + createPrestissimoEngineOptionsModel := watsonxDataService.NewCreatePrestissimoEngineOptions(createPrestissimoEngineOptionsConfiguration, createPrestissimoEngineOptionsDisplayName, createPrestissimoEngineOptionsOrigin) + createPrestissimoEngineOptionsModel.SetConfiguration(prestissimoEngineDetailsModel) + createPrestissimoEngineOptionsModel.SetDisplayName("sampleEngine") createPrestissimoEngineOptionsModel.SetOrigin("native") createPrestissimoEngineOptionsModel.SetAssociatedCatalogs([]string{"hive_data"}) createPrestissimoEngineOptionsModel.SetDescription("prestissimo engine description") - createPrestissimoEngineOptionsModel.SetEngineDetails(prestissimoEngineDetailsModel) - createPrestissimoEngineOptionsModel.SetEngineDisplayName("sampleEngine") - createPrestissimoEngineOptionsModel.SetRegion("us-south") + createPrestissimoEngineOptionsModel.SetID("prestissimo123") createPrestissimoEngineOptionsModel.SetTags([]string{"tag1", "tag2"}) - createPrestissimoEngineOptionsModel.SetVersion("1.2.3") createPrestissimoEngineOptionsModel.SetAuthInstanceID("testString") createPrestissimoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createPrestissimoEngineOptionsModel).ToNot(BeNil()) + Expect(createPrestissimoEngineOptionsModel.Configuration).To(Equal(prestissimoEngineDetailsModel)) + Expect(createPrestissimoEngineOptionsModel.DisplayName).To(Equal(core.StringPtr("sampleEngine"))) Expect(createPrestissimoEngineOptionsModel.Origin).To(Equal(core.StringPtr("native"))) Expect(createPrestissimoEngineOptionsModel.AssociatedCatalogs).To(Equal([]string{"hive_data"})) Expect(createPrestissimoEngineOptionsModel.Description).To(Equal(core.StringPtr("prestissimo engine description"))) - Expect(createPrestissimoEngineOptionsModel.EngineDetails).To(Equal(prestissimoEngineDetailsModel)) - Expect(createPrestissimoEngineOptionsModel.EngineDisplayName).To(Equal(core.StringPtr("sampleEngine"))) - Expect(createPrestissimoEngineOptionsModel.Region).To(Equal(core.StringPtr("us-south"))) + Expect(createPrestissimoEngineOptionsModel.ID).To(Equal(core.StringPtr("prestissimo123"))) Expect(createPrestissimoEngineOptionsModel.Tags).To(Equal([]string{"tag1", "tag2"})) - Expect(createPrestissimoEngineOptionsModel.Version).To(Equal(core.StringPtr("1.2.3"))) Expect(createPrestissimoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createPrestissimoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreatePrestoEngineCatalogsOptions successfully`, func() { // Construct an instance of the CreatePrestoEngineCatalogsOptions model engineID := "testString" - createPrestoEngineCatalogsOptionsModel := watsonxDataService.NewCreatePrestoEngineCatalogsOptions(engineID) + createPrestoEngineCatalogsOptionsCatalogNames := []string{"iceberg_catalog"} + createPrestoEngineCatalogsOptionsModel := watsonxDataService.NewCreatePrestoEngineCatalogsOptions(engineID, createPrestoEngineCatalogsOptionsCatalogNames) createPrestoEngineCatalogsOptionsModel.SetEngineID("testString") - createPrestoEngineCatalogsOptionsModel.SetCatalogName("testString") + createPrestoEngineCatalogsOptionsModel.SetCatalogNames([]string{"iceberg_catalog"}) createPrestoEngineCatalogsOptionsModel.SetAuthInstanceID("testString") createPrestoEngineCatalogsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createPrestoEngineCatalogsOptionsModel).ToNot(BeNil()) Expect(createPrestoEngineCatalogsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(createPrestoEngineCatalogsOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(createPrestoEngineCatalogsOptionsModel.CatalogNames).To(Equal([]string{"iceberg_catalog"})) Expect(createPrestoEngineCatalogsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createPrestoEngineCatalogsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreatePrestoEngineOptions successfully`, func() { - // Construct an instance of the NodeDescriptionBody model - nodeDescriptionBodyModel := new(watsonxdatav2.NodeDescriptionBody) - Expect(nodeDescriptionBodyModel).ToNot(BeNil()) - nodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - nodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - Expect(nodeDescriptionBodyModel.NodeType).To(Equal(core.StringPtr("worker"))) - Expect(nodeDescriptionBodyModel.Quantity).To(Equal(core.Int64Ptr(int64(38)))) - - // Construct an instance of the EngineDetailsBody model - engineDetailsBodyModel := new(watsonxdatav2.EngineDetailsBody) - Expect(engineDetailsBodyModel).ToNot(BeNil()) - engineDetailsBodyModel.ApiKey = core.StringPtr("") - engineDetailsBodyModel.ConnectionString = core.StringPtr("1.2.3.4") - engineDetailsBodyModel.Coordinator = nodeDescriptionBodyModel - engineDetailsBodyModel.InstanceID = core.StringPtr("instance_id") - engineDetailsBodyModel.ManagedBy = core.StringPtr("fully/self") - engineDetailsBodyModel.SizeConfig = core.StringPtr("starter") - engineDetailsBodyModel.Worker = nodeDescriptionBodyModel - Expect(engineDetailsBodyModel.ApiKey).To(Equal(core.StringPtr(""))) - Expect(engineDetailsBodyModel.ConnectionString).To(Equal(core.StringPtr("1.2.3.4"))) - Expect(engineDetailsBodyModel.Coordinator).To(Equal(nodeDescriptionBodyModel)) - Expect(engineDetailsBodyModel.InstanceID).To(Equal(core.StringPtr("instance_id"))) - Expect(engineDetailsBodyModel.ManagedBy).To(Equal(core.StringPtr("fully/self"))) - Expect(engineDetailsBodyModel.SizeConfig).To(Equal(core.StringPtr("starter"))) - Expect(engineDetailsBodyModel.Worker).To(Equal(nodeDescriptionBodyModel)) + // Construct an instance of the CoordinatorNodeDescriptionBody model + coordinatorNodeDescriptionBodyModel := new(watsonxdatav3.CoordinatorNodeDescriptionBody) + Expect(coordinatorNodeDescriptionBodyModel).ToNot(BeNil()) + coordinatorNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + coordinatorNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) + Expect(coordinatorNodeDescriptionBodyModel.NodeType).To(Equal(core.StringPtr("starter"))) + Expect(coordinatorNodeDescriptionBodyModel.Quantity).To(Equal(core.Int64Ptr(int64(1)))) + + // Construct an instance of the WorkerNodeDescriptionBody model + workerNodeDescriptionBodyModel := new(watsonxdatav3.WorkerNodeDescriptionBody) + Expect(workerNodeDescriptionBodyModel).ToNot(BeNil()) + workerNodeDescriptionBodyModel.NodeType = core.StringPtr("starter") + workerNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(1)) + Expect(workerNodeDescriptionBodyModel.NodeType).To(Equal(core.StringPtr("starter"))) + Expect(workerNodeDescriptionBodyModel.Quantity).To(Equal(core.Int64Ptr(int64(1)))) + + // Construct an instance of the AutoscalingConfig model + autoscalingConfigModel := new(watsonxdatav3.AutoscalingConfig) + Expect(autoscalingConfigModel).ToNot(BeNil()) + autoscalingConfigModel.Type = core.StringPtr("cpu") + autoscalingConfigModel.Target = core.Int64Ptr(int64(40)) + autoscalingConfigModel.MinWorkerQuantity = core.Int64Ptr(int64(1)) + autoscalingConfigModel.MaxWorkerQuantity = core.Int64Ptr(int64(18)) + autoscalingConfigModel.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + autoscalingConfigModel.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + autoscalingConfigModel.ScalingStepSize = core.Int64Ptr(int64(1)) + Expect(autoscalingConfigModel.Type).To(Equal(core.StringPtr("cpu"))) + Expect(autoscalingConfigModel.Target).To(Equal(core.Int64Ptr(int64(40)))) + Expect(autoscalingConfigModel.MinWorkerQuantity).To(Equal(core.Int64Ptr(int64(1)))) + Expect(autoscalingConfigModel.MaxWorkerQuantity).To(Equal(core.Int64Ptr(int64(18)))) + Expect(autoscalingConfigModel.QueryTerminationGracePeriodMin).To(Equal(core.Int64Ptr(int64(1)))) + Expect(autoscalingConfigModel.ScaleInStabilizationWindowMin).To(Equal(core.Int64Ptr(int64(5)))) + Expect(autoscalingConfigModel.ScalingStepSize).To(Equal(core.Int64Ptr(int64(1)))) + + // Construct an instance of the EngineDetails model + engineDetailsModel := new(watsonxdatav3.EngineDetails) + Expect(engineDetailsModel).ToNot(BeNil()) + engineDetailsModel.Coordinator = coordinatorNodeDescriptionBodyModel + engineDetailsModel.SizeConfig = core.StringPtr("starter") + engineDetailsModel.Worker = workerNodeDescriptionBodyModel + engineDetailsModel.AutoscalingEnabled = core.BoolPtr(true) + engineDetailsModel.AutoscalingConfig = autoscalingConfigModel + Expect(engineDetailsModel.Coordinator).To(Equal(coordinatorNodeDescriptionBodyModel)) + Expect(engineDetailsModel.SizeConfig).To(Equal(core.StringPtr("starter"))) + Expect(engineDetailsModel.Worker).To(Equal(workerNodeDescriptionBodyModel)) + Expect(engineDetailsModel.AutoscalingEnabled).To(Equal(core.BoolPtr(true))) + Expect(engineDetailsModel.AutoscalingConfig).To(Equal(autoscalingConfigModel)) // Construct an instance of the CreatePrestoEngineOptions model + var createPrestoEngineOptionsConfiguration *watsonxdatav3.EngineDetails = nil + createPrestoEngineOptionsDisplayName := "sampleEngine" createPrestoEngineOptionsOrigin := "native" - createPrestoEngineOptionsModel := watsonxDataService.NewCreatePrestoEngineOptions(createPrestoEngineOptionsOrigin) + createPrestoEngineOptionsModel := watsonxDataService.NewCreatePrestoEngineOptions(createPrestoEngineOptionsConfiguration, createPrestoEngineOptionsDisplayName, createPrestoEngineOptionsOrigin) + createPrestoEngineOptionsModel.SetConfiguration(engineDetailsModel) + createPrestoEngineOptionsModel.SetDisplayName("sampleEngine") createPrestoEngineOptionsModel.SetOrigin("native") - createPrestoEngineOptionsModel.SetAssociatedCatalogs([]string{"iceberg-data", "hive-data"}) + createPrestoEngineOptionsModel.SetAssociatedCatalogs([]string{"iceberg_data", "hive_data"}) createPrestoEngineOptionsModel.SetDescription("presto engine for running sql queries") - createPrestoEngineOptionsModel.SetEngineDetails(engineDetailsBodyModel) - createPrestoEngineOptionsModel.SetEngineDisplayName("sampleEngine") - createPrestoEngineOptionsModel.SetRegion("us-south") + createPrestoEngineOptionsModel.SetID("presto123") createPrestoEngineOptionsModel.SetTags([]string{"tag1", "tag2"}) - createPrestoEngineOptionsModel.SetVersion("1.2.3") createPrestoEngineOptionsModel.SetAuthInstanceID("testString") createPrestoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createPrestoEngineOptionsModel).ToNot(BeNil()) + Expect(createPrestoEngineOptionsModel.Configuration).To(Equal(engineDetailsModel)) + Expect(createPrestoEngineOptionsModel.DisplayName).To(Equal(core.StringPtr("sampleEngine"))) Expect(createPrestoEngineOptionsModel.Origin).To(Equal(core.StringPtr("native"))) - Expect(createPrestoEngineOptionsModel.AssociatedCatalogs).To(Equal([]string{"iceberg-data", "hive-data"})) + Expect(createPrestoEngineOptionsModel.AssociatedCatalogs).To(Equal([]string{"iceberg_data", "hive_data"})) Expect(createPrestoEngineOptionsModel.Description).To(Equal(core.StringPtr("presto engine for running sql queries"))) - Expect(createPrestoEngineOptionsModel.EngineDetails).To(Equal(engineDetailsBodyModel)) - Expect(createPrestoEngineOptionsModel.EngineDisplayName).To(Equal(core.StringPtr("sampleEngine"))) - Expect(createPrestoEngineOptionsModel.Region).To(Equal(core.StringPtr("us-south"))) + Expect(createPrestoEngineOptionsModel.ID).To(Equal(core.StringPtr("presto123"))) Expect(createPrestoEngineOptionsModel.Tags).To(Equal([]string{"tag1", "tag2"})) - Expect(createPrestoEngineOptionsModel.Version).To(Equal(core.StringPtr("1.2.3"))) Expect(createPrestoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createPrestoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewCreatePreviewIngestionFileOptions successfully`, func() { - // Construct an instance of the PreviewIngestionFilePrototypeCsvProperty model - previewIngestionFilePrototypeCsvPropertyModel := new(watsonxdatav2.PreviewIngestionFilePrototypeCsvProperty) - Expect(previewIngestionFilePrototypeCsvPropertyModel).ToNot(BeNil()) - previewIngestionFilePrototypeCsvPropertyModel.Encoding = core.StringPtr("utf-8") - previewIngestionFilePrototypeCsvPropertyModel.EscapeCharacter = core.StringPtr("\\\\") - previewIngestionFilePrototypeCsvPropertyModel.FieldDelimiter = core.StringPtr(",") - previewIngestionFilePrototypeCsvPropertyModel.Header = core.BoolPtr(true) - previewIngestionFilePrototypeCsvPropertyModel.LineDelimiter = core.StringPtr("\\n") - Expect(previewIngestionFilePrototypeCsvPropertyModel.Encoding).To(Equal(core.StringPtr("utf-8"))) - Expect(previewIngestionFilePrototypeCsvPropertyModel.EscapeCharacter).To(Equal(core.StringPtr("\\\\"))) - Expect(previewIngestionFilePrototypeCsvPropertyModel.FieldDelimiter).To(Equal(core.StringPtr(","))) - Expect(previewIngestionFilePrototypeCsvPropertyModel.Header).To(Equal(core.BoolPtr(true))) - Expect(previewIngestionFilePrototypeCsvPropertyModel.LineDelimiter).To(Equal(core.StringPtr("\\n"))) - - // Construct an instance of the CreatePreviewIngestionFileOptions model - authInstanceID := "testString" - createPreviewIngestionFileOptionsSourceDataFiles := "s3://demobucket/data/yellow_tripdata_2022-01.parquet" - createPreviewIngestionFileOptionsModel := watsonxDataService.NewCreatePreviewIngestionFileOptions(authInstanceID, createPreviewIngestionFileOptionsSourceDataFiles) - createPreviewIngestionFileOptionsModel.SetAuthInstanceID("testString") - createPreviewIngestionFileOptionsModel.SetSourceDataFiles("s3://demobucket/data/yellow_tripdata_2022-01.parquet") - createPreviewIngestionFileOptionsModel.SetCsvProperty(previewIngestionFilePrototypeCsvPropertyModel) - createPreviewIngestionFileOptionsModel.SetSourceFileType("csv") - createPreviewIngestionFileOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createPreviewIngestionFileOptionsModel).ToNot(BeNil()) - Expect(createPreviewIngestionFileOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createPreviewIngestionFileOptionsModel.SourceDataFiles).To(Equal(core.StringPtr("s3://demobucket/data/yellow_tripdata_2022-01.parquet"))) - Expect(createPreviewIngestionFileOptionsModel.CsvProperty).To(Equal(previewIngestionFilePrototypeCsvPropertyModel)) - Expect(createPreviewIngestionFileOptionsModel.SourceFileType).To(Equal(core.StringPtr("csv"))) - Expect(createPreviewIngestionFileOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewCreateSalIntegrationEnrichmentGlobalSettingsOptions successfully`, func() { - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel).ToNot(BeNil()) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.AssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.14)))) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.SuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.9)))) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel).ToNot(BeNil()) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.AssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.1)))) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.SuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.1)))) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansion model - salIntegrationEnrichmentSettingsSemanticExpansionModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionModel).ToNot(BeNil()) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGeneration = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGenerationConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansion = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansionConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel - Expect(salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGeneration).To(Equal(core.BoolPtr(true))) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGenerationConfiguration).To(Equal(salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel)) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansion).To(Equal(core.BoolPtr(true))) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansionConfiguration).To(Equal(salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsTermAssignment model - salIntegrationEnrichmentSettingsTermAssignmentModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel).ToNot(BeNil()) - salIntegrationEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.NameMatching).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.3)))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.4)))) - - // Construct an instance of the CreateSalIntegrationEnrichmentGlobalSettingsOptions model - createSalIntegrationEnrichmentGlobalSettingsOptionsModel := watsonxDataService.NewCreateSalIntegrationEnrichmentGlobalSettingsOptions() - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.SetSemanticExpansion(salIntegrationEnrichmentSettingsSemanticExpansionModel) - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.SetTermAssignment(salIntegrationEnrichmentSettingsTermAssignmentModel) - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.SetAuthInstanceID("testString") - createSalIntegrationEnrichmentGlobalSettingsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createSalIntegrationEnrichmentGlobalSettingsOptionsModel).ToNot(BeNil()) - Expect(createSalIntegrationEnrichmentGlobalSettingsOptionsModel.SemanticExpansion).To(Equal(salIntegrationEnrichmentSettingsSemanticExpansionModel)) - Expect(createSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment).To(Equal(salIntegrationEnrichmentSettingsTermAssignmentModel)) - Expect(createSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewCreateSalIntegrationEnrichmentOptions successfully`, func() { // Construct an instance of the EnrichmentObj model - enrichmentObjModel := new(watsonxdatav2.EnrichmentObj) + enrichmentObjModel := new(watsonxdatav3.EnrichmentObj) Expect(enrichmentObjModel).ToNot(BeNil()) enrichmentObjModel.Catalog = core.StringPtr("iceberg_data") enrichmentObjModel.Operation = core.StringPtr("create") - enrichmentObjModel.Schema = core.StringPtr("testString") - enrichmentObjModel.Tables = []string{"testString"} + enrichmentObjModel.Schema = core.StringPtr("schema1") + enrichmentObjModel.Tables = []string{"table1"} Expect(enrichmentObjModel.Catalog).To(Equal(core.StringPtr("iceberg_data"))) Expect(enrichmentObjModel.Operation).To(Equal(core.StringPtr("create"))) - Expect(enrichmentObjModel.Schema).To(Equal(core.StringPtr("testString"))) - Expect(enrichmentObjModel.Tables).To(Equal([]string{"testString"})) + Expect(enrichmentObjModel.Schema).To(Equal(core.StringPtr("schema1"))) + Expect(enrichmentObjModel.Tables).To(Equal([]string{"table1"})) // Construct an instance of the CreateSalIntegrationEnrichmentOptions model createSalIntegrationEnrichmentOptionsModel := watsonxDataService.NewCreateSalIntegrationEnrichmentOptions() - createSalIntegrationEnrichmentOptionsModel.SetEnrichmentPrototype(enrichmentObjModel) + createSalIntegrationEnrichmentOptionsModel.SetChanges([]watsonxdatav3.EnrichmentObj{*enrichmentObjModel}) createSalIntegrationEnrichmentOptionsModel.SetAuthInstanceID("testString") createSalIntegrationEnrichmentOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createSalIntegrationEnrichmentOptionsModel).ToNot(BeNil()) - Expect(createSalIntegrationEnrichmentOptionsModel.EnrichmentPrototype).To(Equal(enrichmentObjModel)) + Expect(createSalIntegrationEnrichmentOptionsModel.Changes).To(Equal([]watsonxdatav3.EnrichmentObj{*enrichmentObjModel})) Expect(createSalIntegrationEnrichmentOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createSalIntegrationEnrichmentOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewCreateSalIntegrationEnrichmentSettingsOptions successfully`, func() { - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel).ToNot(BeNil()) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) - salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.AssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.14)))) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel.SuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.9)))) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration model - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel).ToNot(BeNil()) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) - salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.AssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.1)))) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel.SuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.1)))) - - // Construct an instance of the SalIntegrationEnrichmentSettingsSemanticExpansion model - salIntegrationEnrichmentSettingsSemanticExpansionModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionModel).ToNot(BeNil()) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGeneration = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGenerationConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansion = core.BoolPtr(true) - salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansionConfiguration = salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel - Expect(salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGeneration).To(Equal(core.BoolPtr(true))) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionModel.DescriptionGenerationConfiguration).To(Equal(salIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfigurationModel)) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansion).To(Equal(core.BoolPtr(true))) - Expect(salIntegrationEnrichmentSettingsSemanticExpansionModel.NameExpansionConfiguration).To(Equal(salIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfigurationModel)) - - // Construct an instance of the SalIntegrationEnrichmentSettingsTermAssignment model - salIntegrationEnrichmentSettingsTermAssignmentModel := new(watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel).ToNot(BeNil()) - salIntegrationEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) - salIntegrationEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.NameMatching).To(Equal(core.BoolPtr(false))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.3)))) - Expect(salIntegrationEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.4)))) - - // Construct an instance of the CreateSalIntegrationEnrichmentSettingsOptions model - createSalIntegrationEnrichmentSettingsOptionsModel := watsonxDataService.NewCreateSalIntegrationEnrichmentSettingsOptions() - createSalIntegrationEnrichmentSettingsOptionsModel.SetSemanticExpansion(salIntegrationEnrichmentSettingsSemanticExpansionModel) - createSalIntegrationEnrichmentSettingsOptionsModel.SetTermAssignment(salIntegrationEnrichmentSettingsTermAssignmentModel) - createSalIntegrationEnrichmentSettingsOptionsModel.SetProjectID("testString") - createSalIntegrationEnrichmentSettingsOptionsModel.SetAuthInstanceID("testString") - createSalIntegrationEnrichmentSettingsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(createSalIntegrationEnrichmentSettingsOptionsModel).ToNot(BeNil()) - Expect(createSalIntegrationEnrichmentSettingsOptionsModel.SemanticExpansion).To(Equal(salIntegrationEnrichmentSettingsSemanticExpansionModel)) - Expect(createSalIntegrationEnrichmentSettingsOptionsModel.TermAssignment).To(Equal(salIntegrationEnrichmentSettingsTermAssignmentModel)) - Expect(createSalIntegrationEnrichmentSettingsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) - Expect(createSalIntegrationEnrichmentSettingsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createSalIntegrationEnrichmentSettingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewCreateSalIntegrationOptions successfully`, func() { // Construct an instance of the CreateSalIntegrationOptions model - createSalIntegrationOptionsApikey := "12efd3raq" + createSalIntegrationOptionsApikey := "67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK" createSalIntegrationOptionsEngineID := "presto-01" createSalIntegrationOptionsModel := watsonxDataService.NewCreateSalIntegrationOptions(createSalIntegrationOptionsApikey, createSalIntegrationOptionsEngineID) - createSalIntegrationOptionsModel.SetApikey("12efd3raq") + createSalIntegrationOptionsModel.SetApikey("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") createSalIntegrationOptionsModel.SetEngineID("presto-01") createSalIntegrationOptionsModel.SetStorageResourceCrn("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161") createSalIntegrationOptionsModel.SetStorageType("bmcos_object_storage") @@ -36753,7 +39441,7 @@ var _ = Describe(`WatsonxDataV2`, func() { createSalIntegrationOptionsModel.SetAuthInstanceID("testString") createSalIntegrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createSalIntegrationOptionsModel).ToNot(BeNil()) - Expect(createSalIntegrationOptionsModel.Apikey).To(Equal(core.StringPtr("12efd3raq"))) + Expect(createSalIntegrationOptionsModel.Apikey).To(Equal(core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK"))) Expect(createSalIntegrationOptionsModel.EngineID).To(Equal(core.StringPtr("presto-01"))) Expect(createSalIntegrationOptionsModel.StorageResourceCrn).To(Equal(core.StringPtr("crn:v1:staging:public:cloud-object-storage:global:a/a7026b374f39f570d20984c1ac6ecf63:5778e94f-c8c7-46a8-9878-d5eeadb51161"))) Expect(createSalIntegrationOptionsModel.StorageType).To(Equal(core.StringPtr("bmcos_object_storage"))) @@ -36780,71 +39468,104 @@ var _ = Describe(`WatsonxDataV2`, func() { It(`Invoke NewCreateSchemaOptions successfully`, func() { // Construct an instance of the CreateSchemaOptions model engineID := "testString" - catalogID := "testString" + id := "testString" createSchemaOptionsCustomPath := "sample-path" - createSchemaOptionsSchemaName := "SampleSchema1" - createSchemaOptionsModel := watsonxDataService.NewCreateSchemaOptions(engineID, catalogID, createSchemaOptionsCustomPath, createSchemaOptionsSchemaName) + createSchemaOptionsName := "SampleSchema1" + createSchemaOptionsModel := watsonxDataService.NewCreateSchemaOptions(engineID, id, createSchemaOptionsCustomPath, createSchemaOptionsName) createSchemaOptionsModel.SetEngineID("testString") - createSchemaOptionsModel.SetCatalogID("testString") + createSchemaOptionsModel.SetID("testString") createSchemaOptionsModel.SetCustomPath("sample-path") - createSchemaOptionsModel.SetSchemaName("SampleSchema1") - createSchemaOptionsModel.SetBucketName("sample-bucket") + createSchemaOptionsModel.SetName("SampleSchema1") createSchemaOptionsModel.SetHostname("db2@hostname.com") createSchemaOptionsModel.SetPort(int64(4553)) + createSchemaOptionsModel.SetStorageName("sample-bucket") createSchemaOptionsModel.SetAuthInstanceID("testString") createSchemaOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createSchemaOptionsModel).ToNot(BeNil()) Expect(createSchemaOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(createSchemaOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(createSchemaOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(createSchemaOptionsModel.CustomPath).To(Equal(core.StringPtr("sample-path"))) - Expect(createSchemaOptionsModel.SchemaName).To(Equal(core.StringPtr("SampleSchema1"))) - Expect(createSchemaOptionsModel.BucketName).To(Equal(core.StringPtr("sample-bucket"))) + Expect(createSchemaOptionsModel.Name).To(Equal(core.StringPtr("SampleSchema1"))) Expect(createSchemaOptionsModel.Hostname).To(Equal(core.StringPtr("db2@hostname.com"))) Expect(createSchemaOptionsModel.Port).To(Equal(core.Int64Ptr(int64(4553)))) + Expect(createSchemaOptionsModel.StorageName).To(Equal(core.StringPtr("sample-bucket"))) Expect(createSchemaOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createSchemaOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreateSemanticSearchQueriesOptions successfully`, func() { + // Construct an instance of the SemanticSearchBodySearchConfig model + semanticSearchBodySearchConfigModel := new(watsonxdatav3.SemanticSearchBodySearchConfig) + Expect(semanticSearchBodySearchConfigModel).ToNot(BeNil()) + semanticSearchBodySearchConfigModel.ColumnSearchEnabled = core.BoolPtr(true) + semanticSearchBodySearchConfigModel.Fields = []string{"metadata.name", "metadata.description", "metadata.tags"} + semanticSearchBodySearchConfigModel.MaxResultNumber = core.Int64Ptr(int64(1)) + semanticSearchBodySearchConfigModel.SchemaSearchEnabled = core.BoolPtr(true) + Expect(semanticSearchBodySearchConfigModel.ColumnSearchEnabled).To(Equal(core.BoolPtr(true))) + Expect(semanticSearchBodySearchConfigModel.Fields).To(Equal([]string{"metadata.name", "metadata.description", "metadata.tags"})) + Expect(semanticSearchBodySearchConfigModel.MaxResultNumber).To(Equal(core.Int64Ptr(int64(1)))) + Expect(semanticSearchBodySearchConfigModel.SchemaSearchEnabled).To(Equal(core.BoolPtr(true))) + + // Construct an instance of the CreateSemanticSearchQueriesOptions model + createSemanticSearchQueriesOptionsEngineID := "presto01" + createSemanticSearchQueriesOptionsQueryInput := "catalog_table" + createSemanticSearchQueriesOptionsModel := watsonxDataService.NewCreateSemanticSearchQueriesOptions(createSemanticSearchQueriesOptionsEngineID, createSemanticSearchQueriesOptionsQueryInput) + createSemanticSearchQueriesOptionsModel.SetEngineID("presto01") + createSemanticSearchQueriesOptionsModel.SetQueryInput("catalog_table") + createSemanticSearchQueriesOptionsModel.SetSearchConfig(semanticSearchBodySearchConfigModel) + createSemanticSearchQueriesOptionsModel.SetAuthInstanceID("testString") + createSemanticSearchQueriesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createSemanticSearchQueriesOptionsModel).ToNot(BeNil()) + Expect(createSemanticSearchQueriesOptionsModel.EngineID).To(Equal(core.StringPtr("presto01"))) + Expect(createSemanticSearchQueriesOptionsModel.QueryInput).To(Equal(core.StringPtr("catalog_table"))) + Expect(createSemanticSearchQueriesOptionsModel.SearchConfig).To(Equal(semanticSearchBodySearchConfigModel)) + Expect(createSemanticSearchQueriesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(createSemanticSearchQueriesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewCreateSparkEngineApplicationOptions successfully`, func() { - // Construct an instance of the SparkApplicationConfig model - sparkApplicationConfigModel := new(watsonxdatav2.SparkApplicationConfig) - Expect(sparkApplicationConfigModel).ToNot(BeNil()) - sparkApplicationConfigModel.SparkSampleConfigProperpty = core.StringPtr("testString") - Expect(sparkApplicationConfigModel.SparkSampleConfigProperpty).To(Equal(core.StringPtr("testString"))) - - // Construct an instance of the SparkApplicationEnv model - sparkApplicationEnvModel := new(watsonxdatav2.SparkApplicationEnv) - Expect(sparkApplicationEnvModel).ToNot(BeNil()) - sparkApplicationEnvModel.SampleEnvKey = core.StringPtr("testString") - Expect(sparkApplicationEnvModel.SampleEnvKey).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the SparkApplicationRuntime model + sparkApplicationRuntimeModel := new(watsonxdatav3.SparkApplicationRuntime) + Expect(sparkApplicationRuntimeModel).ToNot(BeNil()) + sparkApplicationRuntimeModel.SparkVersion = core.StringPtr("3.4") + Expect(sparkApplicationRuntimeModel.SparkVersion).To(Equal(core.StringPtr("3.4"))) // Construct an instance of the SparkApplicationDetails model - sparkApplicationDetailsModel := new(watsonxdatav2.SparkApplicationDetails) + sparkApplicationDetailsModel := new(watsonxdatav3.SparkApplicationDetails) Expect(sparkApplicationDetailsModel).ToNot(BeNil()) - sparkApplicationDetailsModel.Application = core.StringPtr("/opt/ibm/spark/examples/src/main/python/wordcount.py") - sparkApplicationDetailsModel.Arguments = []string{"/opt/ibm/spark/examples/src/main/resources/people.txt"} + sparkApplicationDetailsModel.Application = core.StringPtr("s3://mybucket/wordcount.py") + sparkApplicationDetailsModel.Archives = core.StringPtr("s3://mybucket/myarchive.zip") + sparkApplicationDetailsModel.Arguments = []string{"people.txt"} sparkApplicationDetailsModel.Class = core.StringPtr("org.apache.spark.examples.SparkPi") - sparkApplicationDetailsModel.Conf = sparkApplicationConfigModel - sparkApplicationDetailsModel.Env = sparkApplicationEnvModel + sparkApplicationDetailsModel.Conf = map[string]string{"key1": "configuration"} + sparkApplicationDetailsModel.Env = map[string]string{"key1": "configuration"} sparkApplicationDetailsModel.Files = core.StringPtr("s3://mybucket/myfile.txt") sparkApplicationDetailsModel.Jars = core.StringPtr("testString") sparkApplicationDetailsModel.Name = core.StringPtr("SparkApplicaton1") sparkApplicationDetailsModel.Packages = core.StringPtr("org.apache.spark:example_1.2.3") sparkApplicationDetailsModel.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") + sparkApplicationDetailsModel.Runtime = sparkApplicationRuntimeModel sparkApplicationDetailsModel.SparkVersion = core.StringPtr("3.3") - Expect(sparkApplicationDetailsModel.Application).To(Equal(core.StringPtr("/opt/ibm/spark/examples/src/main/python/wordcount.py"))) - Expect(sparkApplicationDetailsModel.Arguments).To(Equal([]string{"/opt/ibm/spark/examples/src/main/resources/people.txt"})) + Expect(sparkApplicationDetailsModel.Application).To(Equal(core.StringPtr("s3://mybucket/wordcount.py"))) + Expect(sparkApplicationDetailsModel.Archives).To(Equal(core.StringPtr("s3://mybucket/myarchive.zip"))) + Expect(sparkApplicationDetailsModel.Arguments).To(Equal([]string{"people.txt"})) Expect(sparkApplicationDetailsModel.Class).To(Equal(core.StringPtr("org.apache.spark.examples.SparkPi"))) - Expect(sparkApplicationDetailsModel.Conf).To(Equal(sparkApplicationConfigModel)) - Expect(sparkApplicationDetailsModel.Env).To(Equal(sparkApplicationEnvModel)) + Expect(sparkApplicationDetailsModel.Conf).To(Equal(map[string]string{"key1": "configuration"})) + Expect(sparkApplicationDetailsModel.Env).To(Equal(map[string]string{"key1": "configuration"})) Expect(sparkApplicationDetailsModel.Files).To(Equal(core.StringPtr("s3://mybucket/myfile.txt"))) Expect(sparkApplicationDetailsModel.Jars).To(Equal(core.StringPtr("testString"))) Expect(sparkApplicationDetailsModel.Name).To(Equal(core.StringPtr("SparkApplicaton1"))) Expect(sparkApplicationDetailsModel.Packages).To(Equal(core.StringPtr("org.apache.spark:example_1.2.3"))) Expect(sparkApplicationDetailsModel.Repositories).To(Equal(core.StringPtr("https://repo1.maven.org/maven2/"))) + Expect(sparkApplicationDetailsModel.Runtime).To(Equal(sparkApplicationRuntimeModel)) Expect(sparkApplicationDetailsModel.SparkVersion).To(Equal(core.StringPtr("3.3"))) + // Construct an instance of the SparkEngineApplicationCallback model + sparkEngineApplicationCallbackModel := new(watsonxdatav3.SparkEngineApplicationCallback) + Expect(sparkEngineApplicationCallbackModel).ToNot(BeNil()) + sparkEngineApplicationCallbackModel.URL = core.StringPtr("testString") + Expect(sparkEngineApplicationCallbackModel.URL).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the SparkVolumeDetails model - sparkVolumeDetailsModel := new(watsonxdatav2.SparkVolumeDetails) + sparkVolumeDetailsModel := new(watsonxdatav3.SparkVolumeDetails) Expect(sparkVolumeDetailsModel).ToNot(BeNil()) sparkVolumeDetailsModel.MountPath = core.StringPtr("/mount/path") sparkVolumeDetailsModel.Name = core.StringPtr("my-volume") @@ -36856,127 +39577,302 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(sparkVolumeDetailsModel.SourceSubPath).To(Equal(core.StringPtr("/source/path"))) // Construct an instance of the CreateSparkEngineApplicationOptions model - engineID := "testString" - var createSparkEngineApplicationOptionsApplicationDetails *watsonxdatav2.SparkApplicationDetails = nil - createSparkEngineApplicationOptionsModel := watsonxDataService.NewCreateSparkEngineApplicationOptions(engineID, createSparkEngineApplicationOptionsApplicationDetails) - createSparkEngineApplicationOptionsModel.SetEngineID("testString") + id := "testString" + var createSparkEngineApplicationOptionsApplicationDetails *watsonxdatav3.SparkApplicationDetails = nil + createSparkEngineApplicationOptionsModel := watsonxDataService.NewCreateSparkEngineApplicationOptions(id, createSparkEngineApplicationOptionsApplicationDetails) + createSparkEngineApplicationOptionsModel.SetID("testString") createSparkEngineApplicationOptionsModel.SetApplicationDetails(sparkApplicationDetailsModel) - createSparkEngineApplicationOptionsModel.SetJobEndpoint("testString") - createSparkEngineApplicationOptionsModel.SetServiceInstanceID("testString") - createSparkEngineApplicationOptionsModel.SetType("iae") - createSparkEngineApplicationOptionsModel.SetVolumes([]watsonxdatav2.SparkVolumeDetails{*sparkVolumeDetailsModel}) + createSparkEngineApplicationOptionsModel.SetCallback(sparkEngineApplicationCallbackModel) + createSparkEngineApplicationOptionsModel.SetContextID("testString") + createSparkEngineApplicationOptionsModel.SetContextType("project") + createSparkEngineApplicationOptionsModel.SetDeployMode("local") + createSparkEngineApplicationOptionsModel.SetIdempotencyKey("testString") + createSparkEngineApplicationOptionsModel.SetInitScripts([]string{"file://init_scripts/test.sh"}) + createSparkEngineApplicationOptionsModel.SetJobEndpoint("/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications") + createSparkEngineApplicationOptionsModel.SetMaxRetries("3") + createSparkEngineApplicationOptionsModel.SetMinRetryIntervalInSeconds("30") + createSparkEngineApplicationOptionsModel.SetServiceInstanceID("iae") + createSparkEngineApplicationOptionsModel.SetTimeoutInSeconds("60") + createSparkEngineApplicationOptionsModel.SetType("spark") + createSparkEngineApplicationOptionsModel.SetVolumes([]watsonxdatav3.SparkVolumeDetails{*sparkVolumeDetailsModel}) createSparkEngineApplicationOptionsModel.SetAuthInstanceID("testString") - createSparkEngineApplicationOptionsModel.SetState([]string{"testString"}) createSparkEngineApplicationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createSparkEngineApplicationOptionsModel).ToNot(BeNil()) - Expect(createSparkEngineApplicationOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(createSparkEngineApplicationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(createSparkEngineApplicationOptionsModel.ApplicationDetails).To(Equal(sparkApplicationDetailsModel)) - Expect(createSparkEngineApplicationOptionsModel.JobEndpoint).To(Equal(core.StringPtr("testString"))) - Expect(createSparkEngineApplicationOptionsModel.ServiceInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createSparkEngineApplicationOptionsModel.Type).To(Equal(core.StringPtr("iae"))) - Expect(createSparkEngineApplicationOptionsModel.Volumes).To(Equal([]watsonxdatav2.SparkVolumeDetails{*sparkVolumeDetailsModel})) + Expect(createSparkEngineApplicationOptionsModel.Callback).To(Equal(sparkEngineApplicationCallbackModel)) + Expect(createSparkEngineApplicationOptionsModel.ContextID).To(Equal(core.StringPtr("testString"))) + Expect(createSparkEngineApplicationOptionsModel.ContextType).To(Equal(core.StringPtr("project"))) + Expect(createSparkEngineApplicationOptionsModel.DeployMode).To(Equal(core.StringPtr("local"))) + Expect(createSparkEngineApplicationOptionsModel.IdempotencyKey).To(Equal(core.StringPtr("testString"))) + Expect(createSparkEngineApplicationOptionsModel.InitScripts).To(Equal([]string{"file://init_scripts/test.sh"})) + Expect(createSparkEngineApplicationOptionsModel.JobEndpoint).To(Equal(core.StringPtr("/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/engine_applications"))) + Expect(createSparkEngineApplicationOptionsModel.MaxRetries).To(Equal(core.StringPtr("3"))) + Expect(createSparkEngineApplicationOptionsModel.MinRetryIntervalInSeconds).To(Equal(core.StringPtr("30"))) + Expect(createSparkEngineApplicationOptionsModel.ServiceInstanceID).To(Equal(core.StringPtr("iae"))) + Expect(createSparkEngineApplicationOptionsModel.TimeoutInSeconds).To(Equal(core.StringPtr("60"))) + Expect(createSparkEngineApplicationOptionsModel.Type).To(Equal(core.StringPtr("spark"))) + Expect(createSparkEngineApplicationOptionsModel.Volumes).To(Equal([]watsonxdatav3.SparkVolumeDetails{*sparkVolumeDetailsModel})) Expect(createSparkEngineApplicationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(createSparkEngineApplicationOptionsModel.State).To(Equal([]string{"testString"})) Expect(createSparkEngineApplicationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateSparkEngineCatalogsOptions successfully`, func() { // Construct an instance of the CreateSparkEngineCatalogsOptions model - engineID := "testString" - createSparkEngineCatalogsOptionsModel := watsonxDataService.NewCreateSparkEngineCatalogsOptions(engineID) - createSparkEngineCatalogsOptionsModel.SetEngineID("testString") - createSparkEngineCatalogsOptionsModel.SetCatalogName("testString") + id := "testString" + createSparkEngineCatalogsOptionsCatalogNames := []string{"iceberg_catalog"} + createSparkEngineCatalogsOptionsModel := watsonxDataService.NewCreateSparkEngineCatalogsOptions(id, createSparkEngineCatalogsOptionsCatalogNames) + createSparkEngineCatalogsOptionsModel.SetID("testString") + createSparkEngineCatalogsOptionsModel.SetCatalogNames([]string{"iceberg_catalog"}) createSparkEngineCatalogsOptionsModel.SetAuthInstanceID("testString") createSparkEngineCatalogsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createSparkEngineCatalogsOptionsModel).ToNot(BeNil()) - Expect(createSparkEngineCatalogsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(createSparkEngineCatalogsOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(createSparkEngineCatalogsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(createSparkEngineCatalogsOptionsModel.CatalogNames).To(Equal([]string{"iceberg_catalog"})) Expect(createSparkEngineCatalogsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createSparkEngineCatalogsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewCreateSparkEngineOptions successfully`, func() { - // Construct an instance of the SparkDefaultConfig model - sparkDefaultConfigModel := new(watsonxdatav2.SparkDefaultConfig) - Expect(sparkDefaultConfigModel).ToNot(BeNil()) - sparkDefaultConfigModel.Config1 = core.StringPtr("testString") - sparkDefaultConfigModel.Config2 = core.StringPtr("testString") - Expect(sparkDefaultConfigModel.Config1).To(Equal(core.StringPtr("testString"))) - Expect(sparkDefaultConfigModel.Config2).To(Equal(core.StringPtr("testString"))) + // Construct an instance of the SparkEndpoints model + sparkEndpointsModel := new(watsonxdatav3.SparkEndpoints) + Expect(sparkEndpointsModel).ToNot(BeNil()) + sparkEndpointsModel.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id") + sparkEndpointsModel.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") + sparkEndpointsModel.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-instance_id") + sparkEndpointsModel.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") + sparkEndpointsModel.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") + sparkEndpointsModel.ViewHistoryServer = core.StringPtr("testString") + sparkEndpointsModel.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") + sparkEndpointsModel.WxdEngineEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817") + sparkEndpointsModel.WxdHistoryServerEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server") + sparkEndpointsModel.WxdHistoryServerUiEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server/ui") + Expect(sparkEndpointsModel.ApplicationsApi).To(Equal(core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id"))) + Expect(sparkEndpointsModel.HistoryServerEndpoint).To(Equal(core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server"))) + Expect(sparkEndpointsModel.SparkAccessEndpoint).To(Equal(core.StringPtr("$HOST/analytics-engine/details/spark-instance_id"))) + Expect(sparkEndpointsModel.SparkJobsV4Endpoint).To(Equal(core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications"))) + Expect(sparkEndpointsModel.SparkKernelEndpoint).To(Equal(core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels"))) + Expect(sparkEndpointsModel.ViewHistoryServer).To(Equal(core.StringPtr("testString"))) + Expect(sparkEndpointsModel.WxdApplicationEndpoint).To(Equal(core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications"))) + Expect(sparkEndpointsModel.WxdEngineEndpoint).To(Equal(core.StringPtr("$HOST/v1/1698311655308796/engines/spark817"))) + Expect(sparkEndpointsModel.WxdHistoryServerEndpoint).To(Equal(core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server"))) + Expect(sparkEndpointsModel.WxdHistoryServerUiEndpoint).To(Equal(core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server/ui"))) + + // Construct an instance of the SparkEngineHome model + sparkEngineHomeModel := new(watsonxdatav3.SparkEngineHome) + Expect(sparkEngineHomeModel).ToNot(BeNil()) + sparkEngineHomeModel.Path = core.StringPtr("spark/spark1234") + sparkEngineHomeModel.StorageName = core.StringPtr("test-spark-storage") + sparkEngineHomeModel.Volume = core.StringPtr("test-spark-volume") + sparkEngineHomeModel.VolumeID = core.StringPtr("1704979825978585") + sparkEngineHomeModel.VolumeName = core.StringPtr("my-volume") + Expect(sparkEngineHomeModel.Path).To(Equal(core.StringPtr("spark/spark1234"))) + Expect(sparkEngineHomeModel.StorageName).To(Equal(core.StringPtr("test-spark-storage"))) + Expect(sparkEngineHomeModel.Volume).To(Equal(core.StringPtr("test-spark-volume"))) + Expect(sparkEngineHomeModel.VolumeID).To(Equal(core.StringPtr("1704979825978585"))) + Expect(sparkEngineHomeModel.VolumeName).To(Equal(core.StringPtr("my-volume"))) + + // Construct an instance of the SparkEngineResourceLimit model + sparkEngineResourceLimitModel := new(watsonxdatav3.SparkEngineResourceLimit) + Expect(sparkEngineResourceLimitModel).ToNot(BeNil()) + sparkEngineResourceLimitModel.Cores = core.StringPtr("1") + sparkEngineResourceLimitModel.Memory = core.StringPtr("4G") + Expect(sparkEngineResourceLimitModel.Cores).To(Equal(core.StringPtr("1"))) + Expect(sparkEngineResourceLimitModel.Memory).To(Equal(core.StringPtr("4G"))) + + // Construct an instance of the SparkEngineResourceUtilisation model + sparkEngineResourceUtilisationModel := new(watsonxdatav3.SparkEngineResourceUtilisation) + Expect(sparkEngineResourceUtilisationModel).ToNot(BeNil()) + sparkEngineResourceUtilisationModel.Cores = core.StringPtr("1m") + sparkEngineResourceUtilisationModel.Memory = core.StringPtr("4Gi") + Expect(sparkEngineResourceUtilisationModel.Cores).To(Equal(core.StringPtr("1m"))) + Expect(sparkEngineResourceUtilisationModel.Memory).To(Equal(core.StringPtr("4Gi"))) // Construct an instance of the SparkScaleConfig model - sparkScaleConfigModel := new(watsonxdatav2.SparkScaleConfig) + sparkScaleConfigModel := new(watsonxdatav3.SparkScaleConfig) Expect(sparkScaleConfigModel).ToNot(BeNil()) sparkScaleConfigModel.AutoScaleEnabled = core.BoolPtr(true) sparkScaleConfigModel.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) sparkScaleConfigModel.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) sparkScaleConfigModel.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) - sparkScaleConfigModel.NodeType = core.StringPtr("small") - sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(5)) + sparkScaleConfigModel.NodeType = core.StringPtr("medium") + sparkScaleConfigModel.NumberOfNodes = core.Int64Ptr(int64(2)) Expect(sparkScaleConfigModel.AutoScaleEnabled).To(Equal(core.BoolPtr(true))) Expect(sparkScaleConfigModel.CurrentNumberOfNodes).To(Equal(core.Int64Ptr(int64(2)))) Expect(sparkScaleConfigModel.MaximumNumberOfNodes).To(Equal(core.Int64Ptr(int64(5)))) Expect(sparkScaleConfigModel.MinimumNumberOfNodes).To(Equal(core.Int64Ptr(int64(1)))) - Expect(sparkScaleConfigModel.NodeType).To(Equal(core.StringPtr("small"))) - Expect(sparkScaleConfigModel.NumberOfNodes).To(Equal(core.Int64Ptr(int64(5)))) - - // Construct an instance of the SparkEngineDetailsPrototype model - sparkEngineDetailsPrototypeModel := new(watsonxdatav2.SparkEngineDetailsPrototype) - Expect(sparkEngineDetailsPrototypeModel).ToNot(BeNil()) - sparkEngineDetailsPrototypeModel.ApiKey = core.StringPtr("apikey") - sparkEngineDetailsPrototypeModel.ConnectionString = core.StringPtr("1.2.3.4") - sparkEngineDetailsPrototypeModel.DefaultConfig = sparkDefaultConfigModel - sparkEngineDetailsPrototypeModel.DefaultVersion = core.StringPtr("3.3") - sparkEngineDetailsPrototypeModel.EngineHomeBucketDisplayName = core.StringPtr("test-spark-bucket") - sparkEngineDetailsPrototypeModel.EngineHomeBucketName = core.StringPtr("4fec0f8b-888a-4c16-8f38-250c8499e6ce-customer") - sparkEngineDetailsPrototypeModel.EngineHomePath = core.StringPtr("spark/spark1234") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeID = core.StringPtr("1704979825978585") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeName = core.StringPtr("my-volume") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageClass = core.StringPtr("nfs-client") - sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageSize = core.StringPtr("5Gi") - sparkEngineDetailsPrototypeModel.EngineSubType = core.StringPtr("java/cpp") - sparkEngineDetailsPrototypeModel.InstanceID = core.StringPtr("spark-id") - sparkEngineDetailsPrototypeModel.ManagedBy = core.StringPtr("fully/self") - sparkEngineDetailsPrototypeModel.ScaleConfig = sparkScaleConfigModel - Expect(sparkEngineDetailsPrototypeModel.ApiKey).To(Equal(core.StringPtr("apikey"))) - Expect(sparkEngineDetailsPrototypeModel.ConnectionString).To(Equal(core.StringPtr("1.2.3.4"))) - Expect(sparkEngineDetailsPrototypeModel.DefaultConfig).To(Equal(sparkDefaultConfigModel)) - Expect(sparkEngineDetailsPrototypeModel.DefaultVersion).To(Equal(core.StringPtr("3.3"))) - Expect(sparkEngineDetailsPrototypeModel.EngineHomeBucketDisplayName).To(Equal(core.StringPtr("test-spark-bucket"))) - Expect(sparkEngineDetailsPrototypeModel.EngineHomeBucketName).To(Equal(core.StringPtr("4fec0f8b-888a-4c16-8f38-250c8499e6ce-customer"))) - Expect(sparkEngineDetailsPrototypeModel.EngineHomePath).To(Equal(core.StringPtr("spark/spark1234"))) - Expect(sparkEngineDetailsPrototypeModel.EngineHomeVolumeID).To(Equal(core.StringPtr("1704979825978585"))) - Expect(sparkEngineDetailsPrototypeModel.EngineHomeVolumeName).To(Equal(core.StringPtr("my-volume"))) - Expect(sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageClass).To(Equal(core.StringPtr("nfs-client"))) - Expect(sparkEngineDetailsPrototypeModel.EngineHomeVolumeStorageSize).To(Equal(core.StringPtr("5Gi"))) - Expect(sparkEngineDetailsPrototypeModel.EngineSubType).To(Equal(core.StringPtr("java/cpp"))) - Expect(sparkEngineDetailsPrototypeModel.InstanceID).To(Equal(core.StringPtr("spark-id"))) - Expect(sparkEngineDetailsPrototypeModel.ManagedBy).To(Equal(core.StringPtr("fully/self"))) - Expect(sparkEngineDetailsPrototypeModel.ScaleConfig).To(Equal(sparkScaleConfigModel)) + Expect(sparkScaleConfigModel.NodeType).To(Equal(core.StringPtr("medium"))) + Expect(sparkScaleConfigModel.NumberOfNodes).To(Equal(core.Int64Ptr(int64(2)))) + + // Construct an instance of the SparkVscodeConfig model + sparkVscodeConfigModel := new(watsonxdatav3.SparkVscodeConfig) + Expect(sparkVscodeConfigModel).ToNot(BeNil()) + sparkVscodeConfigModel.Crn = core.StringPtr("crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2") + sparkVscodeConfigModel.EnvironmentType = core.StringPtr("SaaS") + sparkVscodeConfigModel.Host = core.StringPtr("us-south.lakehouse.dev.cloud.ibm.com") + sparkVscodeConfigModel.UserName = core.StringPtr("user@example.com") + Expect(sparkVscodeConfigModel.Crn).To(Equal(core.StringPtr("crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2"))) + Expect(sparkVscodeConfigModel.EnvironmentType).To(Equal(core.StringPtr("SaaS"))) + Expect(sparkVscodeConfigModel.Host).To(Equal(core.StringPtr("us-south.lakehouse.dev.cloud.ibm.com"))) + Expect(sparkVscodeConfigModel.UserName).To(Equal(core.StringPtr("user@example.com"))) + + // Construct an instance of the SparkEngineDetails model + sparkEngineDetailsModel := new(watsonxdatav3.SparkEngineDetails) + Expect(sparkEngineDetailsModel).ToNot(BeNil()) + sparkEngineDetailsModel.ApiKey = core.StringPtr("apikey") + sparkEngineDetailsModel.ConnectionString = core.StringPtr("https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id") + sparkEngineDetailsModel.DefaultConfig = map[string]string{"key1": "configuration"} + sparkEngineDetailsModel.DefaultVersion = core.StringPtr("4.8.3") + sparkEngineDetailsModel.Endpoints = sparkEndpointsModel + sparkEngineDetailsModel.EngineHome = sparkEngineHomeModel + sparkEngineDetailsModel.EngineSubType = core.StringPtr("java") + sparkEngineDetailsModel.InstanceID = core.StringPtr("spark-id") + sparkEngineDetailsModel.ManagedBy = core.StringPtr("fully") + sparkEngineDetailsModel.ResourceLimitEnabled = core.BoolPtr(true) + sparkEngineDetailsModel.ResourceLimits = sparkEngineResourceLimitModel + sparkEngineDetailsModel.ResourceUtilisation = sparkEngineResourceUtilisationModel + sparkEngineDetailsModel.ScaleConfig = sparkScaleConfigModel + sparkEngineDetailsModel.VscodeConfig = sparkVscodeConfigModel + Expect(sparkEngineDetailsModel.ApiKey).To(Equal(core.StringPtr("apikey"))) + Expect(sparkEngineDetailsModel.ConnectionString).To(Equal(core.StringPtr("https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id"))) + Expect(sparkEngineDetailsModel.DefaultConfig).To(Equal(map[string]string{"key1": "configuration"})) + Expect(sparkEngineDetailsModel.DefaultVersion).To(Equal(core.StringPtr("4.8.3"))) + Expect(sparkEngineDetailsModel.Endpoints).To(Equal(sparkEndpointsModel)) + Expect(sparkEngineDetailsModel.EngineHome).To(Equal(sparkEngineHomeModel)) + Expect(sparkEngineDetailsModel.EngineSubType).To(Equal(core.StringPtr("java"))) + Expect(sparkEngineDetailsModel.InstanceID).To(Equal(core.StringPtr("spark-id"))) + Expect(sparkEngineDetailsModel.ManagedBy).To(Equal(core.StringPtr("fully"))) + Expect(sparkEngineDetailsModel.ResourceLimitEnabled).To(Equal(core.BoolPtr(true))) + Expect(sparkEngineDetailsModel.ResourceLimits).To(Equal(sparkEngineResourceLimitModel)) + Expect(sparkEngineDetailsModel.ResourceUtilisation).To(Equal(sparkEngineResourceUtilisationModel)) + Expect(sparkEngineDetailsModel.ScaleConfig).To(Equal(sparkScaleConfigModel)) + Expect(sparkEngineDetailsModel.VscodeConfig).To(Equal(sparkVscodeConfigModel)) // Construct an instance of the CreateSparkEngineOptions model - createSparkEngineOptionsOrigin := "native" - createSparkEngineOptionsModel := watsonxDataService.NewCreateSparkEngineOptions(createSparkEngineOptionsOrigin) - createSparkEngineOptionsModel.SetOrigin("native") - createSparkEngineOptionsModel.SetAssociatedCatalogs([]string{"iceberg-data"}) - createSparkEngineOptionsModel.SetDescription("testString") - createSparkEngineOptionsModel.SetEngineDetails(sparkEngineDetailsPrototypeModel) - createSparkEngineOptionsModel.SetEngineDisplayName("test-native") - createSparkEngineOptionsModel.SetStatus("testString") - createSparkEngineOptionsModel.SetTags([]string{"testString"}) + createSparkEngineOptionsDisplayName := "sampleEngine" + createSparkEngineOptionsOrigin := "external" + createSparkEngineOptionsModel := watsonxDataService.NewCreateSparkEngineOptions(createSparkEngineOptionsDisplayName, createSparkEngineOptionsOrigin) + createSparkEngineOptionsModel.SetDisplayName("sampleEngine") + createSparkEngineOptionsModel.SetOrigin("external") + createSparkEngineOptionsModel.SetAssociatedCatalogs([]string{"iceberg_data", "hive_data"}) + createSparkEngineOptionsModel.SetConfiguration(sparkEngineDetailsModel) + createSparkEngineOptionsModel.SetDescription("spark engine description") + createSparkEngineOptionsModel.SetID("spark123") + createSparkEngineOptionsModel.SetStatus("provisioning") + createSparkEngineOptionsModel.SetTags([]string{"tag1", "tag2"}) createSparkEngineOptionsModel.SetType("spark") createSparkEngineOptionsModel.SetAuthInstanceID("testString") createSparkEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(createSparkEngineOptionsModel).ToNot(BeNil()) - Expect(createSparkEngineOptionsModel.Origin).To(Equal(core.StringPtr("native"))) - Expect(createSparkEngineOptionsModel.AssociatedCatalogs).To(Equal([]string{"iceberg-data"})) - Expect(createSparkEngineOptionsModel.Description).To(Equal(core.StringPtr("testString"))) - Expect(createSparkEngineOptionsModel.EngineDetails).To(Equal(sparkEngineDetailsPrototypeModel)) - Expect(createSparkEngineOptionsModel.EngineDisplayName).To(Equal(core.StringPtr("test-native"))) - Expect(createSparkEngineOptionsModel.Status).To(Equal(core.StringPtr("testString"))) - Expect(createSparkEngineOptionsModel.Tags).To(Equal([]string{"testString"})) + Expect(createSparkEngineOptionsModel.DisplayName).To(Equal(core.StringPtr("sampleEngine"))) + Expect(createSparkEngineOptionsModel.Origin).To(Equal(core.StringPtr("external"))) + Expect(createSparkEngineOptionsModel.AssociatedCatalogs).To(Equal([]string{"iceberg_data", "hive_data"})) + Expect(createSparkEngineOptionsModel.Configuration).To(Equal(sparkEngineDetailsModel)) + Expect(createSparkEngineOptionsModel.Description).To(Equal(core.StringPtr("spark engine description"))) + Expect(createSparkEngineOptionsModel.ID).To(Equal(core.StringPtr("spark123"))) + Expect(createSparkEngineOptionsModel.Status).To(Equal(core.StringPtr("provisioning"))) + Expect(createSparkEngineOptionsModel.Tags).To(Equal([]string{"tag1", "tag2"})) Expect(createSparkEngineOptionsModel.Type).To(Equal(core.StringPtr("spark"))) Expect(createSparkEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(createSparkEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewCreateStorageRegistrationOptions successfully`, func() { + // Construct an instance of the StorageCatalogPrototype model + storageCatalogPrototypeModel := new(watsonxdatav3.StorageCatalogPrototype) + Expect(storageCatalogPrototypeModel).ToNot(BeNil()) + storageCatalogPrototypeModel.BasePath = core.StringPtr("/abc/def") + storageCatalogPrototypeModel.CatalogName = core.StringPtr("sampleCatalog") + storageCatalogPrototypeModel.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + storageCatalogPrototypeModel.CatalogType = core.StringPtr("iceberg") + Expect(storageCatalogPrototypeModel.BasePath).To(Equal(core.StringPtr("/abc/def"))) + Expect(storageCatalogPrototypeModel.CatalogName).To(Equal(core.StringPtr("sampleCatalog"))) + Expect(storageCatalogPrototypeModel.CatalogTags).To(Equal([]string{"catalog_tag_1", "catalog_tag_2"})) + Expect(storageCatalogPrototypeModel.CatalogType).To(Equal(core.StringPtr("iceberg"))) + + // Construct an instance of the StorageDetailsAccesskeyVault model + storageDetailsAccesskeyVaultModel := new(watsonxdatav3.StorageDetailsAccesskeyVault) + Expect(storageDetailsAccesskeyVaultModel).ToNot(BeNil()) + storageDetailsAccesskeyVaultModel.Key = core.StringPtr("secret key") + storageDetailsAccesskeyVaultModel.SecretName = core.StringPtr("secret name") + storageDetailsAccesskeyVaultModel.SecretUrn = core.StringPtr("secret urn") + Expect(storageDetailsAccesskeyVaultModel.Key).To(Equal(core.StringPtr("secret key"))) + Expect(storageDetailsAccesskeyVaultModel.SecretName).To(Equal(core.StringPtr("secret name"))) + Expect(storageDetailsAccesskeyVaultModel.SecretUrn).To(Equal(core.StringPtr("secret urn"))) + + // Construct an instance of the StorageDetails model + storageDetailsModel := new(watsonxdatav3.StorageDetails) + Expect(storageDetailsModel).ToNot(BeNil()) + storageDetailsModel.AccessKey = core.StringPtr("") + storageDetailsModel.AccessKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.AccountName = core.StringPtr("sample-storage") + storageDetailsModel.ApplicationID = core.StringPtr("application-id") + storageDetailsModel.AuthMode = core.StringPtr("iam") + storageDetailsModel.ContainerName = core.StringPtr("sample-container") + storageDetailsModel.DirectoryID = core.StringPtr("directory-id") + storageDetailsModel.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + storageDetailsModel.KeyFile = core.StringPtr("key_file") + storageDetailsModel.Name = core.StringPtr("sample-storage") + storageDetailsModel.Provider = core.StringPtr("ibm-cos") + storageDetailsModel.Region = core.StringPtr("us-south") + storageDetailsModel.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + storageDetailsModel.SasToken = core.StringPtr("") + storageDetailsModel.SecretKey = core.StringPtr("secret_key") + storageDetailsModel.SecretKeyVault = storageDetailsAccesskeyVaultModel + storageDetailsModel.VaultEnabled = core.BoolPtr(true) + Expect(storageDetailsModel.AccessKey).To(Equal(core.StringPtr(""))) + Expect(storageDetailsModel.AccessKeyVault).To(Equal(storageDetailsAccesskeyVaultModel)) + Expect(storageDetailsModel.AccountName).To(Equal(core.StringPtr("sample-storage"))) + Expect(storageDetailsModel.ApplicationID).To(Equal(core.StringPtr("application-id"))) + Expect(storageDetailsModel.AuthMode).To(Equal(core.StringPtr("iam"))) + Expect(storageDetailsModel.ContainerName).To(Equal(core.StringPtr("sample-container"))) + Expect(storageDetailsModel.DirectoryID).To(Equal(core.StringPtr("directory-id"))) + Expect(storageDetailsModel.Endpoint).To(Equal(core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/"))) + Expect(storageDetailsModel.KeyFile).To(Equal(core.StringPtr("key_file"))) + Expect(storageDetailsModel.Name).To(Equal(core.StringPtr("sample-storage"))) + Expect(storageDetailsModel.Provider).To(Equal(core.StringPtr("ibm-cos"))) + Expect(storageDetailsModel.Region).To(Equal(core.StringPtr("us-south"))) + Expect(storageDetailsModel.RoleArn).To(Equal(core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9"))) + Expect(storageDetailsModel.SasToken).To(Equal(core.StringPtr(""))) + Expect(storageDetailsModel.SecretKey).To(Equal(core.StringPtr("secret_key"))) + Expect(storageDetailsModel.SecretKeyVault).To(Equal(storageDetailsAccesskeyVaultModel)) + Expect(storageDetailsModel.VaultEnabled).To(Equal(core.BoolPtr(true))) + + // Construct an instance of the CreateStorageRegistrationOptions model + createStorageRegistrationOptionsDescription := "COS storage for customer data" + createStorageRegistrationOptionsDisplayName := "sample-storage-displayname" + createStorageRegistrationOptionsManagedBy := "ibm" + createStorageRegistrationOptionsType := "ibm_cos" + createStorageRegistrationOptionsModel := watsonxDataService.NewCreateStorageRegistrationOptions(createStorageRegistrationOptionsDescription, createStorageRegistrationOptionsDisplayName, createStorageRegistrationOptionsManagedBy, createStorageRegistrationOptionsType) + createStorageRegistrationOptionsModel.SetDescription("COS storage for customer data") + createStorageRegistrationOptionsModel.SetDisplayName("sample-storage-displayname") + createStorageRegistrationOptionsModel.SetManagedBy("ibm") + createStorageRegistrationOptionsModel.SetType("ibm_cos") + createStorageRegistrationOptionsModel.SetAssociatedCatalog(storageCatalogPrototypeModel) + createStorageRegistrationOptionsModel.SetConnection(storageDetailsModel) + createStorageRegistrationOptionsModel.SetRegion("us-south") + createStorageRegistrationOptionsModel.SetStorageUse("acl") + createStorageRegistrationOptionsModel.SetTags([]string{"storage-tag1", "storage-tag2"}) + createStorageRegistrationOptionsModel.SetAuthInstanceID("testString") + createStorageRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(createStorageRegistrationOptionsModel).ToNot(BeNil()) + Expect(createStorageRegistrationOptionsModel.Description).To(Equal(core.StringPtr("COS storage for customer data"))) + Expect(createStorageRegistrationOptionsModel.DisplayName).To(Equal(core.StringPtr("sample-storage-displayname"))) + Expect(createStorageRegistrationOptionsModel.ManagedBy).To(Equal(core.StringPtr("ibm"))) + Expect(createStorageRegistrationOptionsModel.Type).To(Equal(core.StringPtr("ibm_cos"))) + Expect(createStorageRegistrationOptionsModel.AssociatedCatalog).To(Equal(storageCatalogPrototypeModel)) + Expect(createStorageRegistrationOptionsModel.Connection).To(Equal(storageDetailsModel)) + Expect(createStorageRegistrationOptionsModel.Region).To(Equal(core.StringPtr("us-south"))) + Expect(createStorageRegistrationOptionsModel.StorageUse).To(Equal(core.StringPtr("acl"))) + Expect(createStorageRegistrationOptionsModel.Tags).To(Equal([]string{"storage-tag1", "storage-tag2"})) + Expect(createStorageRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(createStorageRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems successfully`, func() { + encrypt := true + key := "hive.metastore" + value := "glue" + _model, err := watsonxDataService.NewDatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems(encrypt, key, value) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewDatabaseRegistrationPrototypeDatabasePropertiesItems successfully`, func() { encrypt := true key := "hive.metastore" @@ -36985,202 +39881,181 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewDeleteBucketRegistrationOptions successfully`, func() { - // Construct an instance of the DeleteBucketRegistrationOptions model - bucketID := "testString" - deleteBucketRegistrationOptionsModel := watsonxDataService.NewDeleteBucketRegistrationOptions(bucketID) - deleteBucketRegistrationOptionsModel.SetBucketID("testString") - deleteBucketRegistrationOptionsModel.SetAuthInstanceID("testString") - deleteBucketRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteBucketRegistrationOptionsModel).ToNot(BeNil()) - Expect(deleteBucketRegistrationOptionsModel.BucketID).To(Equal(core.StringPtr("testString"))) - Expect(deleteBucketRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(deleteBucketRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + It(`Invoke NewDb2EngineDetailsBody successfully`, func() { + connectionString := "1.2.3.4" + _model, err := watsonxDataService.NewDb2EngineDetailsBody(connectionString) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewDeleteCatalogOptions successfully`, func() { + // Construct an instance of the DeleteCatalogOptions model + name := "testString" + deleteCatalogOptionsModel := watsonxDataService.NewDeleteCatalogOptions(name) + deleteCatalogOptionsModel.SetName("testString") + deleteCatalogOptionsModel.SetAuthInstanceID("testString") + deleteCatalogOptionsModel.SetSkipMdsCall(false) + deleteCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteCatalogOptionsModel).ToNot(BeNil()) + Expect(deleteCatalogOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(deleteCatalogOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteCatalogOptionsModel.SkipMdsCall).To(Equal(core.BoolPtr(false))) + Expect(deleteCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteColumnOptions successfully`, func() { // Construct an instance of the DeleteColumnOptions model engineID := "testString" - catalogID := "testString" - schemaID := "testString" - tableID := "testString" - columnID := "testString" - deleteColumnOptionsModel := watsonxDataService.NewDeleteColumnOptions(engineID, catalogID, schemaID, tableID, columnID) + catalogName := "testString" + schemaName := "testString" + tableName := "testString" + columnName := "testString" + deleteColumnOptionsModel := watsonxDataService.NewDeleteColumnOptions(engineID, catalogName, schemaName, tableName, columnName) deleteColumnOptionsModel.SetEngineID("testString") - deleteColumnOptionsModel.SetCatalogID("testString") - deleteColumnOptionsModel.SetSchemaID("testString") - deleteColumnOptionsModel.SetTableID("testString") - deleteColumnOptionsModel.SetColumnID("testString") + deleteColumnOptionsModel.SetCatalogName("testString") + deleteColumnOptionsModel.SetSchemaName("testString") + deleteColumnOptionsModel.SetTableName("testString") + deleteColumnOptionsModel.SetColumnName("testString") deleteColumnOptionsModel.SetAuthInstanceID("testString") deleteColumnOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteColumnOptionsModel).ToNot(BeNil()) Expect(deleteColumnOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(deleteColumnOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(deleteColumnOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) - Expect(deleteColumnOptionsModel.TableID).To(Equal(core.StringPtr("testString"))) - Expect(deleteColumnOptionsModel.ColumnID).To(Equal(core.StringPtr("testString"))) + Expect(deleteColumnOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(deleteColumnOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(deleteColumnOptionsModel.TableName).To(Equal(core.StringPtr("testString"))) + Expect(deleteColumnOptionsModel.ColumnName).To(Equal(core.StringPtr("testString"))) Expect(deleteColumnOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteColumnOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteDataPoliciesOptions successfully`, func() { + // Construct an instance of the DeleteDataPoliciesOptions model + deleteDataPoliciesOptionsModel := watsonxDataService.NewDeleteDataPoliciesOptions() + deleteDataPoliciesOptionsModel.SetAuthInstanceID("testString") + deleteDataPoliciesOptionsModel.SetPolicies("testString") + deleteDataPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteDataPoliciesOptionsModel).ToNot(BeNil()) + Expect(deleteDataPoliciesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteDataPoliciesOptionsModel.Policies).To(Equal(core.StringPtr("testString"))) + Expect(deleteDataPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteDataPolicyOptions successfully`, func() { + // Construct an instance of the DeleteDataPolicyOptions model + name := "testString" + deleteDataPolicyOptionsModel := watsonxDataService.NewDeleteDataPolicyOptions(name) + deleteDataPolicyOptionsModel.SetName("testString") + deleteDataPolicyOptionsModel.SetAuthInstanceID("testString") + deleteDataPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteDataPolicyOptionsModel).ToNot(BeNil()) + Expect(deleteDataPolicyOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(deleteDataPolicyOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteDataPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteDatabaseCatalogOptions successfully`, func() { // Construct an instance of the DeleteDatabaseCatalogOptions model - databaseID := "testString" - deleteDatabaseCatalogOptionsModel := watsonxDataService.NewDeleteDatabaseCatalogOptions(databaseID) - deleteDatabaseCatalogOptionsModel.SetDatabaseID("testString") + id := "testString" + deleteDatabaseCatalogOptionsModel := watsonxDataService.NewDeleteDatabaseCatalogOptions(id) + deleteDatabaseCatalogOptionsModel.SetID("testString") deleteDatabaseCatalogOptionsModel.SetAuthInstanceID("testString") deleteDatabaseCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteDatabaseCatalogOptionsModel).ToNot(BeNil()) - Expect(deleteDatabaseCatalogOptionsModel.DatabaseID).To(Equal(core.StringPtr("testString"))) + Expect(deleteDatabaseCatalogOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteDatabaseCatalogOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteDatabaseCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteDb2EngineOptions successfully`, func() { // Construct an instance of the DeleteDb2EngineOptions model - engineID := "testString" - deleteDb2EngineOptionsModel := watsonxDataService.NewDeleteDb2EngineOptions(engineID) - deleteDb2EngineOptionsModel.SetEngineID("testString") + id := "testString" + deleteDb2EngineOptionsModel := watsonxDataService.NewDeleteDb2EngineOptions(id) + deleteDb2EngineOptionsModel.SetID("testString") deleteDb2EngineOptionsModel.SetAuthInstanceID("testString") deleteDb2EngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteDb2EngineOptionsModel).ToNot(BeNil()) - Expect(deleteDb2EngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(deleteDb2EngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteDb2EngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteDb2EngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewDeleteDeactivateBucketOptions successfully`, func() { - // Construct an instance of the DeleteDeactivateBucketOptions model - bucketID := "testString" - deleteDeactivateBucketOptionsModel := watsonxDataService.NewDeleteDeactivateBucketOptions(bucketID) - deleteDeactivateBucketOptionsModel.SetBucketID("testString") - deleteDeactivateBucketOptionsModel.SetAuthInstanceID("testString") - deleteDeactivateBucketOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteDeactivateBucketOptionsModel).ToNot(BeNil()) - Expect(deleteDeactivateBucketOptionsModel.BucketID).To(Equal(core.StringPtr("testString"))) - Expect(deleteDeactivateBucketOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(deleteDeactivateBucketOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteDriverEnginesOptions successfully`, func() { - // Construct an instance of the DeleteDriverEnginesOptions model - driverID := "testString" - engineIds := "testString" - deleteDriverEnginesOptionsModel := watsonxDataService.NewDeleteDriverEnginesOptions(driverID, engineIds) - deleteDriverEnginesOptionsModel.SetDriverID("testString") - deleteDriverEnginesOptionsModel.SetEngineIds("testString") - deleteDriverEnginesOptionsModel.SetAuthInstanceID("testString") - deleteDriverEnginesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteDriverEnginesOptionsModel).ToNot(BeNil()) - Expect(deleteDriverEnginesOptionsModel.DriverID).To(Equal(core.StringPtr("testString"))) - Expect(deleteDriverEnginesOptionsModel.EngineIds).To(Equal(core.StringPtr("testString"))) - Expect(deleteDriverEnginesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(deleteDriverEnginesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewDeleteDriverRegistrationOptions successfully`, func() { - // Construct an instance of the DeleteDriverRegistrationOptions model - driverID := "testString" - deleteDriverRegistrationOptionsModel := watsonxDataService.NewDeleteDriverRegistrationOptions(driverID) - deleteDriverRegistrationOptionsModel.SetDriverID("testString") - deleteDriverRegistrationOptionsModel.SetAuthInstanceID("testString") - deleteDriverRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteDriverRegistrationOptionsModel).ToNot(BeNil()) - Expect(deleteDriverRegistrationOptionsModel.DriverID).To(Equal(core.StringPtr("testString"))) - Expect(deleteDriverRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(deleteDriverRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewDeleteEngineOptions successfully`, func() { // Construct an instance of the DeleteEngineOptions model - engineID := "testString" - deleteEngineOptionsModel := watsonxDataService.NewDeleteEngineOptions(engineID) - deleteEngineOptionsModel.SetEngineID("testString") + id := "testString" + deleteEngineOptionsModel := watsonxDataService.NewDeleteEngineOptions(id) + deleteEngineOptionsModel.SetID("testString") deleteEngineOptionsModel.SetAuthInstanceID("testString") deleteEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteEngineOptionsModel).ToNot(BeNil()) - Expect(deleteEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(deleteEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewDeleteIngestionJobsOptions successfully`, func() { - // Construct an instance of the DeleteIngestionJobsOptions model - jobID := "testString" - authInstanceID := "testString" - deleteIngestionJobsOptionsModel := watsonxDataService.NewDeleteIngestionJobsOptions(jobID, authInstanceID) - deleteIngestionJobsOptionsModel.SetJobID("testString") - deleteIngestionJobsOptionsModel.SetAuthInstanceID("testString") - deleteIngestionJobsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteIngestionJobsOptionsModel).ToNot(BeNil()) - Expect(deleteIngestionJobsOptionsModel.JobID).To(Equal(core.StringPtr("testString"))) - Expect(deleteIngestionJobsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(deleteIngestionJobsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewDeleteIntegrationOptions successfully`, func() { // Construct an instance of the DeleteIntegrationOptions model - integrationID := "testString" - deleteIntegrationOptionsModel := watsonxDataService.NewDeleteIntegrationOptions(integrationID) - deleteIntegrationOptionsModel.SetIntegrationID("testString") + id := "testString" + deleteIntegrationOptionsModel := watsonxDataService.NewDeleteIntegrationOptions(id) + deleteIntegrationOptionsModel.SetID("testString") deleteIntegrationOptionsModel.SetAuthInstanceID("testString") deleteIntegrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteIntegrationOptionsModel).ToNot(BeNil()) - Expect(deleteIntegrationOptionsModel.IntegrationID).To(Equal(core.StringPtr("testString"))) + Expect(deleteIntegrationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteIntegrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteIntegrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteMilvusServiceOptions successfully`, func() { // Construct an instance of the DeleteMilvusServiceOptions model - serviceID := "testString" - deleteMilvusServiceOptionsModel := watsonxDataService.NewDeleteMilvusServiceOptions(serviceID) - deleteMilvusServiceOptionsModel.SetServiceID("testString") + id := "testString" + deleteMilvusServiceOptionsModel := watsonxDataService.NewDeleteMilvusServiceOptions(id) + deleteMilvusServiceOptionsModel.SetID("testString") deleteMilvusServiceOptionsModel.SetAuthInstanceID("testString") deleteMilvusServiceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteMilvusServiceOptionsModel).ToNot(BeNil()) - Expect(deleteMilvusServiceOptionsModel.ServiceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteMilvusServiceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteMilvusServiceOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteMilvusServiceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteNetezzaEngineOptions successfully`, func() { // Construct an instance of the DeleteNetezzaEngineOptions model - engineID := "testString" - deleteNetezzaEngineOptionsModel := watsonxDataService.NewDeleteNetezzaEngineOptions(engineID) - deleteNetezzaEngineOptionsModel.SetEngineID("testString") + id := "testString" + deleteNetezzaEngineOptionsModel := watsonxDataService.NewDeleteNetezzaEngineOptions(id) + deleteNetezzaEngineOptionsModel.SetID("testString") deleteNetezzaEngineOptionsModel.SetAuthInstanceID("testString") deleteNetezzaEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteNetezzaEngineOptionsModel).ToNot(BeNil()) - Expect(deleteNetezzaEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(deleteNetezzaEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteNetezzaEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteNetezzaEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteOtherEngineOptions successfully`, func() { // Construct an instance of the DeleteOtherEngineOptions model - engineID := "testString" - deleteOtherEngineOptionsModel := watsonxDataService.NewDeleteOtherEngineOptions(engineID) - deleteOtherEngineOptionsModel.SetEngineID("testString") + id := "testString" + deleteOtherEngineOptionsModel := watsonxDataService.NewDeleteOtherEngineOptions(id) + deleteOtherEngineOptionsModel.SetID("testString") deleteOtherEngineOptionsModel.SetAuthInstanceID("testString") deleteOtherEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteOtherEngineOptionsModel).ToNot(BeNil()) - Expect(deleteOtherEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(deleteOtherEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteOtherEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteOtherEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeletePrestissimoEngineCatalogsOptions successfully`, func() { // Construct an instance of the DeletePrestissimoEngineCatalogsOptions model - engineID := "testString" + id := "testString" catalogNames := "testString" - deletePrestissimoEngineCatalogsOptionsModel := watsonxDataService.NewDeletePrestissimoEngineCatalogsOptions(engineID, catalogNames) - deletePrestissimoEngineCatalogsOptionsModel.SetEngineID("testString") + deletePrestissimoEngineCatalogsOptionsModel := watsonxDataService.NewDeletePrestissimoEngineCatalogsOptions(id, catalogNames) + deletePrestissimoEngineCatalogsOptionsModel.SetID("testString") deletePrestissimoEngineCatalogsOptionsModel.SetCatalogNames("testString") deletePrestissimoEngineCatalogsOptionsModel.SetAuthInstanceID("testString") deletePrestissimoEngineCatalogsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deletePrestissimoEngineCatalogsOptionsModel).ToNot(BeNil()) - Expect(deletePrestissimoEngineCatalogsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(deletePrestissimoEngineCatalogsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deletePrestissimoEngineCatalogsOptionsModel.CatalogNames).To(Equal(core.StringPtr("testString"))) Expect(deletePrestissimoEngineCatalogsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deletePrestissimoEngineCatalogsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeletePrestissimoEngineOptions successfully`, func() { // Construct an instance of the DeletePrestissimoEngineOptions model - engineID := "testString" - deletePrestissimoEngineOptionsModel := watsonxDataService.NewDeletePrestissimoEngineOptions(engineID) - deletePrestissimoEngineOptionsModel.SetEngineID("testString") + id := "testString" + deletePrestissimoEngineOptionsModel := watsonxDataService.NewDeletePrestissimoEngineOptions(id) + deletePrestissimoEngineOptionsModel.SetID("testString") deletePrestissimoEngineOptionsModel.SetAuthInstanceID("testString") deletePrestissimoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deletePrestissimoEngineOptionsModel).ToNot(BeNil()) - Expect(deletePrestissimoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(deletePrestissimoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deletePrestissimoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deletePrestissimoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -37206,307 +40081,367 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(deleteSalIntegrationOptionsModel).ToNot(BeNil()) Expect(deleteSalIntegrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteSalMetadataOptions successfully`, func() { + // Construct an instance of the DeleteSalMetadataOptions model + deleteSalMetadataOptionsModel := watsonxDataService.NewDeleteSalMetadataOptions() + deleteSalMetadataOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteSalMetadataOptionsModel).ToNot(BeNil()) + Expect(deleteSalMetadataOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteSchemaOptions successfully`, func() { // Construct an instance of the DeleteSchemaOptions model engineID := "testString" - catalogID := "testString" - schemaID := "testString" - deleteSchemaOptionsModel := watsonxDataService.NewDeleteSchemaOptions(engineID, catalogID, schemaID) + catalogName := "testString" + schemaName := "testString" + deleteSchemaOptionsModel := watsonxDataService.NewDeleteSchemaOptions(engineID, catalogName, schemaName) deleteSchemaOptionsModel.SetEngineID("testString") - deleteSchemaOptionsModel.SetCatalogID("testString") - deleteSchemaOptionsModel.SetSchemaID("testString") + deleteSchemaOptionsModel.SetCatalogName("testString") + deleteSchemaOptionsModel.SetSchemaName("testString") deleteSchemaOptionsModel.SetAuthInstanceID("testString") deleteSchemaOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteSchemaOptionsModel).ToNot(BeNil()) Expect(deleteSchemaOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSchemaOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSchemaOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSchemaOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(deleteSchemaOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) Expect(deleteSchemaOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteSchemaOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewDeleteSparkEngineApplicationsOptions successfully`, func() { - // Construct an instance of the DeleteSparkEngineApplicationsOptions model + It(`Invoke NewDeleteSemanticSearchQueriesByIdOptions successfully`, func() { + // Construct an instance of the DeleteSemanticSearchQueriesByIdOptions model + id := "testString" + deleteSemanticSearchQueriesByIdOptionsModel := watsonxDataService.NewDeleteSemanticSearchQueriesByIdOptions(id) + deleteSemanticSearchQueriesByIdOptionsModel.SetID("testString") + deleteSemanticSearchQueriesByIdOptionsModel.SetAuthInstanceID("testString") + deleteSemanticSearchQueriesByIdOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteSemanticSearchQueriesByIdOptionsModel).ToNot(BeNil()) + Expect(deleteSemanticSearchQueriesByIdOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSemanticSearchQueriesByIdOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSemanticSearchQueriesByIdOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteSemanticSearchQueriesOptions successfully`, func() { + // Construct an instance of the DeleteSemanticSearchQueriesOptions model + deleteSemanticSearchQueriesOptionsModel := watsonxDataService.NewDeleteSemanticSearchQueriesOptions() + deleteSemanticSearchQueriesOptionsModel.SetBatchSize(int64(1)) + deleteSemanticSearchQueriesOptionsModel.SetAuthInstanceID("testString") + deleteSemanticSearchQueriesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteSemanticSearchQueriesOptionsModel).ToNot(BeNil()) + Expect(deleteSemanticSearchQueriesOptionsModel.BatchSize).To(Equal(core.Int64Ptr(int64(1)))) + Expect(deleteSemanticSearchQueriesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSemanticSearchQueriesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewDeleteSparkEngineApplicationOptions successfully`, func() { + // Construct an instance of the DeleteSparkEngineApplicationOptions model engineID := "testString" - applicationID := "testString" - deleteSparkEngineApplicationsOptionsModel := watsonxDataService.NewDeleteSparkEngineApplicationsOptions(engineID, applicationID) - deleteSparkEngineApplicationsOptionsModel.SetEngineID("testString") - deleteSparkEngineApplicationsOptionsModel.SetApplicationID("testString") - deleteSparkEngineApplicationsOptionsModel.SetAuthInstanceID("testString") - deleteSparkEngineApplicationsOptionsModel.SetState([]string{"testString"}) - deleteSparkEngineApplicationsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(deleteSparkEngineApplicationsOptionsModel).ToNot(BeNil()) - Expect(deleteSparkEngineApplicationsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSparkEngineApplicationsOptionsModel.ApplicationID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSparkEngineApplicationsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(deleteSparkEngineApplicationsOptionsModel.State).To(Equal([]string{"testString"})) - Expect(deleteSparkEngineApplicationsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + id := "testString" + deleteSparkEngineApplicationOptionsModel := watsonxDataService.NewDeleteSparkEngineApplicationOptions(engineID, id) + deleteSparkEngineApplicationOptionsModel.SetEngineID("testString") + deleteSparkEngineApplicationOptionsModel.SetID("testString") + deleteSparkEngineApplicationOptionsModel.SetAuthInstanceID("testString") + deleteSparkEngineApplicationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteSparkEngineApplicationOptionsModel).ToNot(BeNil()) + Expect(deleteSparkEngineApplicationOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSparkEngineApplicationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSparkEngineApplicationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSparkEngineApplicationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteSparkEngineCatalogsOptions successfully`, func() { // Construct an instance of the DeleteSparkEngineCatalogsOptions model - engineID := "testString" + id := "testString" catalogNames := "testString" - deleteSparkEngineCatalogsOptionsModel := watsonxDataService.NewDeleteSparkEngineCatalogsOptions(engineID, catalogNames) - deleteSparkEngineCatalogsOptionsModel.SetEngineID("testString") + deleteSparkEngineCatalogsOptionsModel := watsonxDataService.NewDeleteSparkEngineCatalogsOptions(id, catalogNames) + deleteSparkEngineCatalogsOptionsModel.SetID("testString") deleteSparkEngineCatalogsOptionsModel.SetCatalogNames("testString") deleteSparkEngineCatalogsOptionsModel.SetAuthInstanceID("testString") deleteSparkEngineCatalogsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteSparkEngineCatalogsOptionsModel).ToNot(BeNil()) - Expect(deleteSparkEngineCatalogsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSparkEngineCatalogsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteSparkEngineCatalogsOptionsModel.CatalogNames).To(Equal(core.StringPtr("testString"))) Expect(deleteSparkEngineCatalogsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteSparkEngineCatalogsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteSparkEngineHistoryServerOptions successfully`, func() { // Construct an instance of the DeleteSparkEngineHistoryServerOptions model - engineID := "testString" - deleteSparkEngineHistoryServerOptionsModel := watsonxDataService.NewDeleteSparkEngineHistoryServerOptions(engineID) - deleteSparkEngineHistoryServerOptionsModel.SetEngineID("testString") + id := "testString" + deleteSparkEngineHistoryServerOptionsModel := watsonxDataService.NewDeleteSparkEngineHistoryServerOptions(id) + deleteSparkEngineHistoryServerOptionsModel.SetID("testString") deleteSparkEngineHistoryServerOptionsModel.SetAuthInstanceID("testString") deleteSparkEngineHistoryServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteSparkEngineHistoryServerOptionsModel).ToNot(BeNil()) - Expect(deleteSparkEngineHistoryServerOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSparkEngineHistoryServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteSparkEngineHistoryServerOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteSparkEngineHistoryServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewDeleteSparkEngineOptions successfully`, func() { // Construct an instance of the DeleteSparkEngineOptions model - engineID := "testString" - deleteSparkEngineOptionsModel := watsonxDataService.NewDeleteSparkEngineOptions(engineID) - deleteSparkEngineOptionsModel.SetEngineID("testString") + id := "testString" + deleteSparkEngineOptionsModel := watsonxDataService.NewDeleteSparkEngineOptions(id) + deleteSparkEngineOptionsModel.SetID("testString") deleteSparkEngineOptionsModel.SetAuthInstanceID("testString") deleteSparkEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteSparkEngineOptionsModel).ToNot(BeNil()) - Expect(deleteSparkEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(deleteSparkEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(deleteSparkEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteSparkEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewDeleteStorageRegistrationOptions successfully`, func() { + // Construct an instance of the DeleteStorageRegistrationOptions model + id := "testString" + deleteStorageRegistrationOptionsModel := watsonxDataService.NewDeleteStorageRegistrationOptions(id) + deleteStorageRegistrationOptionsModel.SetID("testString") + deleteStorageRegistrationOptionsModel.SetAuthInstanceID("testString") + deleteStorageRegistrationOptionsModel.SetSkipMdsCall(false) + deleteStorageRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(deleteStorageRegistrationOptionsModel).ToNot(BeNil()) + Expect(deleteStorageRegistrationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(deleteStorageRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(deleteStorageRegistrationOptionsModel.SkipMdsCall).To(Equal(core.BoolPtr(false))) + Expect(deleteStorageRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewDeleteTableOptions successfully`, func() { // Construct an instance of the DeleteTableOptions model - catalogID := "testString" - schemaID := "testString" - tableID := "testString" + catalogName := "testString" + schemaName := "testString" + tableName := "testString" engineID := "testString" - deleteTableOptionsModel := watsonxDataService.NewDeleteTableOptions(catalogID, schemaID, tableID, engineID) - deleteTableOptionsModel.SetCatalogID("testString") - deleteTableOptionsModel.SetSchemaID("testString") - deleteTableOptionsModel.SetTableID("testString") + deleteTableOptionsModel := watsonxDataService.NewDeleteTableOptions(catalogName, schemaName, tableName, engineID) + deleteTableOptionsModel.SetCatalogName("testString") + deleteTableOptionsModel.SetSchemaName("testString") + deleteTableOptionsModel.SetTableName("testString") deleteTableOptionsModel.SetEngineID("testString") deleteTableOptionsModel.SetType("testString") deleteTableOptionsModel.SetAuthInstanceID("testString") deleteTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(deleteTableOptionsModel).ToNot(BeNil()) - Expect(deleteTableOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(deleteTableOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) - Expect(deleteTableOptionsModel.TableID).To(Equal(core.StringPtr("testString"))) + Expect(deleteTableOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(deleteTableOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(deleteTableOptionsModel.TableName).To(Equal(core.StringPtr("testString"))) Expect(deleteTableOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) Expect(deleteTableOptionsModel.Type).To(Equal(core.StringPtr("testString"))) Expect(deleteTableOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(deleteTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewEngineDetails successfully`, func() { + var coordinator *watsonxdatav3.CoordinatorNodeDescriptionBody = nil + sizeConfig := "starter" + var worker *watsonxdatav3.WorkerNodeDescriptionBody = nil + _, err := watsonxDataService.NewEngineDetails(coordinator, sizeConfig, worker) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewEnrichmentObj successfully`, func() { catalog := "iceberg_data" operation := "create" - schema := "testString" - _model, err := watsonxDataService.NewEnrichmentObj(catalog, operation, schema) + schema := "schema1" + tables := []string{"table1"} + _model, err := watsonxDataService.NewEnrichmentObj(catalog, operation, schema, tables) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewGetAllColumnsOptions successfully`, func() { - // Construct an instance of the GetAllColumnsOptions model - getAllColumnsOptionsModel := watsonxDataService.NewGetAllColumnsOptions() - getAllColumnsOptionsModel.SetTableName("testString") - getAllColumnsOptionsModel.SetCatalogName("testString") - getAllColumnsOptionsModel.SetSchemaName("testString") - getAllColumnsOptionsModel.SetAuthInstanceID("testString") - getAllColumnsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getAllColumnsOptionsModel).ToNot(BeNil()) - Expect(getAllColumnsOptionsModel.TableName).To(Equal(core.StringPtr("testString"))) - Expect(getAllColumnsOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) - Expect(getAllColumnsOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) - Expect(getAllColumnsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getAllColumnsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBucketObjectPropertiesOptions successfully`, func() { - // Construct an instance of the Path model - pathModel := new(watsonxdatav2.Path) - Expect(pathModel).ToNot(BeNil()) - pathModel.Path = core.StringPtr("string") - Expect(pathModel.Path).To(Equal(core.StringPtr("string"))) - - // Construct an instance of the GetBucketObjectPropertiesOptions model - bucketID := "testString" - getBucketObjectPropertiesOptionsModel := watsonxDataService.NewGetBucketObjectPropertiesOptions(bucketID) - getBucketObjectPropertiesOptionsModel.SetBucketID("testString") - getBucketObjectPropertiesOptionsModel.SetPaths([]watsonxdatav2.Path{*pathModel}) - getBucketObjectPropertiesOptionsModel.SetAuthInstanceID("testString") - getBucketObjectPropertiesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBucketObjectPropertiesOptionsModel).ToNot(BeNil()) - Expect(getBucketObjectPropertiesOptionsModel.BucketID).To(Equal(core.StringPtr("testString"))) - Expect(getBucketObjectPropertiesOptionsModel.Paths).To(Equal([]watsonxdatav2.Path{*pathModel})) - Expect(getBucketObjectPropertiesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getBucketObjectPropertiesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetBucketRegistrationOptions successfully`, func() { - // Construct an instance of the GetBucketRegistrationOptions model - bucketID := "testString" - getBucketRegistrationOptionsModel := watsonxDataService.NewGetBucketRegistrationOptions(bucketID) - getBucketRegistrationOptionsModel.SetBucketID("testString") - getBucketRegistrationOptionsModel.SetAuthInstanceID("testString") - getBucketRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getBucketRegistrationOptionsModel).ToNot(BeNil()) - Expect(getBucketRegistrationOptionsModel.BucketID).To(Equal(core.StringPtr("testString"))) - Expect(getBucketRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getBucketRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + It(`Invoke NewFilterResourceAccessPoliciesOnUsersAndUsergroupsOptions successfully`, func() { + // Construct an instance of the ResourceDetails model + resourceDetailsModel := new(watsonxdatav3.ResourceDetails) + Expect(resourceDetailsModel).ToNot(BeNil()) + resourceDetailsModel.ID = core.StringPtr("presto01") + resourceDetailsModel.Name = core.StringPtr("hive_data") + resourceDetailsModel.Type = core.StringPtr("presto") + Expect(resourceDetailsModel.ID).To(Equal(core.StringPtr("presto01"))) + Expect(resourceDetailsModel.Name).To(Equal(core.StringPtr("hive_data"))) + Expect(resourceDetailsModel.Type).To(Equal(core.StringPtr("presto"))) + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + Expect(subjectModel).ToNot(BeNil()) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + Expect(subjectModel.Type).To(Equal(core.StringPtr("user"))) + Expect(subjectModel.Value).To(Equal(core.StringPtr("user1"))) + + // Construct an instance of the AccessPoliciesSearch model + accessPoliciesSearchModel := new(watsonxdatav3.AccessPoliciesSearch) + Expect(accessPoliciesSearchModel).ToNot(BeNil()) + accessPoliciesSearchModel.Resources = []watsonxdatav3.ResourceDetails{*resourceDetailsModel} + accessPoliciesSearchModel.SubjectsToSearch = []watsonxdatav3.Subject{*subjectModel} + Expect(accessPoliciesSearchModel.Resources).To(Equal([]watsonxdatav3.ResourceDetails{*resourceDetailsModel})) + Expect(accessPoliciesSearchModel.SubjectsToSearch).To(Equal([]watsonxdatav3.Subject{*subjectModel})) + + // Construct an instance of the FilterResourceAccessPoliciesOnUsersAndUsergroupsOptions model + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsAccessPoliciesSearch := []watsonxdatav3.AccessPoliciesSearch{} + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel := watsonxDataService.NewFilterResourceAccessPoliciesOnUsersAndUsergroupsOptions(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsAccessPoliciesSearch) + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.SetAccessPoliciesSearch([]watsonxdatav3.AccessPoliciesSearch{*accessPoliciesSearchModel}) + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.SetAuthInstanceID("testString") + filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel).ToNot(BeNil()) + Expect(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AccessPoliciesSearch).To(Equal([]watsonxdatav3.AccessPoliciesSearch{*accessPoliciesSearchModel})) + Expect(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(filterResourceAccessPoliciesOnUsersAndUsergroupsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetCatalogEngineAssociationOptions successfully`, func() { + // Construct an instance of the GetCatalogEngineAssociationOptions model + catalogName := "testString" + getCatalogEngineAssociationOptionsModel := watsonxDataService.NewGetCatalogEngineAssociationOptions(catalogName) + getCatalogEngineAssociationOptionsModel.SetCatalogName("testString") + getCatalogEngineAssociationOptionsModel.SetAuthInstanceID("testString") + getCatalogEngineAssociationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getCatalogEngineAssociationOptionsModel).ToNot(BeNil()) + Expect(getCatalogEngineAssociationOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(getCatalogEngineAssociationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getCatalogEngineAssociationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetCatalogOptions successfully`, func() { // Construct an instance of the GetCatalogOptions model - catalogID := "testString" - getCatalogOptionsModel := watsonxDataService.NewGetCatalogOptions(catalogID) - getCatalogOptionsModel.SetCatalogID("testString") + name := "testString" + getCatalogOptionsModel := watsonxDataService.NewGetCatalogOptions(name) + getCatalogOptionsModel.SetName("testString") getCatalogOptionsModel.SetAuthInstanceID("testString") getCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getCatalogOptionsModel).ToNot(BeNil()) - Expect(getCatalogOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(getCatalogOptionsModel.Name).To(Equal(core.StringPtr("testString"))) Expect(getCatalogOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetDataPolicyOptions successfully`, func() { + // Construct an instance of the GetDataPolicyOptions model + name := "testString" + getDataPolicyOptionsModel := watsonxDataService.NewGetDataPolicyOptions(name) + getDataPolicyOptionsModel.SetName("testString") + getDataPolicyOptionsModel.SetAuthInstanceID("testString") + getDataPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getDataPolicyOptionsModel).ToNot(BeNil()) + Expect(getDataPolicyOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(getDataPolicyOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getDataPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetDatabaseOptions successfully`, func() { // Construct an instance of the GetDatabaseOptions model - databaseID := "testString" - getDatabaseOptionsModel := watsonxDataService.NewGetDatabaseOptions(databaseID) - getDatabaseOptionsModel.SetDatabaseID("testString") + id := "testString" + getDatabaseOptionsModel := watsonxDataService.NewGetDatabaseOptions(id) + getDatabaseOptionsModel.SetID("testString") getDatabaseOptionsModel.SetAuthInstanceID("testString") getDatabaseOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getDatabaseOptionsModel).ToNot(BeNil()) - Expect(getDatabaseOptionsModel.DatabaseID).To(Equal(core.StringPtr("testString"))) + Expect(getDatabaseOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getDatabaseOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getDatabaseOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewGetEndpointsOptions successfully`, func() { - // Construct an instance of the GetEndpointsOptions model - getEndpointsOptionsModel := watsonxDataService.NewGetEndpointsOptions() - getEndpointsOptionsModel.SetAuthInstanceID("testString") - getEndpointsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getEndpointsOptionsModel).ToNot(BeNil()) - Expect(getEndpointsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getEndpointsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewGetIngestionJobOptions successfully`, func() { // Construct an instance of the GetIngestionJobOptions model - jobID := "testString" authInstanceID := "testString" - getIngestionJobOptionsModel := watsonxDataService.NewGetIngestionJobOptions(jobID, authInstanceID) - getIngestionJobOptionsModel.SetJobID("testString") + id := "testString" + getIngestionJobOptionsModel := watsonxDataService.NewGetIngestionJobOptions(authInstanceID, id) getIngestionJobOptionsModel.SetAuthInstanceID("testString") + getIngestionJobOptionsModel.SetID("testString") getIngestionJobOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getIngestionJobOptionsModel).ToNot(BeNil()) - Expect(getIngestionJobOptionsModel.JobID).To(Equal(core.StringPtr("testString"))) Expect(getIngestionJobOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getIngestionJobOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getIngestionJobOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetIntegrationsOptions successfully`, func() { // Construct an instance of the GetIntegrationsOptions model - integrationID := "testString" - getIntegrationsOptionsModel := watsonxDataService.NewGetIntegrationsOptions(integrationID) - getIntegrationsOptionsModel.SetIntegrationID("testString") + id := "testString" + getIntegrationsOptionsModel := watsonxDataService.NewGetIntegrationsOptions(id) + getIntegrationsOptionsModel.SetID("testString") getIntegrationsOptionsModel.SetAuthInstanceID("testString") - getIntegrationsOptionsModel.SetSecret("testString") getIntegrationsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getIntegrationsOptionsModel).ToNot(BeNil()) - Expect(getIntegrationsOptionsModel.IntegrationID).To(Equal(core.StringPtr("testString"))) + Expect(getIntegrationsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getIntegrationsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getIntegrationsOptionsModel.Secret).To(Equal(core.StringPtr("testString"))) Expect(getIntegrationsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetMilvusServiceOptions successfully`, func() { // Construct an instance of the GetMilvusServiceOptions model - serviceID := "testString" - getMilvusServiceOptionsModel := watsonxDataService.NewGetMilvusServiceOptions(serviceID) - getMilvusServiceOptionsModel.SetServiceID("testString") + id := "testString" + getMilvusServiceOptionsModel := watsonxDataService.NewGetMilvusServiceOptions(id) + getMilvusServiceOptionsModel.SetID("testString") getMilvusServiceOptionsModel.SetAuthInstanceID("testString") getMilvusServiceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getMilvusServiceOptionsModel).ToNot(BeNil()) - Expect(getMilvusServiceOptionsModel.ServiceID).To(Equal(core.StringPtr("testString"))) + Expect(getMilvusServiceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getMilvusServiceOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getMilvusServiceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetPrestissimoEngineCatalogOptions successfully`, func() { // Construct an instance of the GetPrestissimoEngineCatalogOptions model engineID := "testString" - catalogID := "testString" - getPrestissimoEngineCatalogOptionsModel := watsonxDataService.NewGetPrestissimoEngineCatalogOptions(engineID, catalogID) + id := "testString" + getPrestissimoEngineCatalogOptionsModel := watsonxDataService.NewGetPrestissimoEngineCatalogOptions(engineID, id) getPrestissimoEngineCatalogOptionsModel.SetEngineID("testString") - getPrestissimoEngineCatalogOptionsModel.SetCatalogID("testString") + getPrestissimoEngineCatalogOptionsModel.SetID("testString") getPrestissimoEngineCatalogOptionsModel.SetAuthInstanceID("testString") getPrestissimoEngineCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getPrestissimoEngineCatalogOptionsModel).ToNot(BeNil()) Expect(getPrestissimoEngineCatalogOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(getPrestissimoEngineCatalogOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(getPrestissimoEngineCatalogOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getPrestissimoEngineCatalogOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getPrestissimoEngineCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetPrestissimoEngineOptions successfully`, func() { // Construct an instance of the GetPrestissimoEngineOptions model - engineID := "testString" - getPrestissimoEngineOptionsModel := watsonxDataService.NewGetPrestissimoEngineOptions(engineID) - getPrestissimoEngineOptionsModel.SetEngineID("testString") + id := "testString" + getPrestissimoEngineOptionsModel := watsonxDataService.NewGetPrestissimoEngineOptions(id) + getPrestissimoEngineOptionsModel.SetID("testString") getPrestissimoEngineOptionsModel.SetAuthInstanceID("testString") getPrestissimoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getPrestissimoEngineOptionsModel).ToNot(BeNil()) - Expect(getPrestissimoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(getPrestissimoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getPrestissimoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getPrestissimoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetPrestoEngineCatalogOptions successfully`, func() { // Construct an instance of the GetPrestoEngineCatalogOptions model engineID := "testString" - catalogID := "testString" - getPrestoEngineCatalogOptionsModel := watsonxDataService.NewGetPrestoEngineCatalogOptions(engineID, catalogID) + id := "testString" + getPrestoEngineCatalogOptionsModel := watsonxDataService.NewGetPrestoEngineCatalogOptions(engineID, id) getPrestoEngineCatalogOptionsModel.SetEngineID("testString") - getPrestoEngineCatalogOptionsModel.SetCatalogID("testString") + getPrestoEngineCatalogOptionsModel.SetID("testString") getPrestoEngineCatalogOptionsModel.SetAuthInstanceID("testString") getPrestoEngineCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getPrestoEngineCatalogOptionsModel).ToNot(BeNil()) Expect(getPrestoEngineCatalogOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(getPrestoEngineCatalogOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(getPrestoEngineCatalogOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getPrestoEngineCatalogOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getPrestoEngineCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetPrestoEngineConfigOptions successfully`, func() { + // Construct an instance of the GetPrestoEngineConfigOptions model + engineID := "presto860" + authInstanceID := "crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::" + getPrestoEngineConfigOptionsModel := watsonxDataService.NewGetPrestoEngineConfigOptions(engineID, authInstanceID) + getPrestoEngineConfigOptionsModel.SetEngineID("presto860") + getPrestoEngineConfigOptionsModel.SetAuthInstanceID("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::") + getPrestoEngineConfigOptionsModel.SetSections("catalog,configuration,jvm") + getPrestoEngineConfigOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getPrestoEngineConfigOptionsModel).ToNot(BeNil()) + Expect(getPrestoEngineConfigOptionsModel.EngineID).To(Equal(core.StringPtr("presto860"))) + Expect(getPrestoEngineConfigOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::"))) + Expect(getPrestoEngineConfigOptionsModel.Sections).To(Equal(core.StringPtr("catalog,configuration,jvm"))) + Expect(getPrestoEngineConfigOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetPrestoEngineOptions successfully`, func() { // Construct an instance of the GetPrestoEngineOptions model - engineID := "testString" - getPrestoEngineOptionsModel := watsonxDataService.NewGetPrestoEngineOptions(engineID) - getPrestoEngineOptionsModel.SetEngineID("testString") + id := "testString" + getPrestoEngineOptionsModel := watsonxDataService.NewGetPrestoEngineOptions(id) + getPrestoEngineOptionsModel.SetID("testString") getPrestoEngineOptionsModel.SetAuthInstanceID("testString") getPrestoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getPrestoEngineOptionsModel).ToNot(BeNil()) - Expect(getPrestoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(getPrestoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getPrestoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getPrestoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewGetSalIntegrationEnrichmentAssetsOptions successfully`, func() { - // Construct an instance of the GetSalIntegrationEnrichmentAssetsOptions model - getSalIntegrationEnrichmentAssetsOptionsModel := watsonxDataService.NewGetSalIntegrationEnrichmentAssetsOptions() - getSalIntegrationEnrichmentAssetsOptionsModel.SetProjectID("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.SetAuthInstanceID("testString") - getSalIntegrationEnrichmentAssetsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSalIntegrationEnrichmentAssetsOptionsModel).ToNot(BeNil()) - Expect(getSalIntegrationEnrichmentAssetsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentAssetsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSalIntegrationEnrichmentDataAssetOptions successfully`, func() { - // Construct an instance of the GetSalIntegrationEnrichmentDataAssetOptions model - getSalIntegrationEnrichmentDataAssetOptionsModel := watsonxDataService.NewGetSalIntegrationEnrichmentDataAssetOptions() - getSalIntegrationEnrichmentDataAssetOptionsModel.SetProjectID("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.SetAssetID("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.SetAuthInstanceID("testString") - getSalIntegrationEnrichmentDataAssetOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSalIntegrationEnrichmentDataAssetOptionsModel).ToNot(BeNil()) - Expect(getSalIntegrationEnrichmentDataAssetOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentDataAssetOptionsModel.AssetID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentDataAssetOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentDataAssetOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + It(`Invoke NewGetSalIntegrationEnrichmentAssetsByIdOptions successfully`, func() { + // Construct an instance of the GetSalIntegrationEnrichmentAssetsByIdOptions model + projectID := "testString" + id := "testString" + getSalIntegrationEnrichmentAssetsByIdOptionsModel := watsonxDataService.NewGetSalIntegrationEnrichmentAssetsByIdOptions(projectID, id) + getSalIntegrationEnrichmentAssetsByIdOptionsModel.SetProjectID("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.SetID("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.SetAuthInstanceID("testString") + getSalIntegrationEnrichmentAssetsByIdOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSalIntegrationEnrichmentAssetsByIdOptionsModel).ToNot(BeNil()) + Expect(getSalIntegrationEnrichmentAssetsByIdOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(getSalIntegrationEnrichmentAssetsByIdOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSalIntegrationEnrichmentAssetsByIdOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getSalIntegrationEnrichmentAssetsByIdOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetSalIntegrationEnrichmentGlobalSettingsOptions successfully`, func() { // Construct an instance of the GetSalIntegrationEnrichmentGlobalSettingsOptions model @@ -37519,53 +40454,33 @@ var _ = Describe(`WatsonxDataV2`, func() { }) It(`Invoke NewGetSalIntegrationEnrichmentJobRunLogsOptions successfully`, func() { // Construct an instance of the GetSalIntegrationEnrichmentJobRunLogsOptions model - getSalIntegrationEnrichmentJobRunLogsOptionsModel := watsonxDataService.NewGetSalIntegrationEnrichmentJobRunLogsOptions() + jobID := "testString" + runID := "testString" + projectID := "testString" + getSalIntegrationEnrichmentJobRunLogsOptionsModel := watsonxDataService.NewGetSalIntegrationEnrichmentJobRunLogsOptions(jobID, runID, projectID) getSalIntegrationEnrichmentJobRunLogsOptionsModel.SetJobID("testString") - getSalIntegrationEnrichmentJobRunLogsOptionsModel.SetJobRunID("testString") + getSalIntegrationEnrichmentJobRunLogsOptionsModel.SetRunID("testString") getSalIntegrationEnrichmentJobRunLogsOptionsModel.SetProjectID("testString") getSalIntegrationEnrichmentJobRunLogsOptionsModel.SetAuthInstanceID("testString") getSalIntegrationEnrichmentJobRunLogsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getSalIntegrationEnrichmentJobRunLogsOptionsModel).ToNot(BeNil()) Expect(getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentJobRunLogsOptionsModel.JobRunID).To(Equal(core.StringPtr("testString"))) + Expect(getSalIntegrationEnrichmentJobRunLogsOptionsModel.RunID).To(Equal(core.StringPtr("testString"))) Expect(getSalIntegrationEnrichmentJobRunLogsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) Expect(getSalIntegrationEnrichmentJobRunLogsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getSalIntegrationEnrichmentJobRunLogsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewGetSalIntegrationEnrichmentJobRunsOptions successfully`, func() { - // Construct an instance of the GetSalIntegrationEnrichmentJobRunsOptions model - getSalIntegrationEnrichmentJobRunsOptionsModel := watsonxDataService.NewGetSalIntegrationEnrichmentJobRunsOptions() - getSalIntegrationEnrichmentJobRunsOptionsModel.SetJobID("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.SetProjectID("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.SetAuthInstanceID("testString") - getSalIntegrationEnrichmentJobRunsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSalIntegrationEnrichmentJobRunsOptionsModel).ToNot(BeNil()) - Expect(getSalIntegrationEnrichmentJobRunsOptionsModel.JobID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentJobRunsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSalIntegrationEnrichmentJobsOptions successfully`, func() { - // Construct an instance of the GetSalIntegrationEnrichmentJobsOptions model - getSalIntegrationEnrichmentJobsOptionsModel := watsonxDataService.NewGetSalIntegrationEnrichmentJobsOptions() - getSalIntegrationEnrichmentJobsOptionsModel.SetWkcProjectID("testString") - getSalIntegrationEnrichmentJobsOptionsModel.SetAuthInstanceID("testString") - getSalIntegrationEnrichmentJobsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSalIntegrationEnrichmentJobsOptionsModel).ToNot(BeNil()) - Expect(getSalIntegrationEnrichmentJobsOptionsModel.WkcProjectID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentJobsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetSalIntegrationEnrichmentSettingsOptions successfully`, func() { - // Construct an instance of the GetSalIntegrationEnrichmentSettingsOptions model - getSalIntegrationEnrichmentSettingsOptionsModel := watsonxDataService.NewGetSalIntegrationEnrichmentSettingsOptions() - getSalIntegrationEnrichmentSettingsOptionsModel.SetProjectID("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.SetAuthInstanceID("testString") - getSalIntegrationEnrichmentSettingsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSalIntegrationEnrichmentSettingsOptionsModel).ToNot(BeNil()) - Expect(getSalIntegrationEnrichmentSettingsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentSettingsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationEnrichmentSettingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + It(`Invoke NewGetSalIntegrationEnrichmentProjectSettingsOptions successfully`, func() { + // Construct an instance of the GetSalIntegrationEnrichmentProjectSettingsOptions model + projectID := "testString" + getSalIntegrationEnrichmentProjectSettingsOptionsModel := watsonxDataService.NewGetSalIntegrationEnrichmentProjectSettingsOptions(projectID) + getSalIntegrationEnrichmentProjectSettingsOptionsModel.SetProjectID("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.SetAuthInstanceID("testString") + getSalIntegrationEnrichmentProjectSettingsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSalIntegrationEnrichmentProjectSettingsOptionsModel).ToNot(BeNil()) + Expect(getSalIntegrationEnrichmentProjectSettingsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(getSalIntegrationEnrichmentProjectSettingsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getSalIntegrationEnrichmentProjectSettingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetSalIntegrationGlossaryTermsOptions successfully`, func() { // Construct an instance of the GetSalIntegrationGlossaryTermsOptions model @@ -37576,21 +40491,6 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(getSalIntegrationGlossaryTermsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getSalIntegrationGlossaryTermsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewGetSalIntegrationMappingsOptions successfully`, func() { - // Construct an instance of the GetSalIntegrationMappingsOptions model - catalogName := "testString" - schemaName := "testString" - getSalIntegrationMappingsOptionsModel := watsonxDataService.NewGetSalIntegrationMappingsOptions(catalogName, schemaName) - getSalIntegrationMappingsOptionsModel.SetCatalogName("testString") - getSalIntegrationMappingsOptionsModel.SetSchemaName("testString") - getSalIntegrationMappingsOptionsModel.SetAuthInstanceID("testString") - getSalIntegrationMappingsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSalIntegrationMappingsOptionsModel).ToNot(BeNil()) - Expect(getSalIntegrationMappingsOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationMappingsOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationMappingsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getSalIntegrationMappingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewGetSalIntegrationOptions successfully`, func() { // Construct an instance of the GetSalIntegrationOptions model getSalIntegrationOptionsModel := watsonxDataService.NewGetSalIntegrationOptions() @@ -37602,253 +40502,237 @@ var _ = Describe(`WatsonxDataV2`, func() { }) It(`Invoke NewGetSalIntegrationUploadGlossaryStatusOptions successfully`, func() { // Construct an instance of the GetSalIntegrationUploadGlossaryStatusOptions model - getSalIntegrationUploadGlossaryStatusOptionsModel := watsonxDataService.NewGetSalIntegrationUploadGlossaryStatusOptions() - getSalIntegrationUploadGlossaryStatusOptionsModel.SetProcessID("testString") + id := "testString" + getSalIntegrationUploadGlossaryStatusOptionsModel := watsonxDataService.NewGetSalIntegrationUploadGlossaryStatusOptions(id) + getSalIntegrationUploadGlossaryStatusOptionsModel.SetID("testString") getSalIntegrationUploadGlossaryStatusOptionsModel.SetAuthInstanceID("testString") getSalIntegrationUploadGlossaryStatusOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getSalIntegrationUploadGlossaryStatusOptionsModel).ToNot(BeNil()) - Expect(getSalIntegrationUploadGlossaryStatusOptionsModel.ProcessID).To(Equal(core.StringPtr("testString"))) + Expect(getSalIntegrationUploadGlossaryStatusOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getSalIntegrationUploadGlossaryStatusOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getSalIntegrationUploadGlossaryStatusOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewGetSchemaDetailsOptions successfully`, func() { - // Construct an instance of the GetSchemaDetailsOptions model - schemaName := "testString" - getSchemaDetailsOptionsModel := watsonxDataService.NewGetSchemaDetailsOptions(schemaName) - getSchemaDetailsOptionsModel.SetSchemaName("testString") - getSchemaDetailsOptionsModel.SetCatalogName("testString") - getSchemaDetailsOptionsModel.SetAuthInstanceID("testString") - getSchemaDetailsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getSchemaDetailsOptionsModel).ToNot(BeNil()) - Expect(getSchemaDetailsOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) - Expect(getSchemaDetailsOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) - Expect(getSchemaDetailsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getSchemaDetailsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetServiceDetailOptions successfully`, func() { - // Construct an instance of the GetServiceDetailOptions model - target := "testString" - engineOrServiceType := "testString" - id := "testString" - getServiceDetailOptionsModel := watsonxDataService.NewGetServiceDetailOptions(target, engineOrServiceType, id) - getServiceDetailOptionsModel.SetTarget("testString") - getServiceDetailOptionsModel.SetEngineOrServiceType("testString") - getServiceDetailOptionsModel.SetID("testString") - getServiceDetailOptionsModel.SetDatabase("testString") - getServiceDetailOptionsModel.SetInternalHost(false) - getServiceDetailOptionsModel.SetAuthInstanceID("testString") - getServiceDetailOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getServiceDetailOptionsModel).ToNot(BeNil()) - Expect(getServiceDetailOptionsModel.Target).To(Equal(core.StringPtr("testString"))) - Expect(getServiceDetailOptionsModel.EngineOrServiceType).To(Equal(core.StringPtr("testString"))) - Expect(getServiceDetailOptionsModel.ID).To(Equal(core.StringPtr("testString"))) - Expect(getServiceDetailOptionsModel.Database).To(Equal(core.StringPtr("testString"))) - Expect(getServiceDetailOptionsModel.InternalHost).To(Equal(core.BoolPtr(false))) - Expect(getServiceDetailOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getServiceDetailOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewGetServicesDetailsOptions successfully`, func() { - // Construct an instance of the GetServicesDetailsOptions model - target := "testString" - engineOrServiceType := "testString" - getServicesDetailsOptionsModel := watsonxDataService.NewGetServicesDetailsOptions(target, engineOrServiceType) - getServicesDetailsOptionsModel.SetTarget("testString") - getServicesDetailsOptionsModel.SetEngineOrServiceType("testString") - getServicesDetailsOptionsModel.SetInternalHost(false) - getServicesDetailsOptionsModel.SetAuthInstanceID("testString") - getServicesDetailsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getServicesDetailsOptionsModel).ToNot(BeNil()) - Expect(getServicesDetailsOptionsModel.Target).To(Equal(core.StringPtr("testString"))) - Expect(getServicesDetailsOptionsModel.EngineOrServiceType).To(Equal(core.StringPtr("testString"))) - Expect(getServicesDetailsOptionsModel.InternalHost).To(Equal(core.BoolPtr(false))) - Expect(getServicesDetailsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getServicesDetailsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewGetSparkEngineApplicationStatusOptions successfully`, func() { // Construct an instance of the GetSparkEngineApplicationStatusOptions model engineID := "testString" - applicationID := "testString" - getSparkEngineApplicationStatusOptionsModel := watsonxDataService.NewGetSparkEngineApplicationStatusOptions(engineID, applicationID) + id := "testString" + getSparkEngineApplicationStatusOptionsModel := watsonxDataService.NewGetSparkEngineApplicationStatusOptions(engineID, id) getSparkEngineApplicationStatusOptionsModel.SetEngineID("testString") - getSparkEngineApplicationStatusOptionsModel.SetApplicationID("testString") + getSparkEngineApplicationStatusOptionsModel.SetID("testString") getSparkEngineApplicationStatusOptionsModel.SetAuthInstanceID("testString") getSparkEngineApplicationStatusOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getSparkEngineApplicationStatusOptionsModel).ToNot(BeNil()) Expect(getSparkEngineApplicationStatusOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(getSparkEngineApplicationStatusOptionsModel.ApplicationID).To(Equal(core.StringPtr("testString"))) + Expect(getSparkEngineApplicationStatusOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getSparkEngineApplicationStatusOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getSparkEngineApplicationStatusOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetSparkEngineApplicationUiOptions successfully`, func() { + // Construct an instance of the GetSparkEngineApplicationUiOptions model + engineID := "testString" + id := "testString" + getSparkEngineApplicationUiOptionsModel := watsonxDataService.NewGetSparkEngineApplicationUiOptions(engineID, id) + getSparkEngineApplicationUiOptionsModel.SetEngineID("testString") + getSparkEngineApplicationUiOptionsModel.SetID("testString") + getSparkEngineApplicationUiOptionsModel.SetAuthInstanceID("testString") + getSparkEngineApplicationUiOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSparkEngineApplicationUiOptionsModel).ToNot(BeNil()) + Expect(getSparkEngineApplicationUiOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(getSparkEngineApplicationUiOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSparkEngineApplicationUiOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getSparkEngineApplicationUiOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetSparkEngineCatalogOptions successfully`, func() { // Construct an instance of the GetSparkEngineCatalogOptions model engineID := "testString" - catalogID := "testString" - getSparkEngineCatalogOptionsModel := watsonxDataService.NewGetSparkEngineCatalogOptions(engineID, catalogID) + id := "testString" + getSparkEngineCatalogOptionsModel := watsonxDataService.NewGetSparkEngineCatalogOptions(engineID, id) getSparkEngineCatalogOptionsModel.SetEngineID("testString") - getSparkEngineCatalogOptionsModel.SetCatalogID("testString") + getSparkEngineCatalogOptionsModel.SetID("testString") getSparkEngineCatalogOptionsModel.SetAuthInstanceID("testString") getSparkEngineCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getSparkEngineCatalogOptionsModel).ToNot(BeNil()) Expect(getSparkEngineCatalogOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(getSparkEngineCatalogOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(getSparkEngineCatalogOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getSparkEngineCatalogOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getSparkEngineCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetSparkEngineHistoryServerOptions successfully`, func() { // Construct an instance of the GetSparkEngineHistoryServerOptions model - engineID := "testString" - getSparkEngineHistoryServerOptionsModel := watsonxDataService.NewGetSparkEngineHistoryServerOptions(engineID) - getSparkEngineHistoryServerOptionsModel.SetEngineID("testString") + id := "testString" + getSparkEngineHistoryServerOptionsModel := watsonxDataService.NewGetSparkEngineHistoryServerOptions(id) + getSparkEngineHistoryServerOptionsModel.SetID("testString") getSparkEngineHistoryServerOptionsModel.SetAuthInstanceID("testString") getSparkEngineHistoryServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getSparkEngineHistoryServerOptionsModel).ToNot(BeNil()) - Expect(getSparkEngineHistoryServerOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(getSparkEngineHistoryServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getSparkEngineHistoryServerOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getSparkEngineHistoryServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewGetSparkEngineHistoryServerUiOptions successfully`, func() { + // Construct an instance of the GetSparkEngineHistoryServerUiOptions model + id := "testString" + getSparkEngineHistoryServerUiOptionsModel := watsonxDataService.NewGetSparkEngineHistoryServerUiOptions(id) + getSparkEngineHistoryServerUiOptionsModel.SetID("testString") + getSparkEngineHistoryServerUiOptionsModel.SetAuthInstanceID("testString") + getSparkEngineHistoryServerUiOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getSparkEngineHistoryServerUiOptionsModel).ToNot(BeNil()) + Expect(getSparkEngineHistoryServerUiOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getSparkEngineHistoryServerUiOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getSparkEngineHistoryServerUiOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewGetSparkEngineOptions successfully`, func() { // Construct an instance of the GetSparkEngineOptions model - engineID := "testString" - getSparkEngineOptionsModel := watsonxDataService.NewGetSparkEngineOptions(engineID) - getSparkEngineOptionsModel.SetEngineID("testString") + id := "testString" + getSparkEngineOptionsModel := watsonxDataService.NewGetSparkEngineOptions(id) + getSparkEngineOptionsModel.SetID("testString") getSparkEngineOptionsModel.SetAuthInstanceID("testString") getSparkEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getSparkEngineOptionsModel).ToNot(BeNil()) - Expect(getSparkEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(getSparkEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(getSparkEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getSparkEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewGetTableDetailsOptions successfully`, func() { - // Construct an instance of the GetTableDetailsOptions model - tableName := "testString" - getTableDetailsOptionsModel := watsonxDataService.NewGetTableDetailsOptions(tableName) - getTableDetailsOptionsModel.SetTableName("testString") - getTableDetailsOptionsModel.SetCatalogName("testString") - getTableDetailsOptionsModel.SetSchemaName("testString") - getTableDetailsOptionsModel.SetAuthInstanceID("testString") - getTableDetailsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(getTableDetailsOptionsModel).ToNot(BeNil()) - Expect(getTableDetailsOptionsModel.TableName).To(Equal(core.StringPtr("testString"))) - Expect(getTableDetailsOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) - Expect(getTableDetailsOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) - Expect(getTableDetailsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(getTableDetailsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + It(`Invoke NewGetStorageObjectPropertiesOptions successfully`, func() { + // Construct an instance of the Path model + pathModel := new(watsonxdatav3.Path) + Expect(pathModel).ToNot(BeNil()) + pathModel.Path = core.StringPtr("testString") + Expect(pathModel.Path).To(Equal(core.StringPtr("testString"))) + + // Construct an instance of the GetStorageObjectPropertiesOptions model + storageID := "testString" + getStorageObjectPropertiesOptionsModel := watsonxDataService.NewGetStorageObjectPropertiesOptions(storageID) + getStorageObjectPropertiesOptionsModel.SetStorageID("testString") + getStorageObjectPropertiesOptionsModel.SetPaths([]watsonxdatav3.Path{*pathModel}) + getStorageObjectPropertiesOptionsModel.SetAuthInstanceID("testString") + getStorageObjectPropertiesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getStorageObjectPropertiesOptionsModel).ToNot(BeNil()) + Expect(getStorageObjectPropertiesOptionsModel.StorageID).To(Equal(core.StringPtr("testString"))) + Expect(getStorageObjectPropertiesOptionsModel.Paths).To(Equal([]watsonxdatav3.Path{*pathModel})) + Expect(getStorageObjectPropertiesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getStorageObjectPropertiesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewGetStorageRegistrationOptions successfully`, func() { + // Construct an instance of the GetStorageRegistrationOptions model + id := "testString" + getStorageRegistrationOptionsModel := watsonxDataService.NewGetStorageRegistrationOptions(id) + getStorageRegistrationOptionsModel.SetID("testString") + getStorageRegistrationOptionsModel.SetAuthInstanceID("testString") + getStorageRegistrationOptionsModel.SetSkipMdsCall(false) + getStorageRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(getStorageRegistrationOptionsModel).ToNot(BeNil()) + Expect(getStorageRegistrationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(getStorageRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(getStorageRegistrationOptionsModel.SkipMdsCall).To(Equal(core.BoolPtr(false))) + Expect(getStorageRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewGetTableOptions successfully`, func() { // Construct an instance of the GetTableOptions model - catalogID := "testString" - schemaID := "testString" - tableID := "testString" + catalogName := "testString" + schemaName := "testString" + tableName := "testString" engineID := "testString" - getTableOptionsModel := watsonxDataService.NewGetTableOptions(catalogID, schemaID, tableID, engineID) - getTableOptionsModel.SetCatalogID("testString") - getTableOptionsModel.SetSchemaID("testString") - getTableOptionsModel.SetTableID("testString") + getTableOptionsModel := watsonxDataService.NewGetTableOptions(catalogName, schemaName, tableName, engineID) + getTableOptionsModel.SetCatalogName("testString") + getTableOptionsModel.SetSchemaName("testString") + getTableOptionsModel.SetTableName("testString") getTableOptionsModel.SetEngineID("testString") getTableOptionsModel.SetType("testString") getTableOptionsModel.SetAuthInstanceID("testString") getTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(getTableOptionsModel).ToNot(BeNil()) - Expect(getTableOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(getTableOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) - Expect(getTableOptionsModel.TableID).To(Equal(core.StringPtr("testString"))) + Expect(getTableOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(getTableOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(getTableOptionsModel.TableName).To(Equal(core.StringPtr("testString"))) Expect(getTableOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) Expect(getTableOptionsModel.Type).To(Equal(core.StringPtr("testString"))) Expect(getTableOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(getTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewJSONPatchOperation successfully`, func() { + op := "add" + path := "testString" + _model, err := watsonxDataService.NewJSONPatchOperation(op, path) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewListAllIntegrationsOptions successfully`, func() { // Construct an instance of the ListAllIntegrationsOptions model listAllIntegrationsOptionsModel := watsonxDataService.NewListAllIntegrationsOptions() listAllIntegrationsOptionsModel.SetAuthInstanceID("testString") listAllIntegrationsOptionsModel.SetSecret("testString") - listAllIntegrationsOptionsModel.SetServiceType("testString") - listAllIntegrationsOptionsModel.SetState([]string{"testString"}) + listAllIntegrationsOptionsModel.SetType([]string{"testString"}) + listAllIntegrationsOptionsModel.SetState([]string{"active"}) listAllIntegrationsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listAllIntegrationsOptionsModel).ToNot(BeNil()) Expect(listAllIntegrationsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listAllIntegrationsOptionsModel.Secret).To(Equal(core.StringPtr("testString"))) - Expect(listAllIntegrationsOptionsModel.ServiceType).To(Equal(core.StringPtr("testString"))) - Expect(listAllIntegrationsOptionsModel.State).To(Equal([]string{"testString"})) + Expect(listAllIntegrationsOptionsModel.Type).To(Equal([]string{"testString"})) + Expect(listAllIntegrationsOptionsModel.State).To(Equal([]string{"active"})) Expect(listAllIntegrationsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewListAllSchemasOptions successfully`, func() { - // Construct an instance of the ListAllSchemasOptions model - listAllSchemasOptionsModel := watsonxDataService.NewListAllSchemasOptions() - listAllSchemasOptionsModel.SetCatalogName("testString") - listAllSchemasOptionsModel.SetAuthInstanceID("testString") - listAllSchemasOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listAllSchemasOptionsModel).ToNot(BeNil()) - Expect(listAllSchemasOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) - Expect(listAllSchemasOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listAllSchemasOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListAllTablesOptions successfully`, func() { - // Construct an instance of the ListAllTablesOptions model - listAllTablesOptionsModel := watsonxDataService.NewListAllTablesOptions() - listAllTablesOptionsModel.SetCatalogName("testString") - listAllTablesOptionsModel.SetSchemaName("testString") - listAllTablesOptionsModel.SetAuthInstanceID("testString") - listAllTablesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listAllTablesOptionsModel).ToNot(BeNil()) - Expect(listAllTablesOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) - Expect(listAllTablesOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) - Expect(listAllTablesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listAllTablesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListBucketObjectsOptions successfully`, func() { - // Construct an instance of the ListBucketObjectsOptions model - bucketID := "testString" - listBucketObjectsOptionsModel := watsonxDataService.NewListBucketObjectsOptions(bucketID) - listBucketObjectsOptionsModel.SetBucketID("testString") - listBucketObjectsOptionsModel.SetAuthInstanceID("testString") - listBucketObjectsOptionsModel.SetPath("testString") - listBucketObjectsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBucketObjectsOptionsModel).ToNot(BeNil()) - Expect(listBucketObjectsOptionsModel.BucketID).To(Equal(core.StringPtr("testString"))) - Expect(listBucketObjectsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listBucketObjectsOptionsModel.Path).To(Equal(core.StringPtr("testString"))) - Expect(listBucketObjectsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListBucketRegistrationsOptions successfully`, func() { - // Construct an instance of the ListBucketRegistrationsOptions model - listBucketRegistrationsOptionsModel := watsonxDataService.NewListBucketRegistrationsOptions() - listBucketRegistrationsOptionsModel.SetAuthInstanceID("testString") - listBucketRegistrationsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listBucketRegistrationsOptionsModel).ToNot(BeNil()) - Expect(listBucketRegistrationsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listBucketRegistrationsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewListCatalogsOptions successfully`, func() { // Construct an instance of the ListCatalogsOptions model listCatalogsOptionsModel := watsonxDataService.NewListCatalogsOptions() listCatalogsOptionsModel.SetAuthInstanceID("testString") + listCatalogsOptionsModel.SetSecret("testString") + listCatalogsOptionsModel.SetDefaultCatalogs(false) + listCatalogsOptionsModel.SetView("testString") listCatalogsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listCatalogsOptionsModel).ToNot(BeNil()) Expect(listCatalogsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogsOptionsModel.Secret).To(Equal(core.StringPtr("testString"))) + Expect(listCatalogsOptionsModel.DefaultCatalogs).To(Equal(core.BoolPtr(false))) + Expect(listCatalogsOptionsModel.View).To(Equal(core.StringPtr("testString"))) Expect(listCatalogsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListColumnsOptions successfully`, func() { // Construct an instance of the ListColumnsOptions model engineID := "testString" - catalogID := "testString" - schemaID := "testString" - tableID := "testString" - listColumnsOptionsModel := watsonxDataService.NewListColumnsOptions(engineID, catalogID, schemaID, tableID) + catalogName := "testString" + schemaName := "testString" + tableName := "testString" + listColumnsOptionsModel := watsonxDataService.NewListColumnsOptions(engineID, catalogName, schemaName, tableName) listColumnsOptionsModel.SetEngineID("testString") - listColumnsOptionsModel.SetCatalogID("testString") - listColumnsOptionsModel.SetSchemaID("testString") - listColumnsOptionsModel.SetTableID("testString") + listColumnsOptionsModel.SetCatalogName("testString") + listColumnsOptionsModel.SetSchemaName("testString") + listColumnsOptionsModel.SetTableName("testString") listColumnsOptionsModel.SetAuthInstanceID("testString") listColumnsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listColumnsOptionsModel).ToNot(BeNil()) Expect(listColumnsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(listColumnsOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(listColumnsOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) - Expect(listColumnsOptionsModel.TableID).To(Equal(core.StringPtr("testString"))) + Expect(listColumnsOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(listColumnsOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(listColumnsOptionsModel.TableName).To(Equal(core.StringPtr("testString"))) Expect(listColumnsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listColumnsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListDataPoliciesOptions successfully`, func() { + // Construct an instance of the ListDataPoliciesOptions model + listDataPoliciesOptionsModel := watsonxDataService.NewListDataPoliciesOptions() + listDataPoliciesOptionsModel.SetAuthInstanceID("testString") + listDataPoliciesOptionsModel.SetCatalogName("testString") + listDataPoliciesOptionsModel.SetResourceID("testString") + listDataPoliciesOptionsModel.SetStatus("testString") + listDataPoliciesOptionsModel.SetIncludeMetadata(true) + listDataPoliciesOptionsModel.SetIncludeRules(true) + listDataPoliciesOptionsModel.SetBucketName("testString") + listDataPoliciesOptionsModel.SetServiceName("testString") + listDataPoliciesOptionsModel.SetDataArtifact("testString") + listDataPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listDataPoliciesOptionsModel).ToNot(BeNil()) + Expect(listDataPoliciesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listDataPoliciesOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(listDataPoliciesOptionsModel.ResourceID).To(Equal(core.StringPtr("testString"))) + Expect(listDataPoliciesOptionsModel.Status).To(Equal(core.StringPtr("testString"))) + Expect(listDataPoliciesOptionsModel.IncludeMetadata).To(Equal(core.BoolPtr(true))) + Expect(listDataPoliciesOptionsModel.IncludeRules).To(Equal(core.BoolPtr(true))) + Expect(listDataPoliciesOptionsModel.BucketName).To(Equal(core.StringPtr("testString"))) + Expect(listDataPoliciesOptionsModel.ServiceName).To(Equal(core.StringPtr("testString"))) + Expect(listDataPoliciesOptionsModel.DataArtifact).To(Equal(core.StringPtr("testString"))) + Expect(listDataPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListDatabaseRegistrationsOptions successfully`, func() { // Construct an instance of the ListDatabaseRegistrationsOptions model listDatabaseRegistrationsOptionsModel := watsonxDataService.NewListDatabaseRegistrationsOptions() @@ -37867,52 +40751,20 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(listDb2EnginesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listDb2EnginesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewListDriverRegistrationOptions successfully`, func() { - // Construct an instance of the ListDriverRegistrationOptions model - listDriverRegistrationOptionsModel := watsonxDataService.NewListDriverRegistrationOptions() - listDriverRegistrationOptionsModel.SetAuthInstanceID("testString") - listDriverRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listDriverRegistrationOptionsModel).ToNot(BeNil()) - Expect(listDriverRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listDriverRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewListIngestionJobsOptions successfully`, func() { // Construct an instance of the ListIngestionJobsOptions model authInstanceID := "testString" listIngestionJobsOptionsModel := watsonxDataService.NewListIngestionJobsOptions(authInstanceID) listIngestionJobsOptionsModel.SetAuthInstanceID("testString") - listIngestionJobsOptionsModel.SetStart("1") - listIngestionJobsOptionsModel.SetJobsPerPage(int64(1)) + listIngestionJobsOptionsModel.SetStart("testString") + listIngestionJobsOptionsModel.SetLimit(int64(10)) listIngestionJobsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listIngestionJobsOptionsModel).ToNot(BeNil()) Expect(listIngestionJobsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listIngestionJobsOptionsModel.Start).To(Equal(core.StringPtr("1"))) - Expect(listIngestionJobsOptionsModel.JobsPerPage).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listIngestionJobsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) + Expect(listIngestionJobsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) Expect(listIngestionJobsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewListInstanceDetailsOptions successfully`, func() { - // Construct an instance of the ListInstanceDetailsOptions model - listInstanceDetailsOptionsModel := watsonxDataService.NewListInstanceDetailsOptions() - listInstanceDetailsOptionsModel.SetAuthInstanceID("testString") - listInstanceDetailsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceDetailsOptionsModel).ToNot(BeNil()) - Expect(listInstanceDetailsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceDetailsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) - It(`Invoke NewListInstanceServiceDetailsOptions successfully`, func() { - // Construct an instance of the ListInstanceServiceDetailsOptions model - target := "testString" - listInstanceServiceDetailsOptionsModel := watsonxDataService.NewListInstanceServiceDetailsOptions(target) - listInstanceServiceDetailsOptionsModel.SetTarget("testString") - listInstanceServiceDetailsOptionsModel.SetInternalHost(false) - listInstanceServiceDetailsOptionsModel.SetAuthInstanceID("testString") - listInstanceServiceDetailsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listInstanceServiceDetailsOptionsModel).ToNot(BeNil()) - Expect(listInstanceServiceDetailsOptionsModel.Target).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceServiceDetailsOptionsModel.InternalHost).To(Equal(core.BoolPtr(false))) - Expect(listInstanceServiceDetailsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listInstanceServiceDetailsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewListMilvusDatabaseCollectionsOptions successfully`, func() { // Construct an instance of the ListMilvusDatabaseCollectionsOptions model serviceID := "testString" @@ -37928,6 +40780,24 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(listMilvusDatabaseCollectionsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listMilvusDatabaseCollectionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListMilvusDatabasePartitionsOptions successfully`, func() { + // Construct an instance of the ListMilvusDatabasePartitionsOptions model + serviceID := "testString" + databaseID := "testString" + collectionName := "testString" + listMilvusDatabasePartitionsOptionsModel := watsonxDataService.NewListMilvusDatabasePartitionsOptions(serviceID, databaseID, collectionName) + listMilvusDatabasePartitionsOptionsModel.SetServiceID("testString") + listMilvusDatabasePartitionsOptionsModel.SetDatabaseID("testString") + listMilvusDatabasePartitionsOptionsModel.SetCollectionName("testString") + listMilvusDatabasePartitionsOptionsModel.SetAuthInstanceID("testString") + listMilvusDatabasePartitionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listMilvusDatabasePartitionsOptionsModel).ToNot(BeNil()) + Expect(listMilvusDatabasePartitionsOptionsModel.ServiceID).To(Equal(core.StringPtr("testString"))) + Expect(listMilvusDatabasePartitionsOptionsModel.DatabaseID).To(Equal(core.StringPtr("testString"))) + Expect(listMilvusDatabasePartitionsOptionsModel.CollectionName).To(Equal(core.StringPtr("testString"))) + Expect(listMilvusDatabasePartitionsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listMilvusDatabasePartitionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListMilvusServiceDatabasesOptions successfully`, func() { // Construct an instance of the ListMilvusServiceDatabasesOptions model serviceID := "testString" @@ -37969,13 +40839,13 @@ var _ = Describe(`WatsonxDataV2`, func() { }) It(`Invoke NewListPrestissimoEngineCatalogsOptions successfully`, func() { // Construct an instance of the ListPrestissimoEngineCatalogsOptions model - engineID := "testString" - listPrestissimoEngineCatalogsOptionsModel := watsonxDataService.NewListPrestissimoEngineCatalogsOptions(engineID) - listPrestissimoEngineCatalogsOptionsModel.SetEngineID("testString") + id := "testString" + listPrestissimoEngineCatalogsOptionsModel := watsonxDataService.NewListPrestissimoEngineCatalogsOptions(id) + listPrestissimoEngineCatalogsOptionsModel.SetID("testString") listPrestissimoEngineCatalogsOptionsModel.SetAuthInstanceID("testString") listPrestissimoEngineCatalogsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listPrestissimoEngineCatalogsOptionsModel).ToNot(BeNil()) - Expect(listPrestissimoEngineCatalogsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(listPrestissimoEngineCatalogsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(listPrestissimoEngineCatalogsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listPrestissimoEngineCatalogsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -38009,44 +40879,142 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(listPrestoEnginesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listPrestoEnginesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListResourceAccessPoliciesOptions successfully`, func() { + // Construct an instance of the ListResourceAccessPoliciesOptions model + listResourceAccessPoliciesOptionsModel := watsonxDataService.NewListResourceAccessPoliciesOptions() + listResourceAccessPoliciesOptionsModel.SetAuthInstanceID("testString") + listResourceAccessPoliciesOptionsModel.SetResourceType("catalog") + listResourceAccessPoliciesOptionsModel.SetResourceID([]string{"testString"}) + listResourceAccessPoliciesOptionsModel.SetResourceName([]string{"testString"}) + listResourceAccessPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listResourceAccessPoliciesOptionsModel).ToNot(BeNil()) + Expect(listResourceAccessPoliciesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listResourceAccessPoliciesOptionsModel.ResourceType).To(Equal(core.StringPtr("catalog"))) + Expect(listResourceAccessPoliciesOptionsModel.ResourceID).To(Equal([]string{"testString"})) + Expect(listResourceAccessPoliciesOptionsModel.ResourceName).To(Equal([]string{"testString"})) + Expect(listResourceAccessPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListSalIntegrationEnrichmentAssetsOptions successfully`, func() { + // Construct an instance of the ListSalIntegrationEnrichmentAssetsOptions model + projectID := "testString" + listSalIntegrationEnrichmentAssetsOptionsModel := watsonxDataService.NewListSalIntegrationEnrichmentAssetsOptions(projectID) + listSalIntegrationEnrichmentAssetsOptionsModel.SetProjectID("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.SetAuthInstanceID("testString") + listSalIntegrationEnrichmentAssetsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listSalIntegrationEnrichmentAssetsOptionsModel).ToNot(BeNil()) + Expect(listSalIntegrationEnrichmentAssetsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(listSalIntegrationEnrichmentAssetsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listSalIntegrationEnrichmentAssetsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListSalIntegrationEnrichmentJobRunsOptions successfully`, func() { + // Construct an instance of the ListSalIntegrationEnrichmentJobRunsOptions model + jobID := "testString" + projectID := "testString" + listSalIntegrationEnrichmentJobRunsOptionsModel := watsonxDataService.NewListSalIntegrationEnrichmentJobRunsOptions(jobID, projectID) + listSalIntegrationEnrichmentJobRunsOptionsModel.SetJobID("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.SetProjectID("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.SetAuthInstanceID("testString") + listSalIntegrationEnrichmentJobRunsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listSalIntegrationEnrichmentJobRunsOptionsModel).ToNot(BeNil()) + Expect(listSalIntegrationEnrichmentJobRunsOptionsModel.JobID).To(Equal(core.StringPtr("testString"))) + Expect(listSalIntegrationEnrichmentJobRunsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(listSalIntegrationEnrichmentJobRunsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listSalIntegrationEnrichmentJobRunsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListSalIntegrationEnrichmentJobsOptions successfully`, func() { + // Construct an instance of the ListSalIntegrationEnrichmentJobsOptions model + projectID := "testString" + listSalIntegrationEnrichmentJobsOptionsModel := watsonxDataService.NewListSalIntegrationEnrichmentJobsOptions(projectID) + listSalIntegrationEnrichmentJobsOptionsModel.SetProjectID("testString") + listSalIntegrationEnrichmentJobsOptionsModel.SetAuthInstanceID("testString") + listSalIntegrationEnrichmentJobsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listSalIntegrationEnrichmentJobsOptionsModel).ToNot(BeNil()) + Expect(listSalIntegrationEnrichmentJobsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(listSalIntegrationEnrichmentJobsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listSalIntegrationEnrichmentJobsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListSalIntegrationEnrichmentMappingsOptions successfully`, func() { + // Construct an instance of the ListSalIntegrationEnrichmentMappingsOptions model + listSalIntegrationEnrichmentMappingsOptionsModel := watsonxDataService.NewListSalIntegrationEnrichmentMappingsOptions() + listSalIntegrationEnrichmentMappingsOptionsModel.SetCatalogName("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.SetSchemaName("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.SetNext("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.SetAuthInstanceID("testString") + listSalIntegrationEnrichmentMappingsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listSalIntegrationEnrichmentMappingsOptionsModel).ToNot(BeNil()) + Expect(listSalIntegrationEnrichmentMappingsOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(listSalIntegrationEnrichmentMappingsOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(listSalIntegrationEnrichmentMappingsOptionsModel.Next).To(Equal(core.StringPtr("testString"))) + Expect(listSalIntegrationEnrichmentMappingsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listSalIntegrationEnrichmentMappingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListSchemasOptions successfully`, func() { // Construct an instance of the ListSchemasOptions model engineID := "testString" - catalogID := "testString" - listSchemasOptionsModel := watsonxDataService.NewListSchemasOptions(engineID, catalogID) + id := "testString" + listSchemasOptionsModel := watsonxDataService.NewListSchemasOptions(engineID, id) listSchemasOptionsModel.SetEngineID("testString") - listSchemasOptionsModel.SetCatalogID("testString") + listSchemasOptionsModel.SetID("testString") listSchemasOptionsModel.SetAuthInstanceID("testString") listSchemasOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listSchemasOptionsModel).ToNot(BeNil()) Expect(listSchemasOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(listSchemasOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) + Expect(listSchemasOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(listSchemasOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listSchemasOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewListSemanticSearchQueriesOptions successfully`, func() { + // Construct an instance of the ListSemanticSearchQueriesOptions model + listSemanticSearchQueriesOptionsModel := watsonxDataService.NewListSemanticSearchQueriesOptions() + listSemanticSearchQueriesOptionsModel.SetEngineID("testString") + listSemanticSearchQueriesOptionsModel.SetSchemaSearchEnabled(true) + listSemanticSearchQueriesOptionsModel.SetColumnSearchEnabled(true) + listSemanticSearchQueriesOptionsModel.SetMaxResultNumber(int64(5)) + listSemanticSearchQueriesOptionsModel.SetRunSearch(true) + listSemanticSearchQueriesOptionsModel.SetAuthInstanceID("testString") + listSemanticSearchQueriesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listSemanticSearchQueriesOptionsModel).ToNot(BeNil()) + Expect(listSemanticSearchQueriesOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(listSemanticSearchQueriesOptionsModel.SchemaSearchEnabled).To(Equal(core.BoolPtr(true))) + Expect(listSemanticSearchQueriesOptionsModel.ColumnSearchEnabled).To(Equal(core.BoolPtr(true))) + Expect(listSemanticSearchQueriesOptionsModel.MaxResultNumber).To(Equal(core.Int64Ptr(int64(5)))) + Expect(listSemanticSearchQueriesOptionsModel.RunSearch).To(Equal(core.BoolPtr(true))) + Expect(listSemanticSearchQueriesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listSemanticSearchQueriesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewListSparkEngineApplicationsOptions successfully`, func() { // Construct an instance of the ListSparkEngineApplicationsOptions model - engineID := "testString" - listSparkEngineApplicationsOptionsModel := watsonxDataService.NewListSparkEngineApplicationsOptions(engineID) - listSparkEngineApplicationsOptionsModel.SetEngineID("testString") + id := "testString" + listSparkEngineApplicationsOptionsModel := watsonxDataService.NewListSparkEngineApplicationsOptions(id) + listSparkEngineApplicationsOptionsModel.SetID("testString") listSparkEngineApplicationsOptionsModel.SetAuthInstanceID("testString") listSparkEngineApplicationsOptionsModel.SetState([]string{"testString"}) + listSparkEngineApplicationsOptionsModel.SetSubmissionTimeInterval("testString") + listSparkEngineApplicationsOptionsModel.SetStartTimeInterval("testString") + listSparkEngineApplicationsOptionsModel.SetEndTimeInterval("testString") + listSparkEngineApplicationsOptionsModel.SetLimit(int64(10)) + listSparkEngineApplicationsOptionsModel.SetStart("testString") listSparkEngineApplicationsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listSparkEngineApplicationsOptionsModel).ToNot(BeNil()) - Expect(listSparkEngineApplicationsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(listSparkEngineApplicationsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(listSparkEngineApplicationsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listSparkEngineApplicationsOptionsModel.State).To(Equal([]string{"testString"})) + Expect(listSparkEngineApplicationsOptionsModel.SubmissionTimeInterval).To(Equal(core.StringPtr("testString"))) + Expect(listSparkEngineApplicationsOptionsModel.StartTimeInterval).To(Equal(core.StringPtr("testString"))) + Expect(listSparkEngineApplicationsOptionsModel.EndTimeInterval).To(Equal(core.StringPtr("testString"))) + Expect(listSparkEngineApplicationsOptionsModel.Limit).To(Equal(core.Int64Ptr(int64(10)))) + Expect(listSparkEngineApplicationsOptionsModel.Start).To(Equal(core.StringPtr("testString"))) Expect(listSparkEngineApplicationsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListSparkEngineCatalogsOptions successfully`, func() { // Construct an instance of the ListSparkEngineCatalogsOptions model - engineID := "testString" - listSparkEngineCatalogsOptionsModel := watsonxDataService.NewListSparkEngineCatalogsOptions(engineID) - listSparkEngineCatalogsOptionsModel.SetEngineID("testString") + id := "testString" + listSparkEngineCatalogsOptionsModel := watsonxDataService.NewListSparkEngineCatalogsOptions(id) + listSparkEngineCatalogsOptionsModel.SetID("testString") listSparkEngineCatalogsOptionsModel.SetAuthInstanceID("testString") listSparkEngineCatalogsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listSparkEngineCatalogsOptionsModel).ToNot(BeNil()) - Expect(listSparkEngineCatalogsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(listSparkEngineCatalogsOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(listSparkEngineCatalogsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listSparkEngineCatalogsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) @@ -38059,50 +41027,71 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(listSparkEnginesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listSparkEnginesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewListSparkVersionsOptions successfully`, func() { - // Construct an instance of the ListSparkVersionsOptions model - listSparkVersionsOptionsModel := watsonxDataService.NewListSparkVersionsOptions() - listSparkVersionsOptionsModel.SetAuthInstanceID("testString") - listSparkVersionsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(listSparkVersionsOptionsModel).ToNot(BeNil()) - Expect(listSparkVersionsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(listSparkVersionsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + It(`Invoke NewListStorageRegistrationsObjectsOptions successfully`, func() { + // Construct an instance of the ListStorageRegistrationsObjectsOptions model + storageID := "testString" + listStorageRegistrationsObjectsOptionsModel := watsonxDataService.NewListStorageRegistrationsObjectsOptions(storageID) + listStorageRegistrationsObjectsOptionsModel.SetStorageID("testString") + listStorageRegistrationsObjectsOptionsModel.SetAuthInstanceID("testString") + listStorageRegistrationsObjectsOptionsModel.SetPath("testString") + listStorageRegistrationsObjectsOptionsModel.SetPaginated(true) + listStorageRegistrationsObjectsOptionsModel.SetPageSize(int64(1)) + listStorageRegistrationsObjectsOptionsModel.SetPrefix("testString") + listStorageRegistrationsObjectsOptionsModel.SetStartAfter("testString") + listStorageRegistrationsObjectsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listStorageRegistrationsObjectsOptionsModel).ToNot(BeNil()) + Expect(listStorageRegistrationsObjectsOptionsModel.StorageID).To(Equal(core.StringPtr("testString"))) + Expect(listStorageRegistrationsObjectsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listStorageRegistrationsObjectsOptionsModel.Path).To(Equal(core.StringPtr("testString"))) + Expect(listStorageRegistrationsObjectsOptionsModel.Paginated).To(Equal(core.BoolPtr(true))) + Expect(listStorageRegistrationsObjectsOptionsModel.PageSize).To(Equal(core.Int64Ptr(int64(1)))) + Expect(listStorageRegistrationsObjectsOptionsModel.Prefix).To(Equal(core.StringPtr("testString"))) + Expect(listStorageRegistrationsObjectsOptionsModel.StartAfter).To(Equal(core.StringPtr("testString"))) + Expect(listStorageRegistrationsObjectsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewListStorageRegistrationsOptions successfully`, func() { + // Construct an instance of the ListStorageRegistrationsOptions model + listStorageRegistrationsOptionsModel := watsonxDataService.NewListStorageRegistrationsOptions() + listStorageRegistrationsOptionsModel.SetAuthInstanceID("testString") + listStorageRegistrationsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(listStorageRegistrationsOptionsModel).ToNot(BeNil()) + Expect(listStorageRegistrationsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(listStorageRegistrationsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListTableSnapshotsOptions successfully`, func() { // Construct an instance of the ListTableSnapshotsOptions model - engineID := "testString" - catalogID := "testString" - schemaID := "testString" - tableID := "testString" - listTableSnapshotsOptionsModel := watsonxDataService.NewListTableSnapshotsOptions(engineID, catalogID, schemaID, tableID) + catalogName := "testString" + schemaName := "testString" + tableName := "testString" + listTableSnapshotsOptionsModel := watsonxDataService.NewListTableSnapshotsOptions(catalogName, schemaName, tableName) + listTableSnapshotsOptionsModel.SetCatalogName("testString") + listTableSnapshotsOptionsModel.SetSchemaName("testString") + listTableSnapshotsOptionsModel.SetTableName("testString") listTableSnapshotsOptionsModel.SetEngineID("testString") - listTableSnapshotsOptionsModel.SetCatalogID("testString") - listTableSnapshotsOptionsModel.SetSchemaID("testString") - listTableSnapshotsOptionsModel.SetTableID("testString") listTableSnapshotsOptionsModel.SetAuthInstanceID("testString") listTableSnapshotsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listTableSnapshotsOptionsModel).ToNot(BeNil()) + Expect(listTableSnapshotsOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(listTableSnapshotsOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(listTableSnapshotsOptionsModel.TableName).To(Equal(core.StringPtr("testString"))) Expect(listTableSnapshotsOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(listTableSnapshotsOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(listTableSnapshotsOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) - Expect(listTableSnapshotsOptionsModel.TableID).To(Equal(core.StringPtr("testString"))) Expect(listTableSnapshotsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listTableSnapshotsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewListTablesOptions successfully`, func() { // Construct an instance of the ListTablesOptions model - catalogID := "testString" - schemaID := "testString" + catalogName := "testString" + schemaName := "testString" engineID := "testString" - listTablesOptionsModel := watsonxDataService.NewListTablesOptions(catalogID, schemaID, engineID) - listTablesOptionsModel.SetCatalogID("testString") - listTablesOptionsModel.SetSchemaID("testString") + listTablesOptionsModel := watsonxDataService.NewListTablesOptions(catalogName, schemaName, engineID) + listTablesOptionsModel.SetCatalogName("testString") + listTablesOptionsModel.SetSchemaName("testString") listTablesOptionsModel.SetEngineID("testString") listTablesOptionsModel.SetAuthInstanceID("testString") listTablesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(listTablesOptionsModel).ToNot(BeNil()) - Expect(listTablesOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(listTablesOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) + Expect(listTablesOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(listTablesOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) Expect(listTablesOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) Expect(listTablesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(listTablesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) @@ -38125,167 +41114,1039 @@ var _ = Describe(`WatsonxDataV2`, func() { Expect(loadTableOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(loadTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewOtherEngineDetailsBody successfully`, func() { + It(`Invoke NewMilvusServicePatch successfully`, func() { + // Construct an instance of the MilvusService model + milvusService := new(watsonxdatav3.MilvusService) + milvusService.AccessKey = core.StringPtr("Sample storage access key") + milvusService.Actions = []string{"update", "delete"} + milvusService.CreatedAt = core.Int64Ptr(int64(1)) + milvusService.CreatedBy = core.StringPtr("@.com") + milvusService.DcCpu = core.Float64Ptr(float64(0.01)) + milvusService.DcMemory = core.Float64Ptr(float64(0.01)) + milvusService.DcReplicas = core.Int64Ptr(int64(1)) + milvusService.Description = core.StringPtr("milvus service for running sql queries") + milvusService.DisplayName = core.StringPtr("sampleService") + milvusService.DwCpu = core.Float64Ptr(float64(0.01)) + milvusService.DwMemory = core.Float64Ptr(float64(0.01)) + milvusService.DwReplicas = core.Int64Ptr(int64(1)) + milvusService.Endpoint = core.StringPtr("testString") + milvusService.EtcdCpu = core.Float64Ptr(float64(0.01)) + milvusService.EtcdMemory = core.Float64Ptr(float64(0.01)) + milvusService.FailureMessage = core.StringPtr("Failed to start engine") + milvusService.GrpcHost = core.StringPtr("example.grpc.host") + milvusService.GrpcPort = core.Int64Ptr(int64(1)) + milvusService.HostName = core.StringPtr("sampleMilvus") + milvusService.HttpsHost = core.StringPtr("example.https.host") + milvusService.HttpsPort = core.Int64Ptr(int64(1)) + milvusService.ID = core.StringPtr("milvus123") + milvusService.IndexType = core.StringPtr("hnsw") + milvusService.IwCpu = core.Float64Ptr(float64(0.01)) + milvusService.IwMemory = core.Float64Ptr(float64(0.01)) + milvusService.IwReplicas = core.Int64Ptr(int64(1)) + milvusService.KafkaCpu = core.Float64Ptr(float64(0.01)) + milvusService.KafkaMemory = core.Float64Ptr(float64(0.01)) + milvusService.ManagedBy = core.StringPtr("customer") + milvusService.Origin = core.StringPtr("native") + milvusService.ProxyCpu = core.Float64Ptr(float64(0.01)) + milvusService.ProxyHost = core.StringPtr("example.proxy.host") + milvusService.ProxyMemory = core.Float64Ptr(float64(0.01)) + milvusService.ProxyPort = core.Int64Ptr(int64(1)) + milvusService.ProxyReplicas = core.Int64Ptr(int64(1)) + milvusService.QcCpu = core.Float64Ptr(float64(0.01)) + milvusService.QcMemory = core.Float64Ptr(float64(0.01)) + milvusService.QcReplicas = core.Int64Ptr(int64(1)) + milvusService.QwCpu = core.Float64Ptr(float64(0.01)) + milvusService.QwMemory = core.Float64Ptr(float64(0.01)) + milvusService.QwReplicas = core.Int64Ptr(int64(1)) + milvusService.RcCpu = core.Float64Ptr(float64(0.01)) + milvusService.RcMemory = core.Float64Ptr(float64(0.01)) + milvusService.RcReplicas = core.Int64Ptr(int64(1)) + milvusService.RootPath = core.StringPtr("Sample/path") + milvusService.SecretKey = core.StringPtr("Sample storage secret access key") + milvusService.Status = core.StringPtr("running") + milvusService.StatusCode = core.Int64Ptr(int64(1)) + milvusService.StorageName = core.StringPtr("Sample_storage_name") + milvusService.Tags = []string{"tag1", "tag2"} + milvusService.TshirtSize = core.StringPtr("small") + milvusService.Type = core.StringPtr("milvus") + milvusService.Vector = core.Int64Ptr(int64(1)) + milvusService.VectorDimension = core.Int64Ptr(int64(384)) + milvusService.Version = core.StringPtr("3.5") + + milvusServicePatch := watsonxDataService.NewMilvusServicePatch(milvusService) + Expect(milvusServicePatch).ToNot(BeNil()) + + _path := func(op interface{}) string { + return *op.(watsonxdatav3.JSONPatchOperation).Path + } + Expect(milvusServicePatch).To(MatchAllElements(_path, Elements{ + "/access_key": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/access_key")), + "From": BeNil(), + "Value": Equal(milvusService.AccessKey), + }), + "/actions": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/actions")), + "From": BeNil(), + "Value": Equal(milvusService.Actions), + }), + "/created_at": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/created_at")), + "From": BeNil(), + "Value": Equal(milvusService.CreatedAt), + }), + "/created_by": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/created_by")), + "From": BeNil(), + "Value": Equal(milvusService.CreatedBy), + }), + "/dc_cpu": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/dc_cpu")), + "From": BeNil(), + "Value": Equal(milvusService.DcCpu), + }), + "/dc_memory": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/dc_memory")), + "From": BeNil(), + "Value": Equal(milvusService.DcMemory), + }), + "/dc_replicas": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/dc_replicas")), + "From": BeNil(), + "Value": Equal(milvusService.DcReplicas), + }), + "/description": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/description")), + "From": BeNil(), + "Value": Equal(milvusService.Description), + }), + "/display_name": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/display_name")), + "From": BeNil(), + "Value": Equal(milvusService.DisplayName), + }), + "/dw_cpu": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/dw_cpu")), + "From": BeNil(), + "Value": Equal(milvusService.DwCpu), + }), + "/dw_memory": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/dw_memory")), + "From": BeNil(), + "Value": Equal(milvusService.DwMemory), + }), + "/dw_replicas": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/dw_replicas")), + "From": BeNil(), + "Value": Equal(milvusService.DwReplicas), + }), + "/endpoint": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/endpoint")), + "From": BeNil(), + "Value": Equal(milvusService.Endpoint), + }), + "/etcd_cpu": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/etcd_cpu")), + "From": BeNil(), + "Value": Equal(milvusService.EtcdCpu), + }), + "/etcd_memory": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/etcd_memory")), + "From": BeNil(), + "Value": Equal(milvusService.EtcdMemory), + }), + "/failure_message": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/failure_message")), + "From": BeNil(), + "Value": Equal(milvusService.FailureMessage), + }), + "/grpc_host": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/grpc_host")), + "From": BeNil(), + "Value": Equal(milvusService.GrpcHost), + }), + "/grpc_port": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/grpc_port")), + "From": BeNil(), + "Value": Equal(milvusService.GrpcPort), + }), + "/host_name": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/host_name")), + "From": BeNil(), + "Value": Equal(milvusService.HostName), + }), + "/https_host": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/https_host")), + "From": BeNil(), + "Value": Equal(milvusService.HttpsHost), + }), + "/https_port": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/https_port")), + "From": BeNil(), + "Value": Equal(milvusService.HttpsPort), + }), + "/id": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/id")), + "From": BeNil(), + "Value": Equal(milvusService.ID), + }), + "/index_type": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/index_type")), + "From": BeNil(), + "Value": Equal(milvusService.IndexType), + }), + "/iw_cpu": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/iw_cpu")), + "From": BeNil(), + "Value": Equal(milvusService.IwCpu), + }), + "/iw_memory": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/iw_memory")), + "From": BeNil(), + "Value": Equal(milvusService.IwMemory), + }), + "/iw_replicas": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/iw_replicas")), + "From": BeNil(), + "Value": Equal(milvusService.IwReplicas), + }), + "/kafka_cpu": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/kafka_cpu")), + "From": BeNil(), + "Value": Equal(milvusService.KafkaCpu), + }), + "/kafka_memory": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/kafka_memory")), + "From": BeNil(), + "Value": Equal(milvusService.KafkaMemory), + }), + "/managed_by": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/managed_by")), + "From": BeNil(), + "Value": Equal(milvusService.ManagedBy), + }), + "/origin": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/origin")), + "From": BeNil(), + "Value": Equal(milvusService.Origin), + }), + "/proxy_cpu": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/proxy_cpu")), + "From": BeNil(), + "Value": Equal(milvusService.ProxyCpu), + }), + "/proxy_host": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/proxy_host")), + "From": BeNil(), + "Value": Equal(milvusService.ProxyHost), + }), + "/proxy_memory": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/proxy_memory")), + "From": BeNil(), + "Value": Equal(milvusService.ProxyMemory), + }), + "/proxy_port": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/proxy_port")), + "From": BeNil(), + "Value": Equal(milvusService.ProxyPort), + }), + "/proxy_replicas": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/proxy_replicas")), + "From": BeNil(), + "Value": Equal(milvusService.ProxyReplicas), + }), + "/qc_cpu": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/qc_cpu")), + "From": BeNil(), + "Value": Equal(milvusService.QcCpu), + }), + "/qc_memory": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/qc_memory")), + "From": BeNil(), + "Value": Equal(milvusService.QcMemory), + }), + "/qc_replicas": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/qc_replicas")), + "From": BeNil(), + "Value": Equal(milvusService.QcReplicas), + }), + "/qw_cpu": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/qw_cpu")), + "From": BeNil(), + "Value": Equal(milvusService.QwCpu), + }), + "/qw_memory": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/qw_memory")), + "From": BeNil(), + "Value": Equal(milvusService.QwMemory), + }), + "/qw_replicas": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/qw_replicas")), + "From": BeNil(), + "Value": Equal(milvusService.QwReplicas), + }), + "/rc_cpu": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/rc_cpu")), + "From": BeNil(), + "Value": Equal(milvusService.RcCpu), + }), + "/rc_memory": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/rc_memory")), + "From": BeNil(), + "Value": Equal(milvusService.RcMemory), + }), + "/rc_replicas": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/rc_replicas")), + "From": BeNil(), + "Value": Equal(milvusService.RcReplicas), + }), + "/root_path": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/root_path")), + "From": BeNil(), + "Value": Equal(milvusService.RootPath), + }), + "/secret_key": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/secret_key")), + "From": BeNil(), + "Value": Equal(milvusService.SecretKey), + }), + "/status": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/status")), + "From": BeNil(), + "Value": Equal(milvusService.Status), + }), + "/status_code": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/status_code")), + "From": BeNil(), + "Value": Equal(milvusService.StatusCode), + }), + "/storage_name": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/storage_name")), + "From": BeNil(), + "Value": Equal(milvusService.StorageName), + }), + "/tags": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/tags")), + "From": BeNil(), + "Value": Equal(milvusService.Tags), + }), + "/tshirt_size": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/tshirt_size")), + "From": BeNil(), + "Value": Equal(milvusService.TshirtSize), + }), + "/type": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/type")), + "From": BeNil(), + "Value": Equal(milvusService.Type), + }), + "/vector": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/vector")), + "From": BeNil(), + "Value": Equal(milvusService.Vector), + }), + "/vector_dimension": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/vector_dimension")), + "From": BeNil(), + "Value": Equal(milvusService.VectorDimension), + }), + "/version": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/version")), + "From": BeNil(), + "Value": Equal(milvusService.Version), + }), + })) + }) + It(`Invoke NewNetezzaEngineConfigurationBody successfully`, func() { + connectionString := "1.2.3.4" + _model, err := watsonxDataService.NewNetezzaEngineConfigurationBody(connectionString) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewOtherEngineConfigurationBody successfully`, func() { connectionString := "1.2.3.4" - engineType := "netezza" - _model, err := watsonxDataService.NewOtherEngineDetailsBody(connectionString, engineType) + typeVar := "netezza" + _model, err := watsonxDataService.NewOtherEngineConfigurationBody(connectionString, typeVar) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) It(`Invoke NewPausePrestissimoEngineOptions successfully`, func() { // Construct an instance of the PausePrestissimoEngineOptions model - engineID := "testString" - pausePrestissimoEngineOptionsModel := watsonxDataService.NewPausePrestissimoEngineOptions(engineID) - pausePrestissimoEngineOptionsModel.SetEngineID("testString") + id := "testString" + pausePrestissimoEngineOptionsModel := watsonxDataService.NewPausePrestissimoEngineOptions(id) + pausePrestissimoEngineOptionsModel.SetID("testString") pausePrestissimoEngineOptionsModel.SetAuthInstanceID("testString") pausePrestissimoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(pausePrestissimoEngineOptionsModel).ToNot(BeNil()) - Expect(pausePrestissimoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(pausePrestissimoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(pausePrestissimoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(pausePrestissimoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewPausePrestoEngineOptions successfully`, func() { // Construct an instance of the PausePrestoEngineOptions model - engineID := "testString" - pausePrestoEngineOptionsModel := watsonxDataService.NewPausePrestoEngineOptions(engineID) - pausePrestoEngineOptionsModel.SetEngineID("testString") + id := "testString" + pausePrestoEngineOptionsModel := watsonxDataService.NewPausePrestoEngineOptions(id) + pausePrestoEngineOptionsModel.SetID("testString") pausePrestoEngineOptionsModel.SetAuthInstanceID("testString") pausePrestoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(pausePrestoEngineOptionsModel).ToNot(BeNil()) - Expect(pausePrestoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(pausePrestoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(pausePrestoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(pausePrestoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewPauseSparkEngineOptions successfully`, func() { // Construct an instance of the PauseSparkEngineOptions model - engineID := "testString" - pauseSparkEngineOptionsModel := watsonxDataService.NewPauseSparkEngineOptions(engineID) - pauseSparkEngineOptionsModel.SetEngineID("testString") + id := "testString" + pauseSparkEngineOptionsModel := watsonxDataService.NewPauseSparkEngineOptions(id) + pauseSparkEngineOptionsModel.SetID("testString") pauseSparkEngineOptionsModel.SetForce(true) pauseSparkEngineOptionsModel.SetAuthInstanceID("testString") pauseSparkEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(pauseSparkEngineOptionsModel).ToNot(BeNil()) - Expect(pauseSparkEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(pauseSparkEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(pauseSparkEngineOptionsModel.Force).To(Equal(core.BoolPtr(true))) Expect(pauseSparkEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(pauseSparkEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewPolicyV2Patch successfully`, func() { + // Construct an instance of the GetDataPolicyMetadata model + getDataPolicyMetadataModel := new(watsonxdatav3.GetDataPolicyMetadata) + getDataPolicyMetadataModel.CreatedAt = core.StringPtr("timestamp") + getDataPolicyMetadataModel.Creator = core.StringPtr("creator") + getDataPolicyMetadataModel.Modifier = core.StringPtr("modifier") + getDataPolicyMetadataModel.Pid = core.StringPtr("pid") + getDataPolicyMetadataModel.UpdatedAt = core.StringPtr("timestamp") + getDataPolicyMetadataModel.Version = core.StringPtr("version") + + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + + // Construct an instance of the TransformColumnResponseProperties model + transformColumnResponsePropertiesModel := new(watsonxdatav3.TransformColumnResponseProperties) + transformColumnResponsePropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnResponsePropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnResponsePropertiesModel.MaskValue = core.StringPtr("NIL") + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + + // Construct an instance of the PolicyRuleV2 model + policyRuleV2Model := new(watsonxdatav3.PolicyRuleV2) + policyRuleV2Model.Actions = []string{"alter", "create"} + policyRuleV2Model.Effect = core.StringPtr("allow") + policyRuleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + policyRuleV2Model.TransformColumns = transformColumnResponsePropertiesModel + policyRuleV2Model.TransformRows = rowFilterPropertiesModel + + // Construct an instance of the PolicyV2 model + policyV2 := new(watsonxdatav3.PolicyV2) + policyV2.CatalogName = core.StringPtr("catalog1") + policyV2.DataArtifact = core.StringPtr("schema1/table1/(column1|column2)") + policyV2.Description = core.StringPtr("This is a data policy") + policyV2.Metadata = getDataPolicyMetadataModel + policyV2.PolicyName = core.StringPtr("policy1") + policyV2.ResourceID = core.StringPtr("services/milvus/milvus1") + policyV2.RuleCount = core.Int64Ptr(int64(26)) + policyV2.Rules = []watsonxdatav3.PolicyRuleV2{*policyRuleV2Model} + policyV2.Status = core.StringPtr("active") + + policyV2Patch := watsonxDataService.NewPolicyV2Patch(policyV2) + Expect(policyV2Patch).ToNot(BeNil()) + + _path := func(op interface{}) string { + return *op.(watsonxdatav3.JSONPatchOperation).Path + } + Expect(policyV2Patch).To(MatchAllElements(_path, Elements{ + "/catalog_name": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/catalog_name")), + "From": BeNil(), + "Value": Equal(policyV2.CatalogName), + }), + "/data_artifact": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/data_artifact")), + "From": BeNil(), + "Value": Equal(policyV2.DataArtifact), + }), + "/description": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/description")), + "From": BeNil(), + "Value": Equal(policyV2.Description), + }), + "/metadata": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/metadata")), + "From": BeNil(), + "Value": Equal(policyV2.Metadata), + }), + "/policy_name": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/policy_name")), + "From": BeNil(), + "Value": Equal(policyV2.PolicyName), + }), + "/resource_id": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/resource_id")), + "From": BeNil(), + "Value": Equal(policyV2.ResourceID), + }), + "/rule_count": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/rule_count")), + "From": BeNil(), + "Value": Equal(policyV2.RuleCount), + }), + "/rules": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/rules")), + "From": BeNil(), + "Value": Equal(policyV2.Rules), + }), + "/status": MatchAllFields(Fields{ + "Op": PointTo(Equal(watsonxdatav3.JSONPatchOperation_Op_Add)), + "Path": PointTo(Equal("/status")), + "From": BeNil(), + "Value": Equal(policyV2.Status), + }), + })) + }) + It(`Invoke NewPrestissimoEngineDetails successfully`, func() { + var coordinator *watsonxdatav3.NodeDescription = nil + sizeConfig := "starter" + var worker *watsonxdatav3.NodeDescription = nil + _, err := watsonxDataService.NewPrestissimoEngineDetails(coordinator, sizeConfig, worker) + Expect(err).ToNot(BeNil()) + }) It(`Invoke NewRegisterTableOptions successfully`, func() { // Construct an instance of the RegisterTableOptions model catalogID := "testString" schemaID := "testString" - registerTableOptionsMetadataLocation := "s3a://bucketname/path/to/table/metadata_location/_delta_log" + registerTableOptionsMetadataLocation := "s3a://storagename/path/to/table/metadata_location/_delta_log" registerTableOptionsTableName := "table1" registerTableOptionsModel := watsonxDataService.NewRegisterTableOptions(catalogID, schemaID, registerTableOptionsMetadataLocation, registerTableOptionsTableName) registerTableOptionsModel.SetCatalogID("testString") registerTableOptionsModel.SetSchemaID("testString") - registerTableOptionsModel.SetMetadataLocation("s3a://bucketname/path/to/table/metadata_location/_delta_log") + registerTableOptionsModel.SetMetadataLocation("s3a://storagename/path/to/table/metadata_location/_delta_log") registerTableOptionsModel.SetTableName("table1") registerTableOptionsModel.SetAuthInstanceID("testString") registerTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(registerTableOptionsModel).ToNot(BeNil()) Expect(registerTableOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) Expect(registerTableOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) - Expect(registerTableOptionsModel.MetadataLocation).To(Equal(core.StringPtr("s3a://bucketname/path/to/table/metadata_location/_delta_log"))) + Expect(registerTableOptionsModel.MetadataLocation).To(Equal(core.StringPtr("s3a://storagename/path/to/table/metadata_location/_delta_log"))) Expect(registerTableOptionsModel.TableName).To(Equal(core.StringPtr("table1"))) Expect(registerTableOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(registerTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewRestartPrestissimoEngineOptions successfully`, func() { - // Construct an instance of the RestartPrestissimoEngineOptions model - engineID := "testString" - restartPrestissimoEngineOptionsModel := watsonxDataService.NewRestartPrestissimoEngineOptions(engineID) - restartPrestissimoEngineOptionsModel.SetEngineID("testString") - restartPrestissimoEngineOptionsModel.SetAuthInstanceID("testString") - restartPrestissimoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(restartPrestissimoEngineOptionsModel).ToNot(BeNil()) - Expect(restartPrestissimoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(restartPrestissimoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(restartPrestissimoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + It(`Invoke NewRemoveEngineProperties successfully`, func() { + removeEnginePropertiesCatalogAdditionalPropertiesModel := &watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties{ + Coordinator: []string{"property_name"}, + Worker: []string{"property_name"}, + } + catalog := map[string]watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties{"key1": *removeEnginePropertiesCatalogAdditionalPropertiesModel} + var configuration *watsonxdatav3.RemoveEnginePropertiesConfiguration = nil + eventListener := []string{"property_name"} + global := []string{"property_name"} + jmxExporterConfig := []string{"testString"} + var jvm *watsonxdatav3.RemoveEnginePropertiesJvm = nil + var logConfig *watsonxdatav3.RemoveEnginePropertiesLogConfig = nil + _, err := watsonxDataService.NewRemoveEngineProperties(catalog, configuration, eventListener, global, jmxExporterConfig, jvm, logConfig) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewRemoveEnginePropertiesCatalogAdditionalProperties successfully`, func() { + coordinator := []string{"property_name"} + worker := []string{"property_name"} + _model, err := watsonxDataService.NewRemoveEnginePropertiesCatalogAdditionalProperties(coordinator, worker) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) }) - It(`Invoke NewRestartPrestoEngineOptions successfully`, func() { - // Construct an instance of the RestartPrestoEngineOptions model - engineID := "testString" - restartPrestoEngineOptionsModel := watsonxDataService.NewRestartPrestoEngineOptions(engineID) - restartPrestoEngineOptionsModel.SetEngineID("testString") + It(`Invoke NewRemoveEnginePropertiesConfiguration successfully`, func() { + coordinator := []string{"property_name"} + worker := []string{"property_name"} + _model, err := watsonxDataService.NewRemoveEnginePropertiesConfiguration(coordinator, worker) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRemoveEnginePropertiesJvm successfully`, func() { + coordinator := []string{"property_name"} + worker := []string{"property_name"} + _model, err := watsonxDataService.NewRemoveEnginePropertiesJvm(coordinator, worker) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRemoveEnginePropertiesLogConfig successfully`, func() { + coordinator := []string{"property_name"} + worker := []string{"property_name"} + _model, err := watsonxDataService.NewRemoveEnginePropertiesLogConfig(coordinator, worker) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRemovePrestissimoEngineProperties successfully`, func() { + removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel := &watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties{ + Coordinator: []string{"testString"}, + Worker: []string{"testString"}, + } + catalog := map[string]watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties{"key1": *removePrestissimoEnginePropertiesCatalogAdditionalPropertiesModel} + var configuration *watsonxdatav3.RemovePrestissimoEnginePropertiesConfiguration = nil + global := []string{"testString"} + var jvm *watsonxdatav3.RemovePrestissimoEnginePropertiesJvm = nil + var logConfig *watsonxdatav3.RemovePrestissimoEnginePropertiesLogConfig = nil + optimizerProperties := []string{"testString"} + velox := []string{"testString"} + _, err := watsonxDataService.NewRemovePrestissimoEngineProperties(catalog, configuration, global, jvm, logConfig, optimizerProperties, velox) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewRemovePrestissimoEnginePropertiesCatalogAdditionalProperties successfully`, func() { + coordinator := []string{"testString"} + worker := []string{"testString"} + _model, err := watsonxDataService.NewRemovePrestissimoEnginePropertiesCatalogAdditionalProperties(coordinator, worker) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRemovePrestissimoEnginePropertiesConfiguration successfully`, func() { + coordinator := []string{"testString"} + worker := []string{"testString"} + _model, err := watsonxDataService.NewRemovePrestissimoEnginePropertiesConfiguration(coordinator, worker) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRemovePrestissimoEnginePropertiesJvm successfully`, func() { + coordinator := []string{"testString"} + _model, err := watsonxDataService.NewRemovePrestissimoEnginePropertiesJvm(coordinator) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRemovePrestissimoEnginePropertiesLogConfig successfully`, func() { + coordinator := []string{"testString"} + worker := []string{"testString"} + _model, err := watsonxDataService.NewRemovePrestissimoEnginePropertiesLogConfig(coordinator, worker) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewReplaceDataPolicyOptions successfully`, func() { + // Construct an instance of the RuleGrantee model + ruleGranteeModel := new(watsonxdatav3.RuleGrantee) + Expect(ruleGranteeModel).ToNot(BeNil()) + ruleGranteeModel.Key = core.StringPtr("user_name") + ruleGranteeModel.Type = core.StringPtr("user_identity") + ruleGranteeModel.Value = core.StringPtr("user1") + Expect(ruleGranteeModel.Key).To(Equal(core.StringPtr("user_name"))) + Expect(ruleGranteeModel.Type).To(Equal(core.StringPtr("user_identity"))) + Expect(ruleGranteeModel.Value).To(Equal(core.StringPtr("user1"))) + + // Construct an instance of the TransformColumnProperties model + transformColumnPropertiesModel := new(watsonxdatav3.TransformColumnProperties) + Expect(transformColumnPropertiesModel).ToNot(BeNil()) + transformColumnPropertiesModel.MaskCondition = core.StringPtr("NIL") + transformColumnPropertiesModel.MaskType = core.StringPtr("mask_show_last_4") + transformColumnPropertiesModel.MaskValue = core.StringPtr("NIL") + Expect(transformColumnPropertiesModel.MaskCondition).To(Equal(core.StringPtr("NIL"))) + Expect(transformColumnPropertiesModel.MaskType).To(Equal(core.StringPtr("mask_show_last_4"))) + Expect(transformColumnPropertiesModel.MaskValue).To(Equal(core.StringPtr("NIL"))) + + // Construct an instance of the RowFilterProperties model + rowFilterPropertiesModel := new(watsonxdatav3.RowFilterProperties) + Expect(rowFilterPropertiesModel).ToNot(BeNil()) + rowFilterPropertiesModel.FilterCondition = core.StringPtr("NIL") + rowFilterPropertiesModel.RowFilter = core.StringPtr("addr_country='US'") + Expect(rowFilterPropertiesModel.FilterCondition).To(Equal(core.StringPtr("NIL"))) + Expect(rowFilterPropertiesModel.RowFilter).To(Equal(core.StringPtr("addr_country='US'"))) + + // Construct an instance of the RuleV2 model + ruleV2Model := new(watsonxdatav3.RuleV2) + Expect(ruleV2Model).ToNot(BeNil()) + ruleV2Model.Actions = []string{"alter", "create"} + ruleV2Model.Effect = core.StringPtr("allow") + ruleV2Model.Grantees = []watsonxdatav3.RuleGrantee{*ruleGranteeModel} + ruleV2Model.TransformColumns = transformColumnPropertiesModel + ruleV2Model.TransformRows = rowFilterPropertiesModel + Expect(ruleV2Model.Actions).To(Equal([]string{"alter", "create"})) + Expect(ruleV2Model.Effect).To(Equal(core.StringPtr("allow"))) + Expect(ruleV2Model.Grantees).To(Equal([]watsonxdatav3.RuleGrantee{*ruleGranteeModel})) + Expect(ruleV2Model.TransformColumns).To(Equal(transformColumnPropertiesModel)) + Expect(ruleV2Model.TransformRows).To(Equal(rowFilterPropertiesModel)) + + // Construct an instance of the ReplaceDataPolicyOptions model + name := "testString" + replaceDataPolicyOptionsDataArtifact := "schema1/table1/(column1|column2)" + replaceDataPolicyOptionsRules := []watsonxdatav3.RuleV2{} + replaceDataPolicyOptionsModel := watsonxDataService.NewReplaceDataPolicyOptions(name, replaceDataPolicyOptionsDataArtifact, replaceDataPolicyOptionsRules) + replaceDataPolicyOptionsModel.SetName("testString") + replaceDataPolicyOptionsModel.SetDataArtifact("schema1/table1/(column1|column2)") + replaceDataPolicyOptionsModel.SetRules([]watsonxdatav3.RuleV2{*ruleV2Model}) + replaceDataPolicyOptionsModel.SetCatalogName("catalog1") + replaceDataPolicyOptionsModel.SetCatalogType("catalog1") + replaceDataPolicyOptionsModel.SetDescription("policy description") + replaceDataPolicyOptionsModel.SetPolicyName("policy1") + replaceDataPolicyOptionsModel.SetResourceID("catalog1") + replaceDataPolicyOptionsModel.SetStatus("active") + replaceDataPolicyOptionsModel.SetAuthInstanceID("testString") + replaceDataPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(replaceDataPolicyOptionsModel).ToNot(BeNil()) + Expect(replaceDataPolicyOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(replaceDataPolicyOptionsModel.DataArtifact).To(Equal(core.StringPtr("schema1/table1/(column1|column2)"))) + Expect(replaceDataPolicyOptionsModel.Rules).To(Equal([]watsonxdatav3.RuleV2{*ruleV2Model})) + Expect(replaceDataPolicyOptionsModel.CatalogName).To(Equal(core.StringPtr("catalog1"))) + Expect(replaceDataPolicyOptionsModel.CatalogType).To(Equal(core.StringPtr("catalog1"))) + Expect(replaceDataPolicyOptionsModel.Description).To(Equal(core.StringPtr("policy description"))) + Expect(replaceDataPolicyOptionsModel.PolicyName).To(Equal(core.StringPtr("policy1"))) + Expect(replaceDataPolicyOptionsModel.ResourceID).To(Equal(core.StringPtr("catalog1"))) + Expect(replaceDataPolicyOptionsModel.Status).To(Equal(core.StringPtr("active"))) + Expect(replaceDataPolicyOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(replaceDataPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewReplaceSalIntegrationEnrichmentGlobalSettingsOptions successfully`, func() { + // Construct an instance of the SalEnrichmentSettingsExpansionDescriptionConfiguration model + salEnrichmentSettingsExpansionDescriptionConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration) + Expect(salEnrichmentSettingsExpansionDescriptionConfigurationModel).ToNot(BeNil()) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) + Expect(salEnrichmentSettingsExpansionDescriptionConfigurationModel.AssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.14)))) + Expect(salEnrichmentSettingsExpansionDescriptionConfigurationModel.SuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.9)))) + + // Construct an instance of the SalEnrichmentSettingsExpansionNameConfiguration model + salEnrichmentSettingsExpansionNameConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration) + Expect(salEnrichmentSettingsExpansionNameConfigurationModel).ToNot(BeNil()) + salEnrichmentSettingsExpansionNameConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) + salEnrichmentSettingsExpansionNameConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) + Expect(salEnrichmentSettingsExpansionNameConfigurationModel.AssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.1)))) + Expect(salEnrichmentSettingsExpansionNameConfigurationModel.SuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.1)))) + + // Construct an instance of the SalEnrichmentSettingsExpansion model + salEnrichmentSettingsExpansionModel := new(watsonxdatav3.SalEnrichmentSettingsExpansion) + Expect(salEnrichmentSettingsExpansionModel).ToNot(BeNil()) + salEnrichmentSettingsExpansionModel.Description = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.DescriptionConfiguration = salEnrichmentSettingsExpansionDescriptionConfigurationModel + salEnrichmentSettingsExpansionModel.Name = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.NameConfiguration = salEnrichmentSettingsExpansionNameConfigurationModel + Expect(salEnrichmentSettingsExpansionModel.Description).To(Equal(core.BoolPtr(true))) + Expect(salEnrichmentSettingsExpansionModel.DescriptionConfiguration).To(Equal(salEnrichmentSettingsExpansionDescriptionConfigurationModel)) + Expect(salEnrichmentSettingsExpansionModel.Name).To(Equal(core.BoolPtr(true))) + Expect(salEnrichmentSettingsExpansionModel.NameConfiguration).To(Equal(salEnrichmentSettingsExpansionNameConfigurationModel)) + + // Construct an instance of the SalEnrichmentSettingsTermAssignment model + salEnrichmentSettingsTermAssignmentModel := new(watsonxdatav3.SalEnrichmentSettingsTermAssignment) + Expect(salEnrichmentSettingsTermAssignmentModel).ToNot(BeNil()) + salEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) + salEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) + Expect(salEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.NameMatching).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.3)))) + Expect(salEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.4)))) + + // Construct an instance of the ReplaceSalIntegrationEnrichmentGlobalSettingsOptions model + var replaceSalIntegrationEnrichmentGlobalSettingsOptionsExpansion *watsonxdatav3.SalEnrichmentSettingsExpansion = nil + var replaceSalIntegrationEnrichmentGlobalSettingsOptionsTermAssignment *watsonxdatav3.SalEnrichmentSettingsTermAssignment = nil + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel := watsonxDataService.NewReplaceSalIntegrationEnrichmentGlobalSettingsOptions(replaceSalIntegrationEnrichmentGlobalSettingsOptionsExpansion, replaceSalIntegrationEnrichmentGlobalSettingsOptionsTermAssignment) + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.SetExpansion(salEnrichmentSettingsExpansionModel) + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.SetTermAssignment(salEnrichmentSettingsTermAssignmentModel) + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.SetAuthInstanceID("testString") + replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel).ToNot(BeNil()) + Expect(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Expansion).To(Equal(salEnrichmentSettingsExpansionModel)) + Expect(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.TermAssignment).To(Equal(salEnrichmentSettingsTermAssignmentModel)) + Expect(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(replaceSalIntegrationEnrichmentGlobalSettingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewReplaceSalIntegrationEnrichmentProjectSettingsOptions successfully`, func() { + // Construct an instance of the SalEnrichmentSettingsExpansionDescriptionConfiguration model + salEnrichmentSettingsExpansionDescriptionConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration) + Expect(salEnrichmentSettingsExpansionDescriptionConfigurationModel).ToNot(BeNil()) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.14)) + salEnrichmentSettingsExpansionDescriptionConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.9)) + Expect(salEnrichmentSettingsExpansionDescriptionConfigurationModel.AssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.14)))) + Expect(salEnrichmentSettingsExpansionDescriptionConfigurationModel.SuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.9)))) + + // Construct an instance of the SalEnrichmentSettingsExpansionNameConfiguration model + salEnrichmentSettingsExpansionNameConfigurationModel := new(watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration) + Expect(salEnrichmentSettingsExpansionNameConfigurationModel).ToNot(BeNil()) + salEnrichmentSettingsExpansionNameConfigurationModel.AssignmentThreshold = core.Float64Ptr(float64(0.1)) + salEnrichmentSettingsExpansionNameConfigurationModel.SuggestionThreshold = core.Float64Ptr(float64(0.1)) + Expect(salEnrichmentSettingsExpansionNameConfigurationModel.AssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.1)))) + Expect(salEnrichmentSettingsExpansionNameConfigurationModel.SuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.1)))) + + // Construct an instance of the SalEnrichmentSettingsExpansion model + salEnrichmentSettingsExpansionModel := new(watsonxdatav3.SalEnrichmentSettingsExpansion) + Expect(salEnrichmentSettingsExpansionModel).ToNot(BeNil()) + salEnrichmentSettingsExpansionModel.Description = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.DescriptionConfiguration = salEnrichmentSettingsExpansionDescriptionConfigurationModel + salEnrichmentSettingsExpansionModel.Name = core.BoolPtr(true) + salEnrichmentSettingsExpansionModel.NameConfiguration = salEnrichmentSettingsExpansionNameConfigurationModel + Expect(salEnrichmentSettingsExpansionModel.Description).To(Equal(core.BoolPtr(true))) + Expect(salEnrichmentSettingsExpansionModel.DescriptionConfiguration).To(Equal(salEnrichmentSettingsExpansionDescriptionConfigurationModel)) + Expect(salEnrichmentSettingsExpansionModel.Name).To(Equal(core.BoolPtr(true))) + Expect(salEnrichmentSettingsExpansionModel.NameConfiguration).To(Equal(salEnrichmentSettingsExpansionNameConfigurationModel)) + + // Construct an instance of the SalEnrichmentSettingsTermAssignment model + salEnrichmentSettingsTermAssignmentModel := new(watsonxdatav3.SalEnrichmentSettingsTermAssignment) + Expect(salEnrichmentSettingsTermAssignmentModel).ToNot(BeNil()) + salEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.NameMatching = core.BoolPtr(false) + salEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) + salEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) + Expect(salEnrichmentSettingsTermAssignmentModel.ClassBasedAssignments).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.EvaluateNegativeAssignments).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.LlmBasedAssignments).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsCustom).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.MlBasedAssignmentsDefault).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.NameMatching).To(Equal(core.BoolPtr(false))) + Expect(salEnrichmentSettingsTermAssignmentModel.TermAssignmentThreshold).To(Equal(core.Float64Ptr(float64(0.3)))) + Expect(salEnrichmentSettingsTermAssignmentModel.TermSuggestionThreshold).To(Equal(core.Float64Ptr(float64(0.4)))) + + // Construct an instance of the ReplaceSalIntegrationEnrichmentProjectSettingsOptions model + projectID := "testString" + var replaceSalIntegrationEnrichmentProjectSettingsOptionsExpansion *watsonxdatav3.SalEnrichmentSettingsExpansion = nil + var replaceSalIntegrationEnrichmentProjectSettingsOptionsTermAssignment *watsonxdatav3.SalEnrichmentSettingsTermAssignment = nil + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel := watsonxDataService.NewReplaceSalIntegrationEnrichmentProjectSettingsOptions(projectID, replaceSalIntegrationEnrichmentProjectSettingsOptionsExpansion, replaceSalIntegrationEnrichmentProjectSettingsOptionsTermAssignment) + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.SetProjectID("testString") + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.SetExpansion(salEnrichmentSettingsExpansionModel) + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.SetTermAssignment(salEnrichmentSettingsTermAssignmentModel) + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.SetAuthInstanceID("testString") + replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(replaceSalIntegrationEnrichmentProjectSettingsOptionsModel).ToNot(BeNil()) + Expect(replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.ProjectID).To(Equal(core.StringPtr("testString"))) + Expect(replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.Expansion).To(Equal(salEnrichmentSettingsExpansionModel)) + Expect(replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.TermAssignment).To(Equal(salEnrichmentSettingsTermAssignmentModel)) + Expect(replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(replaceSalIntegrationEnrichmentProjectSettingsOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewResourceDetails successfully`, func() { + typeVar := "presto" + _model, err := watsonxDataService.NewResourceDetails(typeVar) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewResourceDetailsBulkUpdate successfully`, func() { + typeVar := "presto" + _model, err := watsonxDataService.NewResourceDetailsBulkUpdate(typeVar) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRestartPrestissimoEngineOptions successfully`, func() { + // Construct an instance of the RestartPrestissimoEngineOptions model + id := "testString" + restartPrestissimoEngineOptionsModel := watsonxDataService.NewRestartPrestissimoEngineOptions(id) + restartPrestissimoEngineOptionsModel.SetID("testString") + restartPrestissimoEngineOptionsModel.SetAuthInstanceID("testString") + restartPrestissimoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(restartPrestissimoEngineOptionsModel).ToNot(BeNil()) + Expect(restartPrestissimoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(restartPrestissimoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(restartPrestissimoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewRestartPrestoEngineOptions successfully`, func() { + // Construct an instance of the RestartPrestoEngineOptions model + id := "testString" + restartPrestoEngineOptionsModel := watsonxDataService.NewRestartPrestoEngineOptions(id) + restartPrestoEngineOptionsModel.SetID("testString") restartPrestoEngineOptionsModel.SetAuthInstanceID("testString") restartPrestoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(restartPrestoEngineOptionsModel).ToNot(BeNil()) - Expect(restartPrestoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(restartPrestoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(restartPrestoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(restartPrestoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewResumePrestissimoEngineOptions successfully`, func() { // Construct an instance of the ResumePrestissimoEngineOptions model - engineID := "testString" - resumePrestissimoEngineOptionsModel := watsonxDataService.NewResumePrestissimoEngineOptions(engineID) - resumePrestissimoEngineOptionsModel.SetEngineID("testString") + id := "testString" + resumePrestissimoEngineOptionsModel := watsonxDataService.NewResumePrestissimoEngineOptions(id) + resumePrestissimoEngineOptionsModel.SetID("testString") resumePrestissimoEngineOptionsModel.SetAuthInstanceID("testString") resumePrestissimoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(resumePrestissimoEngineOptionsModel).ToNot(BeNil()) - Expect(resumePrestissimoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(resumePrestissimoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(resumePrestissimoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(resumePrestissimoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewResumePrestoEngineOptions successfully`, func() { // Construct an instance of the ResumePrestoEngineOptions model - engineID := "testString" - resumePrestoEngineOptionsModel := watsonxDataService.NewResumePrestoEngineOptions(engineID) - resumePrestoEngineOptionsModel.SetEngineID("testString") + id := "testString" + resumePrestoEngineOptionsModel := watsonxDataService.NewResumePrestoEngineOptions(id) + resumePrestoEngineOptionsModel.SetID("testString") resumePrestoEngineOptionsModel.SetAuthInstanceID("testString") resumePrestoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(resumePrestoEngineOptionsModel).ToNot(BeNil()) - Expect(resumePrestoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(resumePrestoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(resumePrestoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(resumePrestoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewResumeSparkEngineOptions successfully`, func() { // Construct an instance of the ResumeSparkEngineOptions model - engineID := "testString" - resumeSparkEngineOptionsModel := watsonxDataService.NewResumeSparkEngineOptions(engineID) - resumeSparkEngineOptionsModel.SetEngineID("testString") + id := "testString" + resumeSparkEngineOptionsModel := watsonxDataService.NewResumeSparkEngineOptions(id) + resumeSparkEngineOptionsModel.SetID("testString") resumeSparkEngineOptionsModel.SetAuthInstanceID("testString") resumeSparkEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(resumeSparkEngineOptionsModel).ToNot(BeNil()) - Expect(resumeSparkEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(resumeSparkEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(resumeSparkEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(resumeSparkEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewRevokeResourceAccessPoliciesOptions successfully`, func() { + // Construct an instance of the ResourceDetails model + resourceDetailsModel := new(watsonxdatav3.ResourceDetails) + Expect(resourceDetailsModel).ToNot(BeNil()) + resourceDetailsModel.ID = core.StringPtr("presto01") + resourceDetailsModel.Name = core.StringPtr("hive_data") + resourceDetailsModel.Type = core.StringPtr("presto") + Expect(resourceDetailsModel.ID).To(Equal(core.StringPtr("presto01"))) + Expect(resourceDetailsModel.Name).To(Equal(core.StringPtr("hive_data"))) + Expect(resourceDetailsModel.Type).To(Equal(core.StringPtr("presto"))) + + // Construct an instance of the Subject model + subjectModel := new(watsonxdatav3.Subject) + Expect(subjectModel).ToNot(BeNil()) + subjectModel.Type = core.StringPtr("user") + subjectModel.Value = core.StringPtr("user1") + Expect(subjectModel.Type).To(Equal(core.StringPtr("user"))) + Expect(subjectModel.Value).To(Equal(core.StringPtr("user1"))) + + // Construct an instance of the SubjectRevoke model + subjectRevokeModel := new(watsonxdatav3.SubjectRevoke) + Expect(subjectRevokeModel).ToNot(BeNil()) + subjectRevokeModel.Permissions = []string{"testString"} + subjectRevokeModel.Subject = subjectModel + Expect(subjectRevokeModel.Permissions).To(Equal([]string{"testString"})) + Expect(subjectRevokeModel.Subject).To(Equal(subjectModel)) + + // Construct an instance of the RevokeResourceAccessPoliciesOptions model + revokeResourceAccessPoliciesOptionsModel := watsonxDataService.NewRevokeResourceAccessPoliciesOptions() + revokeResourceAccessPoliciesOptionsModel.SetResources([]watsonxdatav3.ResourceDetails{*resourceDetailsModel}) + revokeResourceAccessPoliciesOptionsModel.SetSubjects([]watsonxdatav3.SubjectRevoke{*subjectRevokeModel}) + revokeResourceAccessPoliciesOptionsModel.SetAuthInstanceID("testString") + revokeResourceAccessPoliciesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(revokeResourceAccessPoliciesOptionsModel).ToNot(BeNil()) + Expect(revokeResourceAccessPoliciesOptionsModel.Resources).To(Equal([]watsonxdatav3.ResourceDetails{*resourceDetailsModel})) + Expect(revokeResourceAccessPoliciesOptionsModel.Subjects).To(Equal([]watsonxdatav3.SubjectRevoke{*subjectRevokeModel})) + Expect(revokeResourceAccessPoliciesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(revokeResourceAccessPoliciesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewRollbackTableOptions successfully`, func() { // Construct an instance of the RollbackTableOptions model - engineID := "testString" - catalogID := "testString" - schemaID := "testString" - tableID := "testString" - rollbackTableOptionsModel := watsonxDataService.NewRollbackTableOptions(engineID, catalogID, schemaID, tableID) + catalogName := "testString" + schemaName := "testString" + tableName := "testString" + rollbackTableOptionsModel := watsonxDataService.NewRollbackTableOptions(catalogName, schemaName, tableName) + rollbackTableOptionsModel.SetCatalogName("testString") + rollbackTableOptionsModel.SetSchemaName("testString") + rollbackTableOptionsModel.SetTableName("testString") + rollbackTableOptionsModel.SetSnapshotID("12357647") rollbackTableOptionsModel.SetEngineID("testString") - rollbackTableOptionsModel.SetCatalogID("testString") - rollbackTableOptionsModel.SetSchemaID("testString") - rollbackTableOptionsModel.SetTableID("testString") - rollbackTableOptionsModel.SetSnapshotID("testString") rollbackTableOptionsModel.SetAuthInstanceID("testString") rollbackTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(rollbackTableOptionsModel).ToNot(BeNil()) + Expect(rollbackTableOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(rollbackTableOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(rollbackTableOptionsModel.TableName).To(Equal(core.StringPtr("testString"))) + Expect(rollbackTableOptionsModel.SnapshotID).To(Equal(core.StringPtr("12357647"))) Expect(rollbackTableOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(rollbackTableOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(rollbackTableOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) - Expect(rollbackTableOptionsModel.TableID).To(Equal(core.StringPtr("testString"))) - Expect(rollbackTableOptionsModel.SnapshotID).To(Equal(core.StringPtr("testString"))) Expect(rollbackTableOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(rollbackTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewRuleGrantee successfully`, func() { + key := "user_name" + typeVar := "user_identity" + value := "user1" + _model, err := watsonxDataService.NewRuleGrantee(key, typeVar, value) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewRuleV2 successfully`, func() { + actions := []string{"alter", "create"} + grantees := []watsonxdatav3.RuleGrantee{} + _model, err := watsonxDataService.NewRuleV2(actions, grantees) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewRunExplainAnalyzeStatementOptions successfully`, func() { // Construct an instance of the RunExplainAnalyzeStatementOptions model - engineID := "testString" + id := "testString" runExplainAnalyzeStatementOptionsStatement := "show schemas in catalog_name" - runExplainAnalyzeStatementOptionsModel := watsonxDataService.NewRunExplainAnalyzeStatementOptions(engineID, runExplainAnalyzeStatementOptionsStatement) - runExplainAnalyzeStatementOptionsModel.SetEngineID("testString") + runExplainAnalyzeStatementOptionsModel := watsonxDataService.NewRunExplainAnalyzeStatementOptions(id, runExplainAnalyzeStatementOptionsStatement) + runExplainAnalyzeStatementOptionsModel.SetID("testString") runExplainAnalyzeStatementOptionsModel.SetStatement("show schemas in catalog_name") runExplainAnalyzeStatementOptionsModel.SetVerbose(true) runExplainAnalyzeStatementOptionsModel.SetAuthInstanceID("testString") runExplainAnalyzeStatementOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(runExplainAnalyzeStatementOptionsModel).ToNot(BeNil()) - Expect(runExplainAnalyzeStatementOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(runExplainAnalyzeStatementOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(runExplainAnalyzeStatementOptionsModel.Statement).To(Equal(core.StringPtr("show schemas in catalog_name"))) Expect(runExplainAnalyzeStatementOptionsModel.Verbose).To(Equal(core.BoolPtr(true))) Expect(runExplainAnalyzeStatementOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) @@ -38293,35 +42154,39 @@ var _ = Describe(`WatsonxDataV2`, func() { }) It(`Invoke NewRunExplainStatementOptions successfully`, func() { // Construct an instance of the RunExplainStatementOptions model - engineID := "testString" + id := "testString" runExplainStatementOptionsStatement := "show schemas in catalog_name" - runExplainStatementOptionsModel := watsonxDataService.NewRunExplainStatementOptions(engineID, runExplainStatementOptionsStatement) - runExplainStatementOptionsModel.SetEngineID("testString") + runExplainStatementOptionsModel := watsonxDataService.NewRunExplainStatementOptions(id, runExplainStatementOptionsStatement) + runExplainStatementOptionsModel.SetID("testString") runExplainStatementOptionsModel.SetStatement("show schemas in catalog_name") + runExplainStatementOptionsModel.SetCatalog("catalog_name") runExplainStatementOptionsModel.SetFormat("json") + runExplainStatementOptionsModel.SetSchema("schema_name") runExplainStatementOptionsModel.SetType("io") runExplainStatementOptionsModel.SetAuthInstanceID("testString") runExplainStatementOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(runExplainStatementOptionsModel).ToNot(BeNil()) - Expect(runExplainStatementOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(runExplainStatementOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(runExplainStatementOptionsModel.Statement).To(Equal(core.StringPtr("show schemas in catalog_name"))) + Expect(runExplainStatementOptionsModel.Catalog).To(Equal(core.StringPtr("catalog_name"))) Expect(runExplainStatementOptionsModel.Format).To(Equal(core.StringPtr("json"))) + Expect(runExplainStatementOptionsModel.Schema).To(Equal(core.StringPtr("schema_name"))) Expect(runExplainStatementOptionsModel.Type).To(Equal(core.StringPtr("io"))) Expect(runExplainStatementOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(runExplainStatementOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewRunPrestissimoExplainAnalyzeStatementOptions successfully`, func() { // Construct an instance of the RunPrestissimoExplainAnalyzeStatementOptions model - engineID := "testString" + id := "testString" runPrestissimoExplainAnalyzeStatementOptionsStatement := "show schemas in catalog_name" - runPrestissimoExplainAnalyzeStatementOptionsModel := watsonxDataService.NewRunPrestissimoExplainAnalyzeStatementOptions(engineID, runPrestissimoExplainAnalyzeStatementOptionsStatement) - runPrestissimoExplainAnalyzeStatementOptionsModel.SetEngineID("testString") + runPrestissimoExplainAnalyzeStatementOptionsModel := watsonxDataService.NewRunPrestissimoExplainAnalyzeStatementOptions(id, runPrestissimoExplainAnalyzeStatementOptionsStatement) + runPrestissimoExplainAnalyzeStatementOptionsModel.SetID("testString") runPrestissimoExplainAnalyzeStatementOptionsModel.SetStatement("show schemas in catalog_name") runPrestissimoExplainAnalyzeStatementOptionsModel.SetVerbose(true) runPrestissimoExplainAnalyzeStatementOptionsModel.SetAuthInstanceID("testString") runPrestissimoExplainAnalyzeStatementOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(runPrestissimoExplainAnalyzeStatementOptionsModel).ToNot(BeNil()) - Expect(runPrestissimoExplainAnalyzeStatementOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(runPrestissimoExplainAnalyzeStatementOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(runPrestissimoExplainAnalyzeStatementOptionsModel.Statement).To(Equal(core.StringPtr("show schemas in catalog_name"))) Expect(runPrestissimoExplainAnalyzeStatementOptionsModel.Verbose).To(Equal(core.BoolPtr(true))) Expect(runPrestissimoExplainAnalyzeStatementOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) @@ -38329,66 +42194,104 @@ var _ = Describe(`WatsonxDataV2`, func() { }) It(`Invoke NewRunPrestissimoExplainStatementOptions successfully`, func() { // Construct an instance of the RunPrestissimoExplainStatementOptions model - engineID := "testString" + id := "testString" runPrestissimoExplainStatementOptionsStatement := "show schemas in catalog_name" - runPrestissimoExplainStatementOptionsModel := watsonxDataService.NewRunPrestissimoExplainStatementOptions(engineID, runPrestissimoExplainStatementOptionsStatement) - runPrestissimoExplainStatementOptionsModel.SetEngineID("testString") + runPrestissimoExplainStatementOptionsModel := watsonxDataService.NewRunPrestissimoExplainStatementOptions(id, runPrestissimoExplainStatementOptionsStatement) + runPrestissimoExplainStatementOptionsModel.SetID("testString") runPrestissimoExplainStatementOptionsModel.SetStatement("show schemas in catalog_name") + runPrestissimoExplainStatementOptionsModel.SetCatalog("catalog_name") runPrestissimoExplainStatementOptionsModel.SetFormat("json") + runPrestissimoExplainStatementOptionsModel.SetSchema("schema_name") runPrestissimoExplainStatementOptionsModel.SetType("io") runPrestissimoExplainStatementOptionsModel.SetAuthInstanceID("testString") runPrestissimoExplainStatementOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(runPrestissimoExplainStatementOptionsModel).ToNot(BeNil()) - Expect(runPrestissimoExplainStatementOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(runPrestissimoExplainStatementOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(runPrestissimoExplainStatementOptionsModel.Statement).To(Equal(core.StringPtr("show schemas in catalog_name"))) + Expect(runPrestissimoExplainStatementOptionsModel.Catalog).To(Equal(core.StringPtr("catalog_name"))) Expect(runPrestissimoExplainStatementOptionsModel.Format).To(Equal(core.StringPtr("json"))) + Expect(runPrestissimoExplainStatementOptionsModel.Schema).To(Equal(core.StringPtr("schema_name"))) Expect(runPrestissimoExplainStatementOptionsModel.Type).To(Equal(core.StringPtr("io"))) Expect(runPrestissimoExplainStatementOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(runPrestissimoExplainStatementOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewSalEnrichmentSettings successfully`, func() { + var expansion *watsonxdatav3.SalEnrichmentSettingsExpansion = nil + var termAssignment *watsonxdatav3.SalEnrichmentSettingsTermAssignment = nil + _, err := watsonxDataService.NewSalEnrichmentSettings(expansion, termAssignment) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewSalEnrichmentSettingsExpansion successfully`, func() { + description := true + var descriptionConfiguration *watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration = nil + name := true + var nameConfiguration *watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration = nil + _, err := watsonxDataService.NewSalEnrichmentSettingsExpansion(description, descriptionConfiguration, name, nameConfiguration) + Expect(err).ToNot(BeNil()) + }) + It(`Invoke NewSalEnrichmentSettingsExpansionNameConfiguration successfully`, func() { + assignmentThreshold := float64(0.1) + suggestionThreshold := float64(0.1) + _model, err := watsonxDataService.NewSalEnrichmentSettingsExpansionNameConfiguration(assignmentThreshold, suggestionThreshold) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSalEnrichmentSettingsTermAssignment successfully`, func() { + classBasedAssignments := false + evaluateNegativeAssignments := false + llmBasedAssignments := false + mlBasedAssignmentsCustom := false + mlBasedAssignmentsDefault := false + nameMatching := false + termAssignmentThreshold := float64(0.3) + termSuggestionThreshold := float64(0.4) + _model, err := watsonxDataService.NewSalEnrichmentSettingsTermAssignment(classBasedAssignments, evaluateNegativeAssignments, llmBasedAssignments, mlBasedAssignmentsCustom, mlBasedAssignmentsDefault, nameMatching, termAssignmentThreshold, termSuggestionThreshold) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewScalePrestissimoEngineOptions successfully`, func() { - // Construct an instance of the PrestissimoNodeDescriptionBody model - prestissimoNodeDescriptionBodyModel := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - Expect(prestissimoNodeDescriptionBodyModel).ToNot(BeNil()) - prestissimoNodeDescriptionBodyModel.NodeType = core.StringPtr("worker") - prestissimoNodeDescriptionBodyModel.Quantity = core.Int64Ptr(int64(38)) - Expect(prestissimoNodeDescriptionBodyModel.NodeType).To(Equal(core.StringPtr("worker"))) - Expect(prestissimoNodeDescriptionBodyModel.Quantity).To(Equal(core.Int64Ptr(int64(38)))) + // Construct an instance of the NodeDescription model + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) + Expect(nodeDescriptionModel).ToNot(BeNil()) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + Expect(nodeDescriptionModel.NodeType).To(Equal(core.StringPtr("worker"))) + Expect(nodeDescriptionModel.Quantity).To(Equal(core.Int64Ptr(int64(1)))) // Construct an instance of the ScalePrestissimoEngineOptions model - engineID := "testString" - scalePrestissimoEngineOptionsModel := watsonxDataService.NewScalePrestissimoEngineOptions(engineID) - scalePrestissimoEngineOptionsModel.SetEngineID("testString") - scalePrestissimoEngineOptionsModel.SetCoordinator(prestissimoNodeDescriptionBodyModel) - scalePrestissimoEngineOptionsModel.SetWorker(prestissimoNodeDescriptionBodyModel) + id := "testString" + scalePrestissimoEngineOptionsModel := watsonxDataService.NewScalePrestissimoEngineOptions(id) + scalePrestissimoEngineOptionsModel.SetID("testString") + scalePrestissimoEngineOptionsModel.SetCoordinator(nodeDescriptionModel) + scalePrestissimoEngineOptionsModel.SetWorker(nodeDescriptionModel) scalePrestissimoEngineOptionsModel.SetAuthInstanceID("testString") scalePrestissimoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(scalePrestissimoEngineOptionsModel).ToNot(BeNil()) - Expect(scalePrestissimoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(scalePrestissimoEngineOptionsModel.Coordinator).To(Equal(prestissimoNodeDescriptionBodyModel)) - Expect(scalePrestissimoEngineOptionsModel.Worker).To(Equal(prestissimoNodeDescriptionBodyModel)) + Expect(scalePrestissimoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(scalePrestissimoEngineOptionsModel.Coordinator).To(Equal(nodeDescriptionModel)) + Expect(scalePrestissimoEngineOptionsModel.Worker).To(Equal(nodeDescriptionModel)) Expect(scalePrestissimoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(scalePrestissimoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewScalePrestoEngineOptions successfully`, func() { // Construct an instance of the NodeDescription model - nodeDescriptionModel := new(watsonxdatav2.NodeDescription) + nodeDescriptionModel := new(watsonxdatav3.NodeDescription) Expect(nodeDescriptionModel).ToNot(BeNil()) - nodeDescriptionModel.NodeType = core.StringPtr("starter") - nodeDescriptionModel.Quantity = core.Int64Ptr(int64(38)) - Expect(nodeDescriptionModel.NodeType).To(Equal(core.StringPtr("starter"))) - Expect(nodeDescriptionModel.Quantity).To(Equal(core.Int64Ptr(int64(38)))) + nodeDescriptionModel.NodeType = core.StringPtr("worker") + nodeDescriptionModel.Quantity = core.Int64Ptr(int64(1)) + Expect(nodeDescriptionModel.NodeType).To(Equal(core.StringPtr("worker"))) + Expect(nodeDescriptionModel.Quantity).To(Equal(core.Int64Ptr(int64(1)))) // Construct an instance of the ScalePrestoEngineOptions model - engineID := "testString" - scalePrestoEngineOptionsModel := watsonxDataService.NewScalePrestoEngineOptions(engineID) - scalePrestoEngineOptionsModel.SetEngineID("testString") + id := "testString" + scalePrestoEngineOptionsModel := watsonxDataService.NewScalePrestoEngineOptions(id) + scalePrestoEngineOptionsModel.SetID("testString") scalePrestoEngineOptionsModel.SetCoordinator(nodeDescriptionModel) scalePrestoEngineOptionsModel.SetWorker(nodeDescriptionModel) scalePrestoEngineOptionsModel.SetAuthInstanceID("testString") scalePrestoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(scalePrestoEngineOptionsModel).ToNot(BeNil()) - Expect(scalePrestoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(scalePrestoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(scalePrestoEngineOptionsModel.Coordinator).To(Equal(nodeDescriptionModel)) Expect(scalePrestoEngineOptionsModel.Worker).To(Equal(nodeDescriptionModel)) Expect(scalePrestoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) @@ -38396,298 +42299,447 @@ var _ = Describe(`WatsonxDataV2`, func() { }) It(`Invoke NewScaleSparkEngineOptions successfully`, func() { // Construct an instance of the ScaleSparkEngineOptions model - engineID := "testString" - scaleSparkEngineOptionsModel := watsonxDataService.NewScaleSparkEngineOptions(engineID) - scaleSparkEngineOptionsModel.SetEngineID("testString") + id := "testString" + scaleSparkEngineOptionsModel := watsonxDataService.NewScaleSparkEngineOptions(id) + scaleSparkEngineOptionsModel.SetID("testString") scaleSparkEngineOptionsModel.SetNumberOfNodes(int64(2)) scaleSparkEngineOptionsModel.SetAuthInstanceID("testString") scaleSparkEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(scaleSparkEngineOptionsModel).ToNot(BeNil()) - Expect(scaleSparkEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(scaleSparkEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(scaleSparkEngineOptionsModel.NumberOfNodes).To(Equal(core.Int64Ptr(int64(2)))) Expect(scaleSparkEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(scaleSparkEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewSchemaPrototype successfully`, func() { + customPath := "sample-path" + name := "SampleSchema1" + _model, err := watsonxDataService.NewSchemaPrototype(customPath, name) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSchemaTransformation successfully`, func() { + oldColumn := "old_column_name" + _model, err := watsonxDataService.NewSchemaTransformation(oldColumn) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSourceDetails successfully`, func() { + sourceType := "STORAGE" + _model, err := watsonxDataService.NewSourceDetails(sourceType) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSparkApplicationDetails successfully`, func() { + application := "s3://mybucket/wordcount.py" + _model, err := watsonxDataService.NewSparkApplicationDetails(application) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewSparkScaleConfig successfully`, func() { + nodeType := "medium" + _model, err := watsonxDataService.NewSparkScaleConfig(nodeType) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) It(`Invoke NewStartSparkEngineHistoryServerOptions successfully`, func() { // Construct an instance of the StartSparkEngineHistoryServerOptions model - engineID := "testString" - startSparkEngineHistoryServerOptionsModel := watsonxDataService.NewStartSparkEngineHistoryServerOptions(engineID) - startSparkEngineHistoryServerOptionsModel.SetEngineID("testString") + id := "testString" + startSparkEngineHistoryServerOptionsModel := watsonxDataService.NewStartSparkEngineHistoryServerOptions(id) + startSparkEngineHistoryServerOptionsModel.SetID("testString") startSparkEngineHistoryServerOptionsModel.SetCores("1") startSparkEngineHistoryServerOptionsModel.SetMemory("4G") startSparkEngineHistoryServerOptionsModel.SetAuthInstanceID("testString") startSparkEngineHistoryServerOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(startSparkEngineHistoryServerOptionsModel).ToNot(BeNil()) - Expect(startSparkEngineHistoryServerOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(startSparkEngineHistoryServerOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(startSparkEngineHistoryServerOptionsModel.Cores).To(Equal(core.StringPtr("1"))) Expect(startSparkEngineHistoryServerOptionsModel.Memory).To(Equal(core.StringPtr("4G"))) Expect(startSparkEngineHistoryServerOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(startSparkEngineHistoryServerOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewStorageDetails successfully`, func() { - authMode := "" - containerName := "sample-container" - endpoint := "abfss://@.dfs.core.windows.net/" - storageAccountName := "sample-storage" - _model, err := watsonxDataService.NewStorageDetails(authMode, containerName, endpoint, storageAccountName) + It(`Invoke NewStorageCatalogPrototype successfully`, func() { + catalogTags := []string{"catalog_tag_1", "catalog_tag_2"} + _model, err := watsonxDataService.NewStorageCatalogPrototype(catalogTags) Expect(_model).ToNot(BeNil()) Expect(err).To(BeNil()) }) - It(`Invoke NewUpdateBucketRegistrationOptions successfully`, func() { - // Construct an instance of the UpdateBucketRegistrationOptions model - bucketID := "testString" - body := map[string]interface{}{"anyKey": "anyValue"} - updateBucketRegistrationOptionsModel := watsonxDataService.NewUpdateBucketRegistrationOptions(bucketID, body) - updateBucketRegistrationOptionsModel.SetBucketID("testString") - updateBucketRegistrationOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) - updateBucketRegistrationOptionsModel.SetAuthInstanceID("testString") - updateBucketRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateBucketRegistrationOptionsModel).ToNot(BeNil()) - Expect(updateBucketRegistrationOptionsModel.BucketID).To(Equal(core.StringPtr("testString"))) - Expect(updateBucketRegistrationOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateBucketRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(updateBucketRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + It(`Invoke NewSubject successfully`, func() { + typeVar := "user" + value := "user1" + _model, err := watsonxDataService.NewSubject(typeVar, value) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) + It(`Invoke NewTargetDetails successfully`, func() { + catalog := "testString" + schema := "testString" + table := "testString" + writeMode := "testString" + _model, err := watsonxDataService.NewTargetDetails(catalog, schema, table, writeMode) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) }) It(`Invoke NewUpdateColumnOptions successfully`, func() { // Construct an instance of the UpdateColumnOptions model engineID := "testString" - catalogID := "testString" - schemaID := "testString" - tableID := "testString" - columnID := "testString" + catalogName := "testString" + schemaName := "testString" + tableName := "testString" + columnName := "testString" body := map[string]interface{}{"anyKey": "anyValue"} - updateColumnOptionsModel := watsonxDataService.NewUpdateColumnOptions(engineID, catalogID, schemaID, tableID, columnID, body) + updateColumnOptionsModel := watsonxDataService.NewUpdateColumnOptions(engineID, catalogName, schemaName, tableName, columnName, body) updateColumnOptionsModel.SetEngineID("testString") - updateColumnOptionsModel.SetCatalogID("testString") - updateColumnOptionsModel.SetSchemaID("testString") - updateColumnOptionsModel.SetTableID("testString") - updateColumnOptionsModel.SetColumnID("testString") + updateColumnOptionsModel.SetCatalogName("testString") + updateColumnOptionsModel.SetSchemaName("testString") + updateColumnOptionsModel.SetTableName("testString") + updateColumnOptionsModel.SetColumnName("testString") updateColumnOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) updateColumnOptionsModel.SetAuthInstanceID("testString") updateColumnOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateColumnOptionsModel).ToNot(BeNil()) Expect(updateColumnOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) - Expect(updateColumnOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(updateColumnOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) - Expect(updateColumnOptionsModel.TableID).To(Equal(core.StringPtr("testString"))) - Expect(updateColumnOptionsModel.ColumnID).To(Equal(core.StringPtr("testString"))) + Expect(updateColumnOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(updateColumnOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(updateColumnOptionsModel.TableName).To(Equal(core.StringPtr("testString"))) + Expect(updateColumnOptionsModel.ColumnName).To(Equal(core.StringPtr("testString"))) Expect(updateColumnOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateColumnOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateColumnOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdateDataPolicyOptions successfully`, func() { + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + Expect(jsonPatchOperationModel).ToNot(BeNil()) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" + Expect(jsonPatchOperationModel.Op).To(Equal(core.StringPtr("add"))) + Expect(jsonPatchOperationModel.Path).To(Equal(core.StringPtr("testString"))) + Expect(jsonPatchOperationModel.From).To(Equal(core.StringPtr("testString"))) + Expect(jsonPatchOperationModel.Value).To(Equal("testString")) + + // Construct an instance of the UpdateDataPolicyOptions model + name := "testString" + body := []watsonxdatav3.JSONPatchOperation{} + updateDataPolicyOptionsModel := watsonxDataService.NewUpdateDataPolicyOptions(name, body) + updateDataPolicyOptionsModel.SetName("testString") + updateDataPolicyOptionsModel.SetBody([]watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel}) + updateDataPolicyOptionsModel.SetAuthInstanceID("testString") + updateDataPolicyOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateDataPolicyOptionsModel).ToNot(BeNil()) + Expect(updateDataPolicyOptionsModel.Name).To(Equal(core.StringPtr("testString"))) + Expect(updateDataPolicyOptionsModel.Body).To(Equal([]watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel})) + Expect(updateDataPolicyOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(updateDataPolicyOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateDatabaseOptions successfully`, func() { // Construct an instance of the UpdateDatabaseOptions model - databaseID := "testString" + id := "testString" body := map[string]interface{}{"anyKey": "anyValue"} - updateDatabaseOptionsModel := watsonxDataService.NewUpdateDatabaseOptions(databaseID, body) - updateDatabaseOptionsModel.SetDatabaseID("testString") + updateDatabaseOptionsModel := watsonxDataService.NewUpdateDatabaseOptions(id, body) + updateDatabaseOptionsModel.SetID("testString") updateDatabaseOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) updateDatabaseOptionsModel.SetAuthInstanceID("testString") updateDatabaseOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateDatabaseOptionsModel).ToNot(BeNil()) - Expect(updateDatabaseOptionsModel.DatabaseID).To(Equal(core.StringPtr("testString"))) + Expect(updateDatabaseOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(updateDatabaseOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateDatabaseOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateDatabaseOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateDb2EngineOptions successfully`, func() { // Construct an instance of the UpdateDb2EngineOptions model - engineID := "testString" + id := "testString" body := map[string]interface{}{"anyKey": "anyValue"} - updateDb2EngineOptionsModel := watsonxDataService.NewUpdateDb2EngineOptions(engineID, body) - updateDb2EngineOptionsModel.SetEngineID("testString") + updateDb2EngineOptionsModel := watsonxDataService.NewUpdateDb2EngineOptions(id, body) + updateDb2EngineOptionsModel.SetID("testString") updateDb2EngineOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) updateDb2EngineOptionsModel.SetAuthInstanceID("testString") updateDb2EngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateDb2EngineOptionsModel).ToNot(BeNil()) - Expect(updateDb2EngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(updateDb2EngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(updateDb2EngineOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateDb2EngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateDb2EngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) - It(`Invoke NewUpdateDriverEnginesOptions successfully`, func() { - // Construct an instance of the UpdateDriverEnginesOptions model - driverID := "testString" - body := map[string]interface{}{"anyKey": "anyValue"} - updateDriverEnginesOptionsModel := watsonxDataService.NewUpdateDriverEnginesOptions(driverID, body) - updateDriverEnginesOptionsModel.SetDriverID("testString") - updateDriverEnginesOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) - updateDriverEnginesOptionsModel.SetAuthInstanceID("testString") - updateDriverEnginesOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) - Expect(updateDriverEnginesOptionsModel).ToNot(BeNil()) - Expect(updateDriverEnginesOptionsModel.DriverID).To(Equal(core.StringPtr("testString"))) - Expect(updateDriverEnginesOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) - Expect(updateDriverEnginesOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) - Expect(updateDriverEnginesOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) - }) It(`Invoke NewUpdateIntegrationOptions successfully`, func() { // Construct an instance of the UpdateIntegrationOptions model - integrationID := "testString" - integrationPatch := map[string]interface{}{"anyKey": "anyValue"} - updateIntegrationOptionsModel := watsonxDataService.NewUpdateIntegrationOptions(integrationID, integrationPatch) - updateIntegrationOptionsModel.SetIntegrationID("testString") - updateIntegrationOptionsModel.SetIntegrationPatch(map[string]interface{}{"anyKey": "anyValue"}) + id := "testString" + body := map[string]interface{}{"anyKey": "anyValue"} + updateIntegrationOptionsModel := watsonxDataService.NewUpdateIntegrationOptions(id, body) + updateIntegrationOptionsModel.SetID("testString") + updateIntegrationOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) updateIntegrationOptionsModel.SetAuthInstanceID("testString") + updateIntegrationOptionsModel.SetSecret("testString") updateIntegrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateIntegrationOptionsModel).ToNot(BeNil()) - Expect(updateIntegrationOptionsModel.IntegrationID).To(Equal(core.StringPtr("testString"))) - Expect(updateIntegrationOptionsModel.IntegrationPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateIntegrationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateIntegrationOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateIntegrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(updateIntegrationOptionsModel.Secret).To(Equal(core.StringPtr("testString"))) Expect(updateIntegrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateMilvusServiceBucketOptions successfully`, func() { + // Construct an instance of the JSONPatchOperation model + jsonPatchOperationModel := new(watsonxdatav3.JSONPatchOperation) + Expect(jsonPatchOperationModel).ToNot(BeNil()) + jsonPatchOperationModel.Op = core.StringPtr("add") + jsonPatchOperationModel.Path = core.StringPtr("testString") + jsonPatchOperationModel.From = core.StringPtr("testString") + jsonPatchOperationModel.Value = "testString" + Expect(jsonPatchOperationModel.Op).To(Equal(core.StringPtr("add"))) + Expect(jsonPatchOperationModel.Path).To(Equal(core.StringPtr("testString"))) + Expect(jsonPatchOperationModel.From).To(Equal(core.StringPtr("testString"))) + Expect(jsonPatchOperationModel.Value).To(Equal("testString")) + // Construct an instance of the UpdateMilvusServiceBucketOptions model serviceID := "testString" - body := map[string]interface{}{"anyKey": "anyValue"} + body := []watsonxdatav3.JSONPatchOperation{} updateMilvusServiceBucketOptionsModel := watsonxDataService.NewUpdateMilvusServiceBucketOptions(serviceID, body) updateMilvusServiceBucketOptionsModel.SetServiceID("testString") - updateMilvusServiceBucketOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) + updateMilvusServiceBucketOptionsModel.SetBody([]watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel}) updateMilvusServiceBucketOptionsModel.SetAuthInstanceID("testString") updateMilvusServiceBucketOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateMilvusServiceBucketOptionsModel).ToNot(BeNil()) Expect(updateMilvusServiceBucketOptionsModel.ServiceID).To(Equal(core.StringPtr("testString"))) - Expect(updateMilvusServiceBucketOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateMilvusServiceBucketOptionsModel.Body).To(Equal([]watsonxdatav3.JSONPatchOperation{*jsonPatchOperationModel})) Expect(updateMilvusServiceBucketOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateMilvusServiceBucketOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateMilvusServiceOptions successfully`, func() { // Construct an instance of the UpdateMilvusServiceOptions model - serviceID := "testString" + id := "testString" body := map[string]interface{}{"anyKey": "anyValue"} - updateMilvusServiceOptionsModel := watsonxDataService.NewUpdateMilvusServiceOptions(serviceID, body) - updateMilvusServiceOptionsModel.SetServiceID("testString") + updateMilvusServiceOptionsModel := watsonxDataService.NewUpdateMilvusServiceOptions(id, body) + updateMilvusServiceOptionsModel.SetID("testString") updateMilvusServiceOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) updateMilvusServiceOptionsModel.SetAuthInstanceID("testString") updateMilvusServiceOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateMilvusServiceOptionsModel).ToNot(BeNil()) - Expect(updateMilvusServiceOptionsModel.ServiceID).To(Equal(core.StringPtr("testString"))) + Expect(updateMilvusServiceOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(updateMilvusServiceOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateMilvusServiceOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateMilvusServiceOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateNetezzaEngineOptions successfully`, func() { // Construct an instance of the UpdateNetezzaEngineOptions model - engineID := "testString" + id := "testString" body := map[string]interface{}{"anyKey": "anyValue"} - updateNetezzaEngineOptionsModel := watsonxDataService.NewUpdateNetezzaEngineOptions(engineID, body) - updateNetezzaEngineOptionsModel.SetEngineID("testString") + updateNetezzaEngineOptionsModel := watsonxDataService.NewUpdateNetezzaEngineOptions(id, body) + updateNetezzaEngineOptionsModel.SetID("testString") updateNetezzaEngineOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) updateNetezzaEngineOptionsModel.SetAuthInstanceID("testString") updateNetezzaEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateNetezzaEngineOptionsModel).ToNot(BeNil()) - Expect(updateNetezzaEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(updateNetezzaEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(updateNetezzaEngineOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateNetezzaEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateNetezzaEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdatePrestissimoEngineOptions successfully`, func() { // Construct an instance of the UpdatePrestissimoEngineOptions model - engineID := "testString" + id := "testString" body := map[string]interface{}{"anyKey": "anyValue"} - updatePrestissimoEngineOptionsModel := watsonxDataService.NewUpdatePrestissimoEngineOptions(engineID, body) - updatePrestissimoEngineOptionsModel.SetEngineID("testString") + updatePrestissimoEngineOptionsModel := watsonxDataService.NewUpdatePrestissimoEngineOptions(id, body) + updatePrestissimoEngineOptionsModel.SetID("testString") updatePrestissimoEngineOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) updatePrestissimoEngineOptionsModel.SetAuthInstanceID("testString") updatePrestissimoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updatePrestissimoEngineOptionsModel).ToNot(BeNil()) - Expect(updatePrestissimoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(updatePrestissimoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(updatePrestissimoEngineOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updatePrestissimoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updatePrestissimoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdatePrestoEngineAutoscalingOptions successfully`, func() { + // Construct an instance of the UpdatePrestoEngineAutoscalingOptions model + engineID := "testString" + updateAutoScalingRequestPatch := map[string]interface{}{"anyKey": "anyValue"} + updatePrestoEngineAutoscalingOptionsModel := watsonxDataService.NewUpdatePrestoEngineAutoscalingOptions(engineID, updateAutoScalingRequestPatch) + updatePrestoEngineAutoscalingOptionsModel.SetEngineID("testString") + updatePrestoEngineAutoscalingOptionsModel.SetUpdateAutoScalingRequestPatch(map[string]interface{}{"anyKey": "anyValue"}) + updatePrestoEngineAutoscalingOptionsModel.SetAuthInstanceID("testString") + updatePrestoEngineAutoscalingOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updatePrestoEngineAutoscalingOptionsModel).ToNot(BeNil()) + Expect(updatePrestoEngineAutoscalingOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(updatePrestoEngineAutoscalingOptionsModel.UpdateAutoScalingRequestPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updatePrestoEngineAutoscalingOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(updatePrestoEngineAutoscalingOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewUpdatePrestoEngineConfigOptions successfully`, func() { + // Construct an instance of the UpdatePrestoEngineConfigOptions model + engineID := "presto93" + authInstanceID := "crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::" + prestoEnginePropertiesDetailsPatch := map[string]interface{}{"anyKey": "anyValue"} + updatePrestoEngineConfigOptionsModel := watsonxDataService.NewUpdatePrestoEngineConfigOptions(engineID, authInstanceID, prestoEnginePropertiesDetailsPatch) + updatePrestoEngineConfigOptionsModel.SetEngineID("presto93") + updatePrestoEngineConfigOptionsModel.SetAuthInstanceID("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::") + updatePrestoEngineConfigOptionsModel.SetPrestoEnginePropertiesDetailsPatch(map[string]interface{}{"anyKey": "anyValue"}) + updatePrestoEngineConfigOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updatePrestoEngineConfigOptionsModel).ToNot(BeNil()) + Expect(updatePrestoEngineConfigOptionsModel.EngineID).To(Equal(core.StringPtr("presto93"))) + Expect(updatePrestoEngineConfigOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("crn:v1:staging:public:lakehouse:eu-de:a/810fe64a9e3446d1b919d0eff69d3c5f:87495456-c862-4b35-b8de-884b7f15eee4::"))) + Expect(updatePrestoEngineConfigOptionsModel.PrestoEnginePropertiesDetailsPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updatePrestoEngineConfigOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdatePrestoEngineOptions successfully`, func() { // Construct an instance of the UpdatePrestoEngineOptions model - engineID := "testString" + id := "testString" body := map[string]interface{}{"anyKey": "anyValue"} - updatePrestoEngineOptionsModel := watsonxDataService.NewUpdatePrestoEngineOptions(engineID, body) - updatePrestoEngineOptionsModel.SetEngineID("testString") + updatePrestoEngineOptionsModel := watsonxDataService.NewUpdatePrestoEngineOptions(id, body) + updatePrestoEngineOptionsModel.SetID("testString") updatePrestoEngineOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) updatePrestoEngineOptionsModel.SetAuthInstanceID("testString") updatePrestoEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updatePrestoEngineOptionsModel).ToNot(BeNil()) - Expect(updatePrestoEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(updatePrestoEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(updatePrestoEngineOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updatePrestoEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updatePrestoEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateSalIntegrationOptions successfully`, func() { // Construct an instance of the UpdateSalIntegrationOptions model - body := map[string]interface{}{"anyKey": "anyValue"} - updateSalIntegrationOptionsModel := watsonxDataService.NewUpdateSalIntegrationOptions(body) - updateSalIntegrationOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) + salIntegrationPatch := map[string]interface{}{"anyKey": "anyValue"} + updateSalIntegrationOptionsModel := watsonxDataService.NewUpdateSalIntegrationOptions(salIntegrationPatch) + updateSalIntegrationOptionsModel.SetSalIntegrationPatch(map[string]interface{}{"anyKey": "anyValue"}) updateSalIntegrationOptionsModel.SetAuthInstanceID("testString") updateSalIntegrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateSalIntegrationOptionsModel).ToNot(BeNil()) - Expect(updateSalIntegrationOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateSalIntegrationOptionsModel.SalIntegrationPatch).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateSalIntegrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateSalIntegrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateSparkEngineOptions successfully`, func() { // Construct an instance of the UpdateSparkEngineOptions model - engineID := "testString" + id := "testString" body := map[string]interface{}{"anyKey": "anyValue"} - updateSparkEngineOptionsModel := watsonxDataService.NewUpdateSparkEngineOptions(engineID, body) - updateSparkEngineOptionsModel.SetEngineID("testString") + updateSparkEngineOptionsModel := watsonxDataService.NewUpdateSparkEngineOptions(id, body) + updateSparkEngineOptionsModel.SetID("testString") updateSparkEngineOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) updateSparkEngineOptionsModel.SetAuthInstanceID("testString") updateSparkEngineOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateSparkEngineOptionsModel).ToNot(BeNil()) - Expect(updateSparkEngineOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) + Expect(updateSparkEngineOptionsModel.ID).To(Equal(core.StringPtr("testString"))) Expect(updateSparkEngineOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateSparkEngineOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateSparkEngineOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewUpdateStorageRegistrationOptions successfully`, func() { + // Construct an instance of the UpdateStorageRegistrationOptions model + id := "testString" + body := map[string]interface{}{"anyKey": "anyValue"} + updateStorageRegistrationOptionsModel := watsonxDataService.NewUpdateStorageRegistrationOptions(id, body) + updateStorageRegistrationOptionsModel.SetID("testString") + updateStorageRegistrationOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) + updateStorageRegistrationOptionsModel.SetSkipMdsCall(false) + updateStorageRegistrationOptionsModel.SetAuthInstanceID("testString") + updateStorageRegistrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(updateStorageRegistrationOptionsModel).ToNot(BeNil()) + Expect(updateStorageRegistrationOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateStorageRegistrationOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateStorageRegistrationOptionsModel.SkipMdsCall).To(Equal(core.BoolPtr(false))) + Expect(updateStorageRegistrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(updateStorageRegistrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) It(`Invoke NewUpdateSyncCatalogOptions successfully`, func() { // Construct an instance of the UpdateSyncCatalogOptions model - catalogID := "testString" - body := map[string]interface{}{"anyKey": "anyValue"} - updateSyncCatalogOptionsModel := watsonxDataService.NewUpdateSyncCatalogOptions(catalogID, body) - updateSyncCatalogOptionsModel.SetCatalogID("testString") - updateSyncCatalogOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) + id := "testString" + updateSyncCatalogOptionsModel := watsonxDataService.NewUpdateSyncCatalogOptions(id) + updateSyncCatalogOptionsModel.SetID("testString") + updateSyncCatalogOptionsModel.SetAutoAddNewTables(true) + updateSyncCatalogOptionsModel.SetRegisterNewTables(true) + updateSyncCatalogOptionsModel.SetSyncExistingTables(true) + updateSyncCatalogOptionsModel.SetSyncIcebergMd(true) + updateSyncCatalogOptionsModel.SetSyncPath("sample-path") updateSyncCatalogOptionsModel.SetAuthInstanceID("testString") updateSyncCatalogOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateSyncCatalogOptionsModel).ToNot(BeNil()) - Expect(updateSyncCatalogOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(updateSyncCatalogOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) + Expect(updateSyncCatalogOptionsModel.ID).To(Equal(core.StringPtr("testString"))) + Expect(updateSyncCatalogOptionsModel.AutoAddNewTables).To(Equal(core.BoolPtr(true))) + Expect(updateSyncCatalogOptionsModel.RegisterNewTables).To(Equal(core.BoolPtr(true))) + Expect(updateSyncCatalogOptionsModel.SyncExistingTables).To(Equal(core.BoolPtr(true))) + Expect(updateSyncCatalogOptionsModel.SyncIcebergMd).To(Equal(core.BoolPtr(true))) + Expect(updateSyncCatalogOptionsModel.SyncPath).To(Equal(core.StringPtr("sample-path"))) Expect(updateSyncCatalogOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateSyncCatalogOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) It(`Invoke NewUpdateTableOptions successfully`, func() { // Construct an instance of the UpdateTableOptions model - catalogID := "testString" - schemaID := "testString" - tableID := "testString" + catalogName := "testString" + schemaName := "testString" + tableName := "testString" engineID := "testString" body := map[string]interface{}{"anyKey": "anyValue"} - updateTableOptionsModel := watsonxDataService.NewUpdateTableOptions(catalogID, schemaID, tableID, engineID, body) - updateTableOptionsModel.SetCatalogID("testString") - updateTableOptionsModel.SetSchemaID("testString") - updateTableOptionsModel.SetTableID("testString") + updateTableOptionsModel := watsonxDataService.NewUpdateTableOptions(catalogName, schemaName, tableName, engineID, body) + updateTableOptionsModel.SetCatalogName("testString") + updateTableOptionsModel.SetSchemaName("testString") + updateTableOptionsModel.SetTableName("testString") updateTableOptionsModel.SetEngineID("testString") updateTableOptionsModel.SetBody(map[string]interface{}{"anyKey": "anyValue"}) updateTableOptionsModel.SetType("testString") updateTableOptionsModel.SetAuthInstanceID("testString") updateTableOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) Expect(updateTableOptionsModel).ToNot(BeNil()) - Expect(updateTableOptionsModel.CatalogID).To(Equal(core.StringPtr("testString"))) - Expect(updateTableOptionsModel.SchemaID).To(Equal(core.StringPtr("testString"))) - Expect(updateTableOptionsModel.TableID).To(Equal(core.StringPtr("testString"))) + Expect(updateTableOptionsModel.CatalogName).To(Equal(core.StringPtr("testString"))) + Expect(updateTableOptionsModel.SchemaName).To(Equal(core.StringPtr("testString"))) + Expect(updateTableOptionsModel.TableName).To(Equal(core.StringPtr("testString"))) Expect(updateTableOptionsModel.EngineID).To(Equal(core.StringPtr("testString"))) Expect(updateTableOptionsModel.Body).To(Equal(map[string]interface{}{"anyKey": "anyValue"})) Expect(updateTableOptionsModel.Type).To(Equal(core.StringPtr("testString"))) Expect(updateTableOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) Expect(updateTableOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) }) + It(`Invoke NewValidateIntegrationOptions successfully`, func() { + // Construct an instance of the Catalogs model + catalogsModel := new(watsonxdatav3.Catalogs) + Expect(catalogsModel).ToNot(BeNil()) + catalogsModel.CatalogNames = []string{"iceberg_data", "hive_data"} + Expect(catalogsModel.CatalogNames).To(Equal([]string{"iceberg_data", "hive_data"})) + + // Construct an instance of the ValidateIntegrationOptions model + validateIntegrationOptionsType := "ranger" + validateIntegrationOptionsModel := watsonxDataService.NewValidateIntegrationOptions(validateIntegrationOptionsType) + validateIntegrationOptionsModel.SetType("ranger") + validateIntegrationOptionsModel.SetAccessToken("Header.Payload.Signature") + validateIntegrationOptionsModel.SetApikey("apikey") + validateIntegrationOptionsModel.SetCatalogs(catalogsModel) + validateIntegrationOptionsModel.SetCertificate("certificate_content_base64_encoded") + validateIntegrationOptionsModel.SetPassword("password") + validateIntegrationOptionsModel.SetSsl(true) + validateIntegrationOptionsModel.SetURL("https://www.abcd.com") + validateIntegrationOptionsModel.SetUsername("username") + validateIntegrationOptionsModel.SetAuthInstanceID("testString") + validateIntegrationOptionsModel.SetHeaders(map[string]string{"foo": "bar"}) + Expect(validateIntegrationOptionsModel).ToNot(BeNil()) + Expect(validateIntegrationOptionsModel.Type).To(Equal(core.StringPtr("ranger"))) + Expect(validateIntegrationOptionsModel.AccessToken).To(Equal(core.StringPtr("Header.Payload.Signature"))) + Expect(validateIntegrationOptionsModel.Apikey).To(Equal(core.StringPtr("apikey"))) + Expect(validateIntegrationOptionsModel.Catalogs).To(Equal(catalogsModel)) + Expect(validateIntegrationOptionsModel.Certificate).To(Equal(core.StringPtr("certificate_content_base64_encoded"))) + Expect(validateIntegrationOptionsModel.Password).To(Equal(core.StringPtr("password"))) + Expect(validateIntegrationOptionsModel.Ssl).To(Equal(core.BoolPtr(true))) + Expect(validateIntegrationOptionsModel.URL).To(Equal(core.StringPtr("https://www.abcd.com"))) + Expect(validateIntegrationOptionsModel.Username).To(Equal(core.StringPtr("username"))) + Expect(validateIntegrationOptionsModel.AuthInstanceID).To(Equal(core.StringPtr("testString"))) + Expect(validateIntegrationOptionsModel.Headers).To(Equal(map[string]string{"foo": "bar"})) + }) + It(`Invoke NewWorkerNodeDescriptionBody successfully`, func() { + nodeType := "starter" + quantity := int64(1) + _model, err := watsonxDataService.NewWorkerNodeDescriptionBody(nodeType, quantity) + Expect(_model).ToNot(BeNil()) + Expect(err).To(BeNil()) + }) }) }) Describe(`Model unmarshaling tests`, func() { - It(`Invoke UnmarshalBucketCatalog successfully`, func() { + It(`Invoke UnmarshalAccessPoliciesSearch successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.BucketCatalog) - model.BasePath = core.StringPtr("/abc/def") - model.CatalogName = core.StringPtr("sampleCatalog") - model.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - model.CatalogType = core.StringPtr("iceberg") + model := new(watsonxdatav3.AccessPoliciesSearch) + model.Resources = nil + model.SubjectsToSearch = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38696,22 +42748,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.BucketCatalog - err = watsonxdatav2.UnmarshalBucketCatalog(raw, &result) + var result *watsonxdatav3.AccessPoliciesSearch + err = watsonxdatav3.UnmarshalAccessPoliciesSearch(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalBucketDetails successfully`, func() { + It(`Invoke UnmarshalAccessPolicyBulkUpdate successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.BucketDetails) - model.AccessKey = core.StringPtr("b9cbf248ea5c4c96947e64407108559j") - model.BucketName = core.StringPtr("sample-bucket") - model.Endpoint = core.StringPtr("https://s3..cloud-object-storage.appdomain.cloud/") - model.KeyFile = core.StringPtr("key_file") - model.Provider = core.StringPtr("ibm_cos") - model.Region = core.StringPtr("us-south") - model.SecretKey = core.StringPtr("13b4045cac1a0be54c9fjbe53cb22df5fn397cd2c45b66c87") + model := new(watsonxdatav3.AccessPolicyBulkUpdate) + model.Resources = nil + model.Subjects = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38720,19 +42767,21 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.BucketDetails - err = watsonxdatav2.UnmarshalBucketDetails(raw, &result) + var result *watsonxdatav3.AccessPolicyBulkUpdate + err = watsonxdatav3.UnmarshalAccessPolicyBulkUpdate(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalBucketRegistrationPatch successfully`, func() { + It(`Invoke UnmarshalAutoScalingConfig successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.BucketRegistrationPatch) - model.BucketDetails = nil - model.BucketDisplayName = core.StringPtr("sample-bucket-displayname") - model.Description = core.StringPtr("COS bucket for customer data") - model.Tags = []string{"testbucket", "userbucket"} + model := new(watsonxdatav3.AutoScalingConfig) + model.Target = core.Int64Ptr(int64(40)) + model.MinWorkerQuantity = core.Int64Ptr(int64(1)) + model.MaxWorkerQuantity = core.Int64Ptr(int64(1)) + model.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + model.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + model.ScalingStepSize = core.Int64Ptr(int64(1)) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38741,22 +42790,22 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.BucketRegistrationPatch - err = watsonxdatav2.UnmarshalBucketRegistrationPatch(raw, &result) + var result *watsonxdatav3.AutoScalingConfig + err = watsonxdatav3.UnmarshalAutoScalingConfig(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalColumn successfully`, func() { + It(`Invoke UnmarshalAutoscalingConfig successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.Column) - model.ColumnName = core.StringPtr("expenses") - model.Comment = core.StringPtr("expenses column") - model.Extra = core.StringPtr("varchar") - model.Length = core.StringPtr("30") - model.Scale = core.StringPtr("2") - model.Precision = core.StringPtr("10") - model.Type = core.StringPtr("varchar") + model := new(watsonxdatav3.AutoscalingConfig) + model.Type = core.StringPtr("cpu") + model.Target = core.Int64Ptr(int64(40)) + model.MinWorkerQuantity = core.Int64Ptr(int64(1)) + model.MaxWorkerQuantity = core.Int64Ptr(int64(18)) + model.QueryTerminationGracePeriodMin = core.Int64Ptr(int64(1)) + model.ScaleInStabilizationWindowMin = core.Int64Ptr(int64(5)) + model.ScalingStepSize = core.Int64Ptr(int64(1)) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38765,16 +42814,28 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.Column - err = watsonxdatav2.UnmarshalColumn(raw, &result) + var result *watsonxdatav3.AutoscalingConfig + err = watsonxdatav3.UnmarshalAutoscalingConfig(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalColumnPatch successfully`, func() { + It(`Invoke UnmarshalBucketDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.ColumnPatch) - model.ColumnName = core.StringPtr("expenses") + model := new(watsonxdatav3.BucketDetails) + model.AccessKey = core.StringPtr("testString") + model.AccountName = core.StringPtr("testString") + model.ApplicationID = core.StringPtr("testString") + model.ContainerName = core.StringPtr("testString") + model.DirectoryID = core.StringPtr("testString") + model.Endpoint = core.StringPtr("testString") + model.Region = core.StringPtr("testString") + model.SecretKey = core.StringPtr("testString") + model.AuthMode = core.StringPtr("aws_assume_role") + model.RoleArn = core.StringPtr("testString") + model.ManagedBy = core.StringPtr("testString") + model.Name = core.StringPtr("testString") + model.Type = core.StringPtr("adls_gen1") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38783,18 +42844,16 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.ColumnPatch - err = watsonxdatav2.UnmarshalColumnPatch(raw, &result) + var result *watsonxdatav3.BucketDetails + err = watsonxdatav3.UnmarshalBucketDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalDatabaseCatalog successfully`, func() { + It(`Invoke UnmarshalCapacityDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.DatabaseCatalog) - model.CatalogName = core.StringPtr("sampleCatalog") - model.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} - model.CatalogType = core.StringPtr("iceberg") + model := new(watsonxdatav3.CapacityDetails) + model.ID = CreateMockUUID("6f51248a-4cda-459a-b141-eb9b76bb6689") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38803,51 +42862,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.DatabaseCatalog - err = watsonxdatav2.UnmarshalDatabaseCatalog(raw, &result) + var result *watsonxdatav3.CapacityDetails + err = watsonxdatav3.UnmarshalCapacityDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalDatabaseDetails successfully`, func() { + It(`Invoke UnmarshalCatalogProperties successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.DatabaseDetails) - model.AuthenticationType = core.StringPtr("LDAP") - model.BrokerAuthenticationPassword = core.StringPtr("samplepassword") - model.BrokerAuthenticationType = core.StringPtr("PASSWORD") - model.BrokerAuthenticationUser = core.StringPtr("sampleuser") - model.Certificate = core.StringPtr("contents of a pem/crt file") - model.CertificateExtension = core.StringPtr("pem/crt") - model.ConnectionMethod = core.StringPtr("basic, apikey") - model.ConnectionMode = core.StringPtr("service_name") - model.ConnectionModeValue = core.StringPtr("orclpdb") - model.ConnectionType = core.StringPtr("JDBC, Arrow flight") - model.ControllerAuthenticationPassword = core.StringPtr("samplepassword") - model.ControllerAuthenticationType = core.StringPtr("PASSWORD") - model.ControllerAuthenticationUser = core.StringPtr("sampleuser") - model.CpdHostname = core.StringPtr("samplecpdhostname") - model.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") - model.DatabaseName = core.StringPtr("new_database") - model.Hostname = core.StringPtr("db2@.com") - model.HostnameInCertificate = core.StringPtr("samplehostname") - model.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") - model.InformixServer = core.StringPtr("ol_informix1410") - model.Password = core.StringPtr("samplepassword") - model.Port = core.Int64Ptr(int64(4553)) - model.ProjectID = core.StringPtr("conops-bigquery") - model.Sasl = core.BoolPtr(true) - model.ServiceApiKey = core.StringPtr("sampleapikey") - model.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") - model.ServicePassword = core.StringPtr("samplepassword") - model.ServicePort = core.Int64Ptr(int64(443)) - model.ServiceSsl = core.BoolPtr(true) - model.ServiceTokenURL = core.StringPtr("sampletoakenurl") - model.ServiceUsername = core.StringPtr("sampleusername") - model.Ssl = core.BoolPtr(true) - model.Tables = core.StringPtr("kafka_table_name") - model.Username = core.StringPtr("sampleuser") - model.ValidateServerCertificate = core.BoolPtr(true) - model.VerifyHostName = core.BoolPtr(true) + model := new(watsonxdatav3.CatalogProperties) + model.Coordinator = map[string]string{"key1": "testString"} + model.Worker = map[string]string{"key1": "testString"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38856,20 +42881,16 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.DatabaseDetails - err = watsonxdatav2.UnmarshalDatabaseDetails(raw, &result) + var result *watsonxdatav3.CatalogProperties + err = watsonxdatav3.UnmarshalCatalogProperties(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalDatabaseRegistrationPatch successfully`, func() { + It(`Invoke UnmarshalCatalogs successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.DatabaseRegistrationPatch) - model.DatabaseDetails = nil - model.DatabaseDisplayName = core.StringPtr("new_database") - model.Description = core.StringPtr("External database description") - model.Tags = []string{"testdatabase", "userdatabase"} - model.Topics = nil + model := new(watsonxdatav3.Catalogs) + model.CatalogNames = []string{"iceberg_data", "hive_data"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38878,17 +42899,22 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.DatabaseRegistrationPatch - err = watsonxdatav2.UnmarshalDatabaseRegistrationPatch(raw, &result) + var result *watsonxdatav3.Catalogs + err = watsonxdatav3.UnmarshalCatalogs(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalDatabaseRegistrationPatchDatabaseDetails successfully`, func() { + It(`Invoke UnmarshalColumn successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.DatabaseRegistrationPatchDatabaseDetails) - model.Password = core.StringPtr("samplepassword") - model.Username = core.StringPtr("sampleuser") + model := new(watsonxdatav3.Column) + model.Comment = core.StringPtr("Expenses column for each department") + model.Extra = core.StringPtr("AUTO_INCREMENT") + model.Length = core.StringPtr("30") + model.Name = core.StringPtr("expenses") + model.Precision = core.StringPtr("10") + model.Scale = core.StringPtr("2") + model.Type = core.StringPtr("varchar") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38897,19 +42923,16 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.DatabaseRegistrationPatchDatabaseDetails - err = watsonxdatav2.UnmarshalDatabaseRegistrationPatchDatabaseDetails(raw, &result) + var result *watsonxdatav3.Column + err = watsonxdatav3.UnmarshalColumn(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalDatabaseRegistrationPatchTopicsItems successfully`, func() { + It(`Invoke UnmarshalColumnPatch successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.DatabaseRegistrationPatchTopicsItems) - model.CreatedOn = core.StringPtr("1686792721") - model.FileContents = core.StringPtr("sample file contents") - model.FileName = core.StringPtr("sample file name") - model.TopicName = core.StringPtr("customer") + model := new(watsonxdatav3.ColumnPatch) + model.Name = core.StringPtr("expenses") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38918,18 +42941,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.DatabaseRegistrationPatchTopicsItems - err = watsonxdatav2.UnmarshalDatabaseRegistrationPatchTopicsItems(raw, &result) + var result *watsonxdatav3.ColumnPatch + err = watsonxdatav3.UnmarshalColumnPatch(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalDatabaseRegistrationPrototypeDatabasePropertiesItems successfully`, func() { + It(`Invoke UnmarshalConfigurationProperties successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems) - model.Encrypt = core.BoolPtr(true) - model.Key = core.StringPtr("hive.metastore") - model.Value = core.StringPtr("glue") + model := new(watsonxdatav3.ConfigurationProperties) + model.Coordinator = map[string]string{"key1": "configuration_property_value"} + model.Worker = map[string]string{"key1": "configuration_property_value"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38938,16 +42960,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.DatabaseRegistrationPrototypeDatabasePropertiesItems - err = watsonxdatav2.UnmarshalDatabaseRegistrationPrototypeDatabasePropertiesItems(raw, &result) + var result *watsonxdatav3.ConfigurationProperties + err = watsonxdatav3.UnmarshalConfigurationProperties(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalDb2EngineDetailsBody successfully`, func() { + It(`Invoke UnmarshalCoordinatorNodeDescriptionBody successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.Db2EngineDetailsBody) - model.ConnectionString = core.StringPtr("1.2.3.4") + model := new(watsonxdatav3.CoordinatorNodeDescriptionBody) + model.NodeType = core.StringPtr("starter") + model.Quantity = core.Int64Ptr(int64(1)) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38956,18 +42979,767 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.Db2EngineDetailsBody - err = watsonxdatav2.UnmarshalDb2EngineDetailsBody(raw, &result) + var result *watsonxdatav3.CoordinatorNodeDescriptionBody + err = watsonxdatav3.UnmarshalCoordinatorNodeDescriptionBody(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalDb2EnginePatch successfully`, func() { + It(`Invoke UnmarshalDatabaseCatalogPrototype successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.Db2EnginePatch) - model.Description = core.StringPtr("db2 engine updated description") - model.EngineDisplayName = core.StringPtr("sampleEngine") - model.Tags = []string{"tag1", "tag2"} + model := new(watsonxdatav3.DatabaseCatalogPrototype) + model.CatalogName = core.StringPtr("sampleCatalog") + model.CatalogType = core.StringPtr("iceberg") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.DatabaseCatalogPrototype + err = watsonxdatav3.UnmarshalDatabaseCatalogPrototype(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalDatabaseDetailsPrototype successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.DatabaseDetailsPrototype) + model.AuthenticationType = core.StringPtr("LDAP, NTLM, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword") + model.AuthenticationValue = core.StringPtr("LDAP") + model.AuthenticationValueKeyVault = nil + model.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + model.BrokerAuthenticationType = core.StringPtr("PASSWORD") + model.BrokerAuthenticationUser = core.StringPtr("sampleuser") + model.BrokerHost = core.StringPtr("samplehost") + model.BrokerPort = core.Int64Ptr(int64(4553)) + model.Certificate = core.StringPtr("exampleCertificate") + model.CertificateExtension = core.StringPtr("pem") + model.ConnectionMethod = core.StringPtr("basic, apikey") + model.ConnectionMode = core.StringPtr("service_name") + model.ConnectionModeValue = core.StringPtr("orclpdb") + model.ConnectionType = core.StringPtr("JDBC, Arrow flight") + model.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + model.ControllerAuthenticationType = core.StringPtr("PASSWORD") + model.ControllerAuthenticationUser = core.StringPtr("sampleuser") + model.CoordinatorHost = core.StringPtr("samplehost") + model.CoordinatorPort = core.Int64Ptr(int64(4553)) + model.CpdHostname = core.StringPtr("samplecpdhostname") + model.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") + model.DomainName = core.StringPtr("conops-mssql.conops.local") + model.Hostname = core.StringPtr("http://db2@localhost:9900.com") + model.HostnameInCertificate = core.StringPtr("samplehostname") + model.Hosts = core.StringPtr("abc.com:1234,xyz.com:4321") + model.InformixServer = core.StringPtr("ol_informix1410") + model.Name = core.StringPtr("new_database") + model.Password = core.StringPtr("samplepassword") + model.PasswordKeyVault = nil + model.Port = core.Int64Ptr(int64(4553)) + model.ProjectID = core.StringPtr("conops-bigquery") + model.Sasl = core.BoolPtr(true) + model.SaslMechanism = core.StringPtr("plain") + model.SchemaName = core.StringPtr("sampleSchema") + model.Schemas = core.StringPtr("redis__name") + model.ServiceApiKey = core.StringPtr("sampleapikey") + model.ServiceHostname = core.StringPtr("api.dataplatform.dev.cloud.ibm.com") + model.ServicePassword = core.StringPtr("samplepassword") + model.ServicePort = core.Int64Ptr(int64(443)) + model.ServiceSsl = core.BoolPtr(true) + model.ServiceTokenURL = core.StringPtr("sampletoakenurl") + model.ServiceUsername = core.StringPtr("sampleusername") + model.Ssl = core.BoolPtr(true) + model.SslcertificateKeyVault = nil + model.Tables = core.StringPtr("kafka_table_name, redis_table_name") + model.Username = core.StringPtr("sampleuser") + model.UsernameKeyVault = nil + model.ValidateServerCertificate = core.BoolPtr(true) + model.VaultEnabled = core.BoolPtr(true) + model.VerifyHostName = core.BoolPtr(true) + model.WarehouseName = core.StringPtr("samplewrehouse") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.DatabaseDetailsPrototype + err = watsonxdatav3.UnmarshalDatabaseDetailsPrototype(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalDatabaseRegistrationPatch successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.DatabaseRegistrationPatch) + model.Connection = nil + model.Description = core.StringPtr("External database description") + model.DisplayName = core.StringPtr("new_database") + model.Tables = nil + model.Tags = []string{"testdatabase", "userdatabase"} + model.Topics = nil + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.DatabaseRegistrationPatch + err = watsonxdatav3.UnmarshalDatabaseRegistrationPatch(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalDatabaseRegistrationPatchDatabaseDetails successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetails) + model.AuthenticationValue = core.StringPtr("LDAP") + model.BrokerAuthenticationPassword = core.StringPtr("samplepassword") + model.BrokerAuthenticationType = core.StringPtr("PASSWORD") + model.BrokerAuthenticationUser = core.StringPtr("sampleuser") + model.ControllerAuthenticationPassword = core.StringPtr("samplepassword") + model.ControllerAuthenticationType = core.StringPtr("PASSWORD") + model.ControllerAuthenticationUser = core.StringPtr("sampleuser") + model.CredentialsKey = core.StringPtr("eyJ0eXBlIjoic2VydmljZV9hY2NvdW50IiwicHJvamVjdF9pZCI6ImNvbm9wcy1iaWdxdWVyeSIsInByaXZhdGVfa2V5X2lkIjoiMGY3......") + model.Password = core.StringPtr("samplepassword") + model.Properties = nil + model.Username = core.StringPtr("sampleuser") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.DatabaseRegistrationPatchDatabaseDetails + err = watsonxdatav3.UnmarshalDatabaseRegistrationPatchDatabaseDetails(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalDatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems) + model.Encrypt = core.BoolPtr(true) + model.Key = core.StringPtr("hive.metastore") + model.Value = core.StringPtr("glue") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.DatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems + err = watsonxdatav3.UnmarshalDatabaseRegistrationPatchDatabaseDetailsDatabasePropertiesItems(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalDatabaseRegistrationPatchTablesItems successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.DatabaseRegistrationPatchTablesItems) + model.CreatedAt = core.StringPtr("1686792721") + model.FileContents = core.StringPtr("sample file content") + model.FileName = core.StringPtr("test.json") + model.SchemaName = core.StringPtr("customer") + model.TableName = core.StringPtr("customer") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.DatabaseRegistrationPatchTablesItems + err = watsonxdatav3.UnmarshalDatabaseRegistrationPatchTablesItems(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalDatabaseRegistrationPatchTopicsItems successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.DatabaseRegistrationPatchTopicsItems) + model.CreatedAt = core.StringPtr("1686792721") + model.FileContents = core.StringPtr("sample file contents") + model.FileName = core.StringPtr("test.json") + model.TopicName = core.StringPtr("customer") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.DatabaseRegistrationPatchTopicsItems + err = watsonxdatav3.UnmarshalDatabaseRegistrationPatchTopicsItems(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalDatabaseRegistrationPrototypeDatabasePropertiesItems successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems) + model.Encrypt = core.BoolPtr(true) + model.Key = core.StringPtr("hive.metastore") + model.Value = core.StringPtr("glue") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.DatabaseRegistrationPrototypeDatabasePropertiesItems + err = watsonxdatav3.UnmarshalDatabaseRegistrationPrototypeDatabasePropertiesItems(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalDb2EngineDetailsBody successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.Db2EngineDetailsBody) + model.ConnectionString = core.StringPtr("1.2.3.4") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.Db2EngineDetailsBody + err = watsonxdatav3.UnmarshalDb2EngineDetailsBody(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalDb2EnginePatch successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.Db2EnginePatch) + model.Description = core.StringPtr("db2 engine updated description") + model.DisplayName = core.StringPtr("sampleEngine") + model.Tags = []string{"tag1", "tag2"} + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.Db2EnginePatch + err = watsonxdatav3.UnmarshalDb2EnginePatch(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalDbConnectionModel successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.DbConnectionModel) + model.DatabaseID = core.StringPtr("testString") + model.DbType = core.StringPtr("testString") + model.Host = core.StringPtr("testString") + model.Port = core.StringPtr("testString") + model.DbName = core.StringPtr("testString") + model.DbUsername = core.StringPtr("testString") + model.Password = core.StringPtr("testString") + model.AuthenticationValue = core.StringPtr("testString") + model.IsSsl = core.BoolPtr(false) + model.CertExtension = core.StringPtr("testString") + model.CertContent = core.StringPtr("testString") + model.ConnectionMode = core.StringPtr("testString") + model.ConnectionModeValue = core.StringPtr("testString") + model.JdbcURL = core.StringPtr("testString") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.DbConnectionModel + err = watsonxdatav3.UnmarshalDbConnectionModel(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalEngineDetails successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.EngineDetails) + model.Coordinator = nil + model.SizeConfig = core.StringPtr("starter") + model.Worker = nil + model.AutoscalingEnabled = core.BoolPtr(true) + model.AutoscalingConfig = nil + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.EngineDetails + err = watsonxdatav3.UnmarshalEngineDetails(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalEngineProperties successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.EngineProperties) + model.Catalog = nil + model.Configuration = nil + model.EventListener = map[string]string{"key1": "event_listener_property_value"} + model.Global = map[string]string{"key1": "global_property_value"} + model.JmxExporterConfig = map[string]string{"key1": "jmx_exporter_config_property_value"} + model.Jvm = nil + model.LogConfig = nil + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.EngineProperties + err = watsonxdatav3.UnmarshalEngineProperties(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalEnginePropertiesCatalogAdditionalProperties successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.EnginePropertiesCatalogAdditionalProperties) + model.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + model.Worker = map[string]interface{}{"anyKey": "anyValue"} + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.EnginePropertiesCatalogAdditionalProperties + err = watsonxdatav3.UnmarshalEnginePropertiesCatalogAdditionalProperties(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalEnginePropertiesConfiguration successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.EnginePropertiesConfiguration) + model.Coordinator = map[string]string{"key1": "configuration_property_value"} + model.Worker = map[string]string{"key1": "configuration_property_value"} + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.EnginePropertiesConfiguration + err = watsonxdatav3.UnmarshalEnginePropertiesConfiguration(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalEnginePropertiesJvm successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.EnginePropertiesJvm) + model.Coordinator = map[string]string{"key1": "JVM_property_value"} + model.Worker = map[string]string{"key1": "JVM_property_value"} + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.EnginePropertiesJvm + err = watsonxdatav3.UnmarshalEnginePropertiesJvm(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalEnginePropertiesLogConfig successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.EnginePropertiesLogConfig) + model.Coordinator = map[string]string{"key1": "testString"} + model.Worker = map[string]string{"key1": "log_config_property_value"} + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.EnginePropertiesLogConfig + err = watsonxdatav3.UnmarshalEnginePropertiesLogConfig(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalEnrichmentObj successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.EnrichmentObj) + model.Catalog = core.StringPtr("iceberg_data") + model.Operation = core.StringPtr("create") + model.Schema = core.StringPtr("schema1") + model.Tables = []string{"table1"} + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.EnrichmentObj + err = watsonxdatav3.UnmarshalEnrichmentObj(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalExecuteConfig successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.ExecuteConfig) + model.DriverMemory = core.StringPtr("testString") + model.DriverCores = core.Int64Ptr(int64(1)) + model.ExecutorMemory = core.StringPtr("testString") + model.ExecutorCores = core.Int64Ptr(int64(1)) + model.NumExecutors = core.Int64Ptr(int64(1)) + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.ExecuteConfig + err = watsonxdatav3.UnmarshalExecuteConfig(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalFileFormatProperties successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.FileFormatProperties) + model.Encoding = core.StringPtr("testString") + model.EscapeCharacter = core.StringPtr("testString") + model.FieldDelimiter = core.StringPtr("testString") + model.Header = core.BoolPtr(true) + model.LineDelimiter = core.StringPtr("testString") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.FileFormatProperties + err = watsonxdatav3.UnmarshalFileFormatProperties(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalIcebergSourceTable successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.IcebergSourceTable) + model.SchemaName = core.StringPtr("testString") + model.TableName = core.StringPtr("testString") + model.CatalogName = core.StringPtr("testString") + model.WarehouseName = core.StringPtr("testString") + model.SnapshotID = core.Int64Ptr(int64(0)) + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.IcebergSourceTable + err = watsonxdatav3.UnmarshalIcebergSourceTable(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalIngestionEngine successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.IngestionEngine) + model.EngineID = core.StringPtr("testString") + model.Name = core.StringPtr("testString") + model.Endpoint = core.StringPtr("testString") + model.Origin = core.StringPtr("testString") + model.ExecuteConfig = nil + model.BucketDetails = nil + model.LogPath = core.StringPtr("testString") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.IngestionEngine + err = watsonxdatav3.UnmarshalIngestionEngine(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalIngestionSchemaResponse successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.IngestionSchemaResponse) + model.FieldID = core.Int64Ptr(int64(0)) + model.HeaderName = core.StringPtr("testString") + model.Type = core.StringPtr("testString") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.IngestionSchemaResponse + err = watsonxdatav3.UnmarshalIngestionSchemaResponse(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalIntegrationPatch successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.IntegrationPatch) + model.AccessToken = core.StringPtr("Header.Payload.Signature") + model.Apikey = core.StringPtr("apikey") + model.Catalogs = nil + model.Certificate = core.StringPtr("certificate_content_base64_encoded") + model.CertificateExtension = core.StringPtr("pem") + model.ConnectionMode = core.StringPtr("external") + model.CrossAccountIntegration = core.BoolPtr(false) + model.EnableDataPolicyWithinWxd = core.BoolPtr(false) + model.IkcUserAccountID = core.StringPtr("ikc_user_account_id") + model.Password = core.StringPtr("password") + model.PolicyCacheTimeConfiguration = core.StringPtr("123456789") + model.Resource = core.StringPtr("presto01") + model.Ssl = core.BoolPtr(true) + model.State = core.StringPtr("active") + model.URL = core.StringPtr("https://abcd.efgh.com") + model.Username = core.StringPtr("username") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.IntegrationPatch + err = watsonxdatav3.UnmarshalIntegrationPatch(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalJSONPatchOperation successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.JSONPatchOperation) + model.Op = core.StringPtr("add") + model.Path = core.StringPtr("testString") + model.From = core.StringPtr("testString") + model.Value = "testString" + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.JSONPatchOperation + err = watsonxdatav3.UnmarshalJSONPatchOperation(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalJvmProperties successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.JvmProperties) + model.Coordinator = map[string]string{"key1": "JVM_property_value"} + model.Worker = map[string]string{"key1": "JVM_property_value"} + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.JvmProperties + err = watsonxdatav3.UnmarshalJvmProperties(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalLogConfigProperties successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.LogConfigProperties) + model.Coordinator = map[string]string{"key1": "log_config_property_value"} + model.Worker = map[string]string{"key1": "log_config_property_value"} + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.LogConfigProperties + err = watsonxdatav3.UnmarshalLogConfigProperties(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalMilvusServicePatch successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.MilvusServicePatch) + model.Description = core.StringPtr("updated description for milvus service") + model.DisplayName = core.StringPtr("sampleService") + model.Tags = []string{"tag1", "tag2"} + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.MilvusServicePatch + err = watsonxdatav3.UnmarshalMilvusServicePatch(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalNetezzaEngineConfigurationBody successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.NetezzaEngineConfigurationBody) + model.ConnectionString = core.StringPtr("1.2.3.4") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.NetezzaEngineConfigurationBody + err = watsonxdatav3.UnmarshalNetezzaEngineConfigurationBody(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalNetezzaEnginePatch successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.NetezzaEnginePatch) + model.Description = core.StringPtr("netezza engine updated description") + model.DisplayName = core.StringPtr("sampleEngine") + model.Tags = []string{"tag1", "tag2"} + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.NetezzaEnginePatch + err = watsonxdatav3.UnmarshalNetezzaEnginePatch(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalNodeDescription successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.NodeDescription) + model.NodeType = core.StringPtr("worker") + model.Quantity = core.Int64Ptr(int64(1)) + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.NodeDescription + err = watsonxdatav3.UnmarshalNodeDescription(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalOtherEngineConfigurationBody successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.OtherEngineConfigurationBody) + model.ConnectionString = core.StringPtr("1.2.3.4") + model.Type = core.StringPtr("netezza") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.OtherEngineConfigurationBody + err = watsonxdatav3.UnmarshalOtherEngineConfigurationBody(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalPath successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.Path) + model.Path = core.StringPtr("testString") + + b, err := json.Marshal(model) + Expect(err).To(BeNil()) + + var raw map[string]json.RawMessage + err = json.Unmarshal(b, &raw) + Expect(err).To(BeNil()) + + var result *watsonxdatav3.Path + err = watsonxdatav3.UnmarshalPath(raw, &result) + Expect(err).To(BeNil()) + Expect(result).ToNot(BeNil()) + Expect(result).To(Equal(model)) + }) + It(`Invoke UnmarshalPrestissimoEngineDetails successfully`, func() { + // Construct an instance of the model. + model := new(watsonxdatav3.PrestissimoEngineDetails) + model.Coordinator = nil + model.SizeConfig = core.StringPtr("starter") + model.Worker = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38976,16 +43748,21 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.Db2EnginePatch - err = watsonxdatav2.UnmarshalDb2EnginePatch(raw, &result) + var result *watsonxdatav3.PrestissimoEngineDetails + err = watsonxdatav3.UnmarshalPrestissimoEngineDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalDriverRegistrationEnginePrototype successfully`, func() { + It(`Invoke UnmarshalPrestissimoEnginePatch successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.DriverRegistrationEnginePrototype) - model.Engines = []string{"testString"} + model := new(watsonxdatav3.PrestissimoEnginePatch) + model.Description = core.StringPtr("updated description for prestissimo engine") + model.DisplayName = core.StringPtr("sampleEngine") + model.Properties = nil + model.RemoveEngineProperties = nil + model.RestartType = core.StringPtr("force") + model.Tags = []string{"tag1", "tag2"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -38994,22 +43771,22 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.DriverRegistrationEnginePrototype - err = watsonxdatav2.UnmarshalDriverRegistrationEnginePrototype(raw, &result) + var result *watsonxdatav3.PrestissimoEnginePatch + err = watsonxdatav3.UnmarshalPrestissimoEnginePatch(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalEngineDetailsBody successfully`, func() { + It(`Invoke UnmarshalPrestissimoEngineProperties successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.EngineDetailsBody) - model.ApiKey = core.StringPtr("") - model.ConnectionString = core.StringPtr("1.2.3.4") - model.Coordinator = nil - model.InstanceID = core.StringPtr("instance_id") - model.ManagedBy = core.StringPtr("fully/self") - model.SizeConfig = core.StringPtr("starter") - model.Worker = nil + model := new(watsonxdatav3.PrestissimoEngineProperties) + model.Catalog = nil + model.Configuration = nil + model.Global = map[string]string{"key1": "testString"} + model.Jvm = nil + model.LogConfig = nil + model.OptimizerProperties = map[string]string{"key1": "testString"} + model.Velox = map[string]string{"key1": "testString"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39018,17 +43795,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.EngineDetailsBody - err = watsonxdatav2.UnmarshalEngineDetailsBody(raw, &result) + var result *watsonxdatav3.PrestissimoEngineProperties + err = watsonxdatav3.UnmarshalPrestissimoEngineProperties(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalEnginePropertiesCatalog successfully`, func() { + It(`Invoke UnmarshalPrestissimoEnginePropertiesCatalogAdditionalProperties successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.EnginePropertiesCatalog) - model.Coordinator = map[string]string{"key1": "testString"} - model.Worker = map[string]string{"key1": "testString"} + model := new(watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties) + model.Coordinator = map[string]interface{}{"anyKey": "anyValue"} + model.Worker = map[string]interface{}{"anyKey": "anyValue"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39037,15 +43814,15 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.EnginePropertiesCatalog - err = watsonxdatav2.UnmarshalEnginePropertiesCatalog(raw, &result) + var result *watsonxdatav3.PrestissimoEnginePropertiesCatalogAdditionalProperties + err = watsonxdatav3.UnmarshalPrestissimoEnginePropertiesCatalogAdditionalProperties(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalEnginePropertiesLogConfiguration successfully`, func() { + It(`Invoke UnmarshalPrestissimoEnginePropertiesConfiguration successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.EnginePropertiesLogConfiguration) + model := new(watsonxdatav3.PrestissimoEnginePropertiesConfiguration) model.Coordinator = map[string]string{"key1": "testString"} model.Worker = map[string]string{"key1": "testString"} @@ -39056,17 +43833,16 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.EnginePropertiesLogConfiguration - err = watsonxdatav2.UnmarshalEnginePropertiesLogConfiguration(raw, &result) + var result *watsonxdatav3.PrestissimoEnginePropertiesConfiguration + err = watsonxdatav3.UnmarshalPrestissimoEnginePropertiesConfiguration(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalEnginePropertiesOaiGen1Configuration successfully`, func() { + It(`Invoke UnmarshalPrestissimoEnginePropertiesJvm successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.EnginePropertiesOaiGen1Configuration) + model := new(watsonxdatav3.PrestissimoEnginePropertiesJvm) model.Coordinator = map[string]string{"key1": "testString"} - model.Worker = map[string]string{"key1": "testString"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39075,15 +43851,15 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.EnginePropertiesOaiGen1Configuration - err = watsonxdatav2.UnmarshalEnginePropertiesOaiGen1Configuration(raw, &result) + var result *watsonxdatav3.PrestissimoEnginePropertiesJvm + err = watsonxdatav3.UnmarshalPrestissimoEnginePropertiesJvm(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalEnginePropertiesOaiGen1Jvm successfully`, func() { + It(`Invoke UnmarshalPrestissimoEnginePropertiesLogConfig successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.EnginePropertiesOaiGen1Jvm) + model := new(watsonxdatav3.PrestissimoEnginePropertiesLogConfig) model.Coordinator = map[string]string{"key1": "testString"} model.Worker = map[string]string{"key1": "testString"} @@ -39094,17 +43870,21 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.EnginePropertiesOaiGen1Jvm - err = watsonxdatav2.UnmarshalEnginePropertiesOaiGen1Jvm(raw, &result) + var result *watsonxdatav3.PrestissimoEnginePropertiesLogConfig + err = watsonxdatav3.UnmarshalPrestissimoEnginePropertiesLogConfig(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalEnginePropertiesOaiGenConfiguration successfully`, func() { + It(`Invoke UnmarshalPrestoEnginePatch successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.EnginePropertiesOaiGenConfiguration) - model.Coordinator = nil - model.Worker = nil + model := new(watsonxdatav3.PrestoEnginePatch) + model.Description = core.StringPtr("updated description for presto engine") + model.DisplayName = core.StringPtr("sampleEngine") + model.Properties = nil + model.RemoveEngineProperties = nil + model.RestartType = core.StringPtr("force") + model.Tags = []string{"tag1", "tag2"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39113,19 +43893,22 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.EnginePropertiesOaiGenConfiguration - err = watsonxdatav2.UnmarshalEnginePropertiesOaiGenConfiguration(raw, &result) + var result *watsonxdatav3.PrestoEnginePatch + err = watsonxdatav3.UnmarshalPrestoEnginePatch(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalEnrichmentObj successfully`, func() { + It(`Invoke UnmarshalPrestoEngineProperties successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.EnrichmentObj) - model.Catalog = core.StringPtr("iceberg_data") - model.Operation = core.StringPtr("create") - model.Schema = core.StringPtr("testString") - model.Tables = []string{"testString"} + model := new(watsonxdatav3.PrestoEngineProperties) + model.Catalog = nil + model.Configuration = nil + model.EventListener = map[string]string{"key1": "event_listener_property_value"} + model.Global = map[string]string{"key1": "global_property_value"} + model.JmxExporterConfig = map[string]string{"key1": "jmx_exporter_config_property_value"} + model.Jvm = nil + model.LogConfig = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39134,20 +43917,16 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.EnrichmentObj - err = watsonxdatav2.UnmarshalEnrichmentObj(raw, &result) + var result *watsonxdatav3.PrestoEngineProperties + err = watsonxdatav3.UnmarshalPrestoEngineProperties(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalIngestionJobPrototypeCsvProperty successfully`, func() { + It(`Invoke UnmarshalPrestoEnginePropertiesDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.IngestionJobPrototypeCsvProperty) - model.Encoding = core.StringPtr("utf-8") - model.EscapeCharacter = core.StringPtr("\\\\") - model.FieldDelimiter = core.StringPtr(",") - model.Header = core.BoolPtr(true) - model.LineDelimiter = core.StringPtr("\\n") + model := new(watsonxdatav3.PrestoEnginePropertiesDetails) + model.EngineProperties = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39156,20 +43935,22 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.IngestionJobPrototypeCsvProperty - err = watsonxdatav2.UnmarshalIngestionJobPrototypeCsvProperty(raw, &result) + var result *watsonxdatav3.PrestoEnginePropertiesDetails + err = watsonxdatav3.UnmarshalPrestoEnginePropertiesDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalIngestionJobPrototypeExecuteConfig successfully`, func() { + It(`Invoke UnmarshalRemoveEngineProperties successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.IngestionJobPrototypeExecuteConfig) - model.DriverCores = core.Int64Ptr(int64(1)) - model.DriverMemory = core.StringPtr("2G") - model.ExecutorCores = core.Int64Ptr(int64(1)) - model.ExecutorMemory = core.StringPtr("2G") - model.NumExecutors = core.Int64Ptr(int64(1)) + model := new(watsonxdatav3.RemoveEngineProperties) + model.Catalog = nil + model.Configuration = nil + model.EventListener = []string{"property_name"} + model.Global = []string{"property_name"} + model.JmxExporterConfig = []string{"testString"} + model.Jvm = nil + model.LogConfig = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39178,26 +43959,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.IngestionJobPrototypeExecuteConfig - err = watsonxdatav2.UnmarshalIngestionJobPrototypeExecuteConfig(raw, &result) + var result *watsonxdatav3.RemoveEngineProperties + err = watsonxdatav3.UnmarshalRemoveEngineProperties(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalIntegrationPatch successfully`, func() { + It(`Invoke UnmarshalRemoveEnginePropertiesCatalogAdditionalProperties successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.IntegrationPatch) - model.AccessToken = core.StringPtr("uiOO90kklop") - model.Apikey = core.StringPtr("apikey") - model.CrossAccountIntegration = core.BoolPtr(false) - model.EnableDataPolicyWithinWxd = core.BoolPtr(false) - model.IkcUserAccountID = core.StringPtr("abcdefghijklmnopqrstuvwxyz") - model.Password = core.StringPtr("password") - model.Resource = core.StringPtr("presto01") - model.State = core.StringPtr("active") - model.StorageCatalogs = []string{"iceberg_data", "hive_data"} - model.URL = core.StringPtr("ikc.url") - model.Username = core.StringPtr("username@email.com") + model := new(watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties) + model.Coordinator = []string{"property_name"} + model.Worker = []string{"property_name"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39206,19 +43978,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.IntegrationPatch - err = watsonxdatav2.UnmarshalIntegrationPatch(raw, &result) + var result *watsonxdatav3.RemoveEnginePropertiesCatalogAdditionalProperties + err = watsonxdatav3.UnmarshalRemoveEnginePropertiesCatalogAdditionalProperties(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalMilvusServiceBucketPatch successfully`, func() { + It(`Invoke UnmarshalRemoveEnginePropertiesConfiguration successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.MilvusServiceBucketPatch) - model.BucketName = core.StringPtr("Sample bucket name") - model.ManagedBy = core.StringPtr("customer") - model.RootPath = core.StringPtr("Sample path") - model.TshirtSize = core.StringPtr("small") + model := new(watsonxdatav3.RemoveEnginePropertiesConfiguration) + model.Coordinator = []string{"property_name"} + model.Worker = []string{"property_name"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39227,18 +43997,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.MilvusServiceBucketPatch - err = watsonxdatav2.UnmarshalMilvusServiceBucketPatch(raw, &result) + var result *watsonxdatav3.RemoveEnginePropertiesConfiguration + err = watsonxdatav3.UnmarshalRemoveEnginePropertiesConfiguration(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalMilvusServicePatch successfully`, func() { + It(`Invoke UnmarshalRemoveEnginePropertiesJvm successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.MilvusServicePatch) - model.Description = core.StringPtr("updated description for milvus service") - model.ServiceDisplayName = core.StringPtr("sampleService") - model.Tags = []string{"tag1", "tag2"} + model := new(watsonxdatav3.RemoveEnginePropertiesJvm) + model.Coordinator = []string{"property_name"} + model.Worker = []string{"property_name"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39247,16 +44016,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.MilvusServicePatch - err = watsonxdatav2.UnmarshalMilvusServicePatch(raw, &result) + var result *watsonxdatav3.RemoveEnginePropertiesJvm + err = watsonxdatav3.UnmarshalRemoveEnginePropertiesJvm(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalNetezzaEngineDetailsBody successfully`, func() { + It(`Invoke UnmarshalRemoveEnginePropertiesLogConfig successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.NetezzaEngineDetailsBody) - model.ConnectionString = core.StringPtr("1.2.3.4") + model := new(watsonxdatav3.RemoveEnginePropertiesLogConfig) + model.Coordinator = []string{"property_name"} + model.Worker = []string{"property_name"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39265,18 +44035,22 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.NetezzaEngineDetailsBody - err = watsonxdatav2.UnmarshalNetezzaEngineDetailsBody(raw, &result) + var result *watsonxdatav3.RemoveEnginePropertiesLogConfig + err = watsonxdatav3.UnmarshalRemoveEnginePropertiesLogConfig(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalNetezzaEnginePatch successfully`, func() { + It(`Invoke UnmarshalRemovePrestissimoEngineProperties successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.NetezzaEnginePatch) - model.Description = core.StringPtr("netezza engine updated description") - model.EngineDisplayName = core.StringPtr("sampleEngine") - model.Tags = []string{"tag1", "tag2"} + model := new(watsonxdatav3.RemovePrestissimoEngineProperties) + model.Catalog = nil + model.Configuration = nil + model.Global = []string{"testString"} + model.Jvm = nil + model.LogConfig = nil + model.OptimizerProperties = []string{"testString"} + model.Velox = []string{"testString"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39285,17 +44059,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.NetezzaEnginePatch - err = watsonxdatav2.UnmarshalNetezzaEnginePatch(raw, &result) + var result *watsonxdatav3.RemovePrestissimoEngineProperties + err = watsonxdatav3.UnmarshalRemovePrestissimoEngineProperties(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalNodeDescription successfully`, func() { + It(`Invoke UnmarshalRemovePrestissimoEnginePropertiesCatalogAdditionalProperties successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.NodeDescription) - model.NodeType = core.StringPtr("starter") - model.Quantity = core.Int64Ptr(int64(38)) + model := new(watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties) + model.Coordinator = []string{"testString"} + model.Worker = []string{"testString"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39304,17 +44078,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.NodeDescription - err = watsonxdatav2.UnmarshalNodeDescription(raw, &result) + var result *watsonxdatav3.RemovePrestissimoEnginePropertiesCatalogAdditionalProperties + err = watsonxdatav3.UnmarshalRemovePrestissimoEnginePropertiesCatalogAdditionalProperties(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalNodeDescriptionBody successfully`, func() { + It(`Invoke UnmarshalRemovePrestissimoEnginePropertiesConfiguration successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.NodeDescriptionBody) - model.NodeType = core.StringPtr("worker") - model.Quantity = core.Int64Ptr(int64(38)) + model := new(watsonxdatav3.RemovePrestissimoEnginePropertiesConfiguration) + model.Coordinator = []string{"testString"} + model.Worker = []string{"testString"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39323,17 +44097,16 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.NodeDescriptionBody - err = watsonxdatav2.UnmarshalNodeDescriptionBody(raw, &result) + var result *watsonxdatav3.RemovePrestissimoEnginePropertiesConfiguration + err = watsonxdatav3.UnmarshalRemovePrestissimoEnginePropertiesConfiguration(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalOtherEngineDetailsBody successfully`, func() { + It(`Invoke UnmarshalRemovePrestissimoEnginePropertiesJvm successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.OtherEngineDetailsBody) - model.ConnectionString = core.StringPtr("1.2.3.4") - model.EngineType = core.StringPtr("netezza") + model := new(watsonxdatav3.RemovePrestissimoEnginePropertiesJvm) + model.Coordinator = []string{"testString"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39342,16 +44115,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.OtherEngineDetailsBody - err = watsonxdatav2.UnmarshalOtherEngineDetailsBody(raw, &result) + var result *watsonxdatav3.RemovePrestissimoEnginePropertiesJvm + err = watsonxdatav3.UnmarshalRemovePrestissimoEnginePropertiesJvm(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPath successfully`, func() { + It(`Invoke UnmarshalRemovePrestissimoEnginePropertiesLogConfig successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.Path) - model.Path = core.StringPtr("string") + model := new(watsonxdatav3.RemovePrestissimoEnginePropertiesLogConfig) + model.Coordinator = []string{"testString"} + model.Worker = []string{"testString"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39360,22 +44134,18 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.Path - err = watsonxdatav2.UnmarshalPath(raw, &result) + var result *watsonxdatav3.RemovePrestissimoEnginePropertiesLogConfig + err = watsonxdatav3.UnmarshalRemovePrestissimoEnginePropertiesLogConfig(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestissimoEndpoints successfully`, func() { + It(`Invoke UnmarshalResourceDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestissimoEndpoints) - model.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/") - model.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") - model.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-") - model.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") - model.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") - model.ViewHistoryServer = core.StringPtr("testString") - model.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") + model := new(watsonxdatav3.ResourceDetails) + model.ID = core.StringPtr("presto01") + model.Name = core.StringPtr("hive_data") + model.Type = core.StringPtr("presto") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39384,24 +44154,18 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestissimoEndpoints - err = watsonxdatav2.UnmarshalPrestissimoEndpoints(raw, &result) + var result *watsonxdatav3.ResourceDetails + err = watsonxdatav3.UnmarshalResourceDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestissimoEngineDetails successfully`, func() { + It(`Invoke UnmarshalResourceDetailsBulkUpdate successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestissimoEngineDetails) - model.ApiKey = core.StringPtr("") - model.ConnectionString = core.StringPtr("1.2.3.4") - model.Coordinator = nil - model.Endpoints = nil - model.InstanceID = core.StringPtr("instance_id") - model.ManagedBy = core.StringPtr("fully/self") - model.MetastoreHost = core.StringPtr("1.2.3.4") - model.SizeConfig = core.StringPtr("starter") - model.Worker = nil + model := new(watsonxdatav3.ResourceDetailsBulkUpdate) + model.ID = core.StringPtr("presto01") + model.Name = core.StringPtr("hive_data") + model.Type = core.StringPtr("presto") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39410,19 +44174,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestissimoEngineDetails - err = watsonxdatav2.UnmarshalPrestissimoEngineDetails(raw, &result) + var result *watsonxdatav3.ResourceDetailsBulkUpdate + err = watsonxdatav3.UnmarshalResourceDetailsBulkUpdate(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestissimoEngineEngineProperties successfully`, func() { + It(`Invoke UnmarshalRowFilterProperties successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestissimoEngineEngineProperties) - model.Catalog = nil - model.Configuration = nil - model.Velox = nil - model.Jvm = nil + model := new(watsonxdatav3.RowFilterProperties) + model.FilterCondition = core.StringPtr("NIL") + model.RowFilter = core.StringPtr("addr_country='US'") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39431,21 +44193,18 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestissimoEngineEngineProperties - err = watsonxdatav2.UnmarshalPrestissimoEngineEngineProperties(raw, &result) + var result *watsonxdatav3.RowFilterProperties + err = watsonxdatav3.UnmarshalRowFilterProperties(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestissimoEnginePatch successfully`, func() { + It(`Invoke UnmarshalRuleGrantee successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestissimoEnginePatch) - model.Description = core.StringPtr("updated description for prestissimo engine") - model.EngineDisplayName = core.StringPtr("sampleEngine") - model.EngineProperties = nil - model.EngineRestart = core.StringPtr("force") - model.RemoveEngineProperties = nil - model.Tags = []string{"tag1", "tag2"} + model := new(watsonxdatav3.RuleGrantee) + model.Key = core.StringPtr("user_name") + model.Type = core.StringPtr("user_identity") + model.Value = core.StringPtr("user1") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39454,16 +44213,20 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestissimoEnginePatch - err = watsonxdatav2.UnmarshalPrestissimoEnginePatch(raw, &result) + var result *watsonxdatav3.RuleGrantee + err = watsonxdatav3.UnmarshalRuleGrantee(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestissimoEnginePropertiesCatalog successfully`, func() { + It(`Invoke UnmarshalRuleV2 successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestissimoEnginePropertiesCatalog) - model.CatalogName = []string{"testString"} + model := new(watsonxdatav3.RuleV2) + model.Actions = []string{"alter", "create"} + model.Effect = core.StringPtr("allow") + model.Grantees = nil + model.TransformColumns = nil + model.TransformRows = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39472,16 +44235,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestissimoEnginePropertiesCatalog - err = watsonxdatav2.UnmarshalPrestissimoEnginePropertiesCatalog(raw, &result) + var result *watsonxdatav3.RuleV2 + err = watsonxdatav3.UnmarshalRuleV2(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestissimoEnginePropertiesOaiGen1Jvm successfully`, func() { + It(`Invoke UnmarshalSalEnrichmentSettings successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestissimoEnginePropertiesOaiGen1Jvm) - model.Coordinator = map[string]string{"key1": "testString"} + model := new(watsonxdatav3.SalEnrichmentSettings) + model.Expansion = nil + model.TermAssignment = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39490,16 +44254,19 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestissimoEnginePropertiesOaiGen1Jvm - err = watsonxdatav2.UnmarshalPrestissimoEnginePropertiesOaiGen1Jvm(raw, &result) + var result *watsonxdatav3.SalEnrichmentSettings + err = watsonxdatav3.UnmarshalSalEnrichmentSettings(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestissimoEnginePropertiesVelox successfully`, func() { + It(`Invoke UnmarshalSalEnrichmentSettingsExpansion successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestissimoEnginePropertiesVelox) - model.VeloxProperty = []string{"testString"} + model := new(watsonxdatav3.SalEnrichmentSettingsExpansion) + model.Description = core.BoolPtr(true) + model.DescriptionConfiguration = nil + model.Name = core.BoolPtr(true) + model.NameConfiguration = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39508,17 +44275,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestissimoEnginePropertiesVelox - err = watsonxdatav2.UnmarshalPrestissimoEnginePropertiesVelox(raw, &result) + var result *watsonxdatav3.SalEnrichmentSettingsExpansion + err = watsonxdatav3.UnmarshalSalEnrichmentSettingsExpansion(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestissimoNodeDescriptionBody successfully`, func() { + It(`Invoke UnmarshalSalEnrichmentSettingsExpansionDescriptionConfiguration successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestissimoNodeDescriptionBody) - model.NodeType = core.StringPtr("worker") - model.Quantity = core.Int64Ptr(int64(38)) + model := new(watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration) + model.AssignmentThreshold = core.Float64Ptr(float64(0.14)) + model.SuggestionThreshold = core.Float64Ptr(float64(0.9)) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39527,16 +44294,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestissimoNodeDescriptionBody - err = watsonxdatav2.UnmarshalPrestissimoNodeDescriptionBody(raw, &result) + var result *watsonxdatav3.SalEnrichmentSettingsExpansionDescriptionConfiguration + err = watsonxdatav3.UnmarshalSalEnrichmentSettingsExpansionDescriptionConfiguration(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestissimoPropertiesCatalog successfully`, func() { + It(`Invoke UnmarshalSalEnrichmentSettingsExpansionNameConfiguration successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestissimoPropertiesCatalog) - model.CatalogName = nil + model := new(watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration) + model.AssignmentThreshold = core.Float64Ptr(float64(0.1)) + model.SuggestionThreshold = core.Float64Ptr(float64(0.1)) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39545,22 +44313,23 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestissimoPropertiesCatalog - err = watsonxdatav2.UnmarshalPrestissimoPropertiesCatalog(raw, &result) + var result *watsonxdatav3.SalEnrichmentSettingsExpansionNameConfiguration + err = watsonxdatav3.UnmarshalSalEnrichmentSettingsExpansionNameConfiguration(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestoEngineEngineProperties successfully`, func() { + It(`Invoke UnmarshalSalEnrichmentSettingsTermAssignment successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestoEngineEngineProperties) - model.Catalog = nil - model.Configuration = nil - model.EventListener = nil - model.Global = nil - model.Jvm = nil - model.JmxExporterConfig = nil - model.LogConfig = nil + model := new(watsonxdatav3.SalEnrichmentSettingsTermAssignment) + model.ClassBasedAssignments = core.BoolPtr(false) + model.EvaluateNegativeAssignments = core.BoolPtr(false) + model.LlmBasedAssignments = core.BoolPtr(false) + model.MlBasedAssignmentsCustom = core.BoolPtr(false) + model.MlBasedAssignmentsDefault = core.BoolPtr(false) + model.NameMatching = core.BoolPtr(false) + model.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) + model.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39569,21 +44338,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestoEngineEngineProperties - err = watsonxdatav2.UnmarshalPrestoEngineEngineProperties(raw, &result) + var result *watsonxdatav3.SalEnrichmentSettingsTermAssignment + err = watsonxdatav3.UnmarshalSalEnrichmentSettingsTermAssignment(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestoEnginePatch successfully`, func() { + It(`Invoke UnmarshalSalIntegrationPatch successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestoEnginePatch) - model.Description = core.StringPtr("updated description for presto engine") - model.EngineDisplayName = core.StringPtr("sampleEngine") - model.EngineProperties = nil - model.EngineRestart = core.StringPtr("force") - model.RemoveEngineProperties = nil - model.Tags = []string{"tag1", "tag2"} + model := new(watsonxdatav3.SalIntegrationPatch) + model.Apikey = core.StringPtr("67GveYtUdovRFEfnMLYP8x0S1b2mY1BkEGqBYbJK") + model.EngineID = core.StringPtr("presto-01") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39592,22 +44357,20 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestoEnginePatch - err = watsonxdatav2.UnmarshalPrestoEnginePatch(raw, &result) + var result *watsonxdatav3.SalIntegrationPatch + err = watsonxdatav3.UnmarshalSalIntegrationPatch(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestoEnginePatchRemoveEngineProperties successfully`, func() { + It(`Invoke UnmarshalSchemaPrototype successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestoEnginePatchRemoveEngineProperties) - model.Catalog = nil - model.Configuration = nil - model.Jvm = nil - model.EventListener = []string{"testString"} - model.Global = []string{"testString"} - model.JmxExporterConfig = []string{"testString"} - model.LogConfig = nil + model := new(watsonxdatav3.SchemaPrototype) + model.CustomPath = core.StringPtr("sample-path") + model.Hostname = core.StringPtr("db2@hostname.com") + model.Name = core.StringPtr("SampleSchema1") + model.Port = core.Int64Ptr(int64(4553)) + model.StorageName = core.StringPtr("sample-bucket") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39616,16 +44379,18 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestoEnginePatchRemoveEngineProperties - err = watsonxdatav2.UnmarshalPrestoEnginePatchRemoveEngineProperties(raw, &result) + var result *watsonxdatav3.SchemaPrototype + err = watsonxdatav3.UnmarshalSchemaPrototype(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestoEnginePropertiesCatalog successfully`, func() { + It(`Invoke UnmarshalSchemaTransformation successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestoEnginePropertiesCatalog) - model.CatalogName = nil + model := new(watsonxdatav3.SchemaTransformation) + model.OldColumn = core.StringPtr("old_column_name") + model.NewColumn = core.StringPtr("new_column_name") + model.NewType = core.StringPtr("string") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39634,16 +44399,18 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestoEnginePropertiesCatalog - err = watsonxdatav2.UnmarshalPrestoEnginePropertiesCatalog(raw, &result) + var result *watsonxdatav3.SchemaTransformation + err = watsonxdatav3.UnmarshalSchemaTransformation(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestoEnginePropertiesEventListener successfully`, func() { + It(`Invoke UnmarshalSecretDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestoEnginePropertiesEventListener) - model.EventListenerProperty = core.StringPtr("testString") + model := new(watsonxdatav3.SecretDetails) + model.Key = core.StringPtr("secret key") + model.SecretName = core.StringPtr("secret name") + model.SecretUrn = core.StringPtr("secret urn") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39652,16 +44419,19 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestoEnginePropertiesEventListener - err = watsonxdatav2.UnmarshalPrestoEnginePropertiesEventListener(raw, &result) + var result *watsonxdatav3.SecretDetails + err = watsonxdatav3.UnmarshalSecretDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestoEnginePropertiesGlobal successfully`, func() { + It(`Invoke UnmarshalSemanticSearchBodySearchConfig successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestoEnginePropertiesGlobal) - model.GlobalProperty = core.StringPtr("enable-mixed-case-support:true") + model := new(watsonxdatav3.SemanticSearchBodySearchConfig) + model.ColumnSearchEnabled = core.BoolPtr(true) + model.Fields = []string{"metadata.name", "metadata.description", "metadata.tags"} + model.MaxResultNumber = core.Int64Ptr(int64(1)) + model.SchemaSearchEnabled = core.BoolPtr(true) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39670,16 +44440,27 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestoEnginePropertiesGlobal - err = watsonxdatav2.UnmarshalPrestoEnginePropertiesGlobal(raw, &result) + var result *watsonxdatav3.SemanticSearchBodySearchConfig + err = watsonxdatav3.UnmarshalSemanticSearchBodySearchConfig(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPrestoEnginePropertiesJMX successfully`, func() { + It(`Invoke UnmarshalSourceDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PrestoEnginePropertiesJMX) - model.GlobalProperty = core.StringPtr("watsonx_data_presto_cluster_memory_manager_cluster_memory_bytes:presto.memory<>ClusterMemoryBytes") + model := new(watsonxdatav3.SourceDetails) + model.FilePaths = core.StringPtr("testString") + model.FileType = core.StringPtr("csv") + model.SourceType = core.StringPtr("STORAGE") + model.Schema = nil + model.SchemaTransformations = nil + model.SchemaName = core.StringPtr("testString") + model.TableName = core.StringPtr("testString") + model.BucketDetails = nil + model.IcebergSourceTable = nil + model.SourceDatabase = nil + model.FileFormatProperties = nil + model.IsLocalIngestion = core.BoolPtr(false) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39688,20 +44469,28 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PrestoEnginePropertiesJMX - err = watsonxdatav2.UnmarshalPrestoEnginePropertiesJMX(raw, &result) + var result *watsonxdatav3.SourceDetails + err = watsonxdatav3.UnmarshalSourceDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalPreviewIngestionFilePrototypeCsvProperty successfully`, func() { + It(`Invoke UnmarshalSparkApplicationDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.PreviewIngestionFilePrototypeCsvProperty) - model.Encoding = core.StringPtr("utf-8") - model.EscapeCharacter = core.StringPtr("\\\\") - model.FieldDelimiter = core.StringPtr(",") - model.Header = core.BoolPtr(true) - model.LineDelimiter = core.StringPtr("\\n") + model := new(watsonxdatav3.SparkApplicationDetails) + model.Application = core.StringPtr("s3://mybucket/wordcount.py") + model.Archives = core.StringPtr("s3://mybucket/myarchive.zip") + model.Arguments = []string{"people.txt"} + model.Class = core.StringPtr("org.apache.spark.examples.SparkPi") + model.Conf = map[string]string{"key1": "configuration"} + model.Env = map[string]string{"key1": "configuration"} + model.Files = core.StringPtr("s3://mybucket/myfile.txt") + model.Jars = core.StringPtr("testString") + model.Name = core.StringPtr("SparkApplicaton1") + model.Packages = core.StringPtr("org.apache.spark:example_1.2.3") + model.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") + model.Runtime = nil + model.SparkVersion = core.StringPtr("3.3") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39710,19 +44499,16 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.PreviewIngestionFilePrototypeCsvProperty - err = watsonxdatav2.UnmarshalPreviewIngestionFilePrototypeCsvProperty(raw, &result) + var result *watsonxdatav3.SparkApplicationDetails + err = watsonxdatav3.UnmarshalSparkApplicationDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalRemoveEngineProperties successfully`, func() { + It(`Invoke UnmarshalSparkApplicationRuntime successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.RemoveEngineProperties) - model.Catalog = nil - model.Configuration = nil - model.Jvm = nil - model.Velox = []string{"testString"} + model := new(watsonxdatav3.SparkApplicationRuntime) + model.SparkVersion = core.StringPtr("3.4") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39731,17 +44517,25 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.RemoveEngineProperties - err = watsonxdatav2.UnmarshalRemoveEngineProperties(raw, &result) + var result *watsonxdatav3.SparkApplicationRuntime + err = watsonxdatav3.UnmarshalSparkApplicationRuntime(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalRemoveEnginePropertiesConfiguration successfully`, func() { + It(`Invoke UnmarshalSparkEndpoints successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.RemoveEnginePropertiesConfiguration) - model.Coordinator = []string{"testString"} - model.Worker = []string{"testString"} + model := new(watsonxdatav3.SparkEndpoints) + model.ApplicationsApi = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications/application_id") + model.HistoryServerEndpoint = core.StringPtr("$HOST/v2/spark/v3/instances/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_history_server") + model.SparkAccessEndpoint = core.StringPtr("$HOST/analytics-engine/details/spark-instance_id") + model.SparkJobsV4Endpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/spark_applications") + model.SparkKernelEndpoint = core.StringPtr("$HOST/v4/analytics_engines/c7b3fccf-badb-46b0-b1ef-9b3154424021/jkg/api/kernels") + model.ViewHistoryServer = core.StringPtr("testString") + model.WxdApplicationEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/applications") + model.WxdEngineEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817") + model.WxdHistoryServerEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server") + model.WxdHistoryServerUiEndpoint = core.StringPtr("$HOST/v1/1698311655308796/engines/spark817/history_server/ui") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39750,17 +44544,16 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.RemoveEnginePropertiesConfiguration - err = watsonxdatav2.UnmarshalRemoveEnginePropertiesConfiguration(raw, &result) + var result *watsonxdatav3.SparkEndpoints + err = watsonxdatav3.UnmarshalSparkEndpoints(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalRemoveEnginePropertiesLogConfig successfully`, func() { + It(`Invoke UnmarshalSparkEngineApplicationCallback successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.RemoveEnginePropertiesLogConfig) - model.Coordinator = []string{"testString"} - model.Worker = []string{"testString"} + model := new(watsonxdatav3.SparkEngineApplicationCallback) + model.URL = core.StringPtr("testString") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39769,17 +44562,29 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.RemoveEnginePropertiesLogConfig - err = watsonxdatav2.UnmarshalRemoveEnginePropertiesLogConfig(raw, &result) + var result *watsonxdatav3.SparkEngineApplicationCallback + err = watsonxdatav3.UnmarshalSparkEngineApplicationCallback(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalRemoveEnginePropertiesOaiGenConfiguration successfully`, func() { + It(`Invoke UnmarshalSparkEngineDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.RemoveEnginePropertiesOaiGenConfiguration) - model.Coordinator = []string{"testString"} - model.Worker = []string{"testString"} + model := new(watsonxdatav3.SparkEngineDetails) + model.ApiKey = core.StringPtr("apikey") + model.ConnectionString = core.StringPtr("https://xyz.region.ae.cloud.123.com/v3/analytics_engines/spark_iae_id") + model.DefaultConfig = map[string]string{"key1": "configuration"} + model.DefaultVersion = core.StringPtr("4.8.3") + model.Endpoints = nil + model.EngineHome = nil + model.EngineSubType = core.StringPtr("java") + model.InstanceID = core.StringPtr("spark-id") + model.ManagedBy = core.StringPtr("fully") + model.ResourceLimitEnabled = core.BoolPtr(true) + model.ResourceLimits = nil + model.ResourceUtilisation = nil + model.ScaleConfig = nil + model.VscodeConfig = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39788,17 +44593,20 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.RemoveEnginePropertiesOaiGenConfiguration - err = watsonxdatav2.UnmarshalRemoveEnginePropertiesOaiGenConfiguration(raw, &result) + var result *watsonxdatav3.SparkEngineDetails + err = watsonxdatav3.UnmarshalSparkEngineDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalRemoveEnginePropertiesOaiGenJvm successfully`, func() { + It(`Invoke UnmarshalSparkEngineHome successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.RemoveEnginePropertiesOaiGenJvm) - model.Coordinator = []string{"testString"} - model.Worker = []string{"testString"} + model := new(watsonxdatav3.SparkEngineHome) + model.Path = core.StringPtr("spark/spark1234") + model.StorageName = core.StringPtr("test-spark-storage") + model.Volume = core.StringPtr("test-spark-volume") + model.VolumeID = core.StringPtr("1704979825978585") + model.VolumeName = core.StringPtr("my-volume") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39807,16 +44615,16 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.RemoveEnginePropertiesOaiGenJvm - err = watsonxdatav2.UnmarshalRemoveEnginePropertiesOaiGenJvm(raw, &result) + var result *watsonxdatav3.SparkEngineHome + err = watsonxdatav3.UnmarshalSparkEngineHome(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalRemoveEnginePropertiesPrestissimoOaiGenJvm successfully`, func() { + It(`Invoke UnmarshalSparkEngineHomePatch successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.RemoveEnginePropertiesPrestissimoOaiGenJvm) - model.Coordinator = []string{"testString"} + model := new(watsonxdatav3.SparkEngineHomePatch) + model.StorageName = core.StringPtr("test-spark-storage") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39825,17 +44633,19 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.RemoveEnginePropertiesPrestissimoOaiGenJvm - err = watsonxdatav2.UnmarshalRemoveEnginePropertiesPrestissimoOaiGenJvm(raw, &result) + var result *watsonxdatav3.SparkEngineHomePatch + err = watsonxdatav3.UnmarshalSparkEngineHomePatch(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSalIntegrationEnrichmentSettings successfully`, func() { + It(`Invoke UnmarshalSparkEnginePatch successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SalIntegrationEnrichmentSettings) - model.SemanticExpansion = nil - model.TermAssignment = nil + model := new(watsonxdatav3.SparkEnginePatch) + model.Configuration = nil + model.Description = core.StringPtr("updated description for spark engine") + model.DisplayName = core.StringPtr("sampleEngine") + model.Tags = []string{"tag1", "tag2"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39844,19 +44654,20 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SalIntegrationEnrichmentSettings - err = watsonxdatav2.UnmarshalSalIntegrationEnrichmentSettings(raw, &result) + var result *watsonxdatav3.SparkEnginePatch + err = watsonxdatav3.UnmarshalSparkEnginePatch(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansion successfully`, func() { + It(`Invoke UnmarshalSparkEnginePatchEngineDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion) - model.DescriptionGeneration = core.BoolPtr(true) - model.DescriptionGenerationConfiguration = nil - model.NameExpansion = core.BoolPtr(true) - model.NameExpansionConfiguration = nil + model := new(watsonxdatav3.SparkEnginePatchEngineDetails) + model.DefaultConfig = map[string]string{"key1": "configuration"} + model.DefaultVersion = core.StringPtr("4.8.3") + model.EngineHome = nil + model.ResourceLimitEnabled = core.BoolPtr(true) + model.ResourceLimits = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39865,17 +44676,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansion - err = watsonxdatav2.UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansion(raw, &result) + var result *watsonxdatav3.SparkEnginePatchEngineDetails + err = watsonxdatav3.UnmarshalSparkEnginePatchEngineDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration successfully`, func() { + It(`Invoke UnmarshalSparkEngineResourceLimit successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration) - model.AssignmentThreshold = core.Float64Ptr(float64(0.14)) - model.SuggestionThreshold = core.Float64Ptr(float64(0.9)) + model := new(watsonxdatav3.SparkEngineResourceLimit) + model.Cores = core.StringPtr("1") + model.Memory = core.StringPtr("4G") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39884,17 +44695,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration - err = watsonxdatav2.UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansionDescriptionGenerationConfiguration(raw, &result) + var result *watsonxdatav3.SparkEngineResourceLimit + err = watsonxdatav3.UnmarshalSparkEngineResourceLimit(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration successfully`, func() { + It(`Invoke UnmarshalSparkEngineResourceUtilisation successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration) - model.AssignmentThreshold = core.Float64Ptr(float64(0.1)) - model.SuggestionThreshold = core.Float64Ptr(float64(0.1)) + model := new(watsonxdatav3.SparkEngineResourceUtilisation) + model.Cores = core.StringPtr("1m") + model.Memory = core.StringPtr("4Gi") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39903,23 +44714,21 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration - err = watsonxdatav2.UnmarshalSalIntegrationEnrichmentSettingsSemanticExpansionNameExpansionConfiguration(raw, &result) + var result *watsonxdatav3.SparkEngineResourceUtilisation + err = watsonxdatav3.UnmarshalSparkEngineResourceUtilisation(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSalIntegrationEnrichmentSettingsTermAssignment successfully`, func() { + It(`Invoke UnmarshalSparkScaleConfig successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment) - model.ClassBasedAssignments = core.BoolPtr(false) - model.EvaluateNegativeAssignments = core.BoolPtr(false) - model.LlmBasedAssignments = core.BoolPtr(false) - model.MlBasedAssignmentsCustom = core.BoolPtr(false) - model.MlBasedAssignmentsDefault = core.BoolPtr(false) - model.NameMatching = core.BoolPtr(false) - model.TermAssignmentThreshold = core.Float64Ptr(float64(0.3)) - model.TermSuggestionThreshold = core.Float64Ptr(float64(0.4)) + model := new(watsonxdatav3.SparkScaleConfig) + model.AutoScaleEnabled = core.BoolPtr(true) + model.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) + model.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) + model.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) + model.NodeType = core.StringPtr("medium") + model.NumberOfNodes = core.Int64Ptr(int64(2)) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39928,18 +44737,19 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SalIntegrationEnrichmentSettingsTermAssignment - err = watsonxdatav2.UnmarshalSalIntegrationEnrichmentSettingsTermAssignment(raw, &result) + var result *watsonxdatav3.SparkScaleConfig + err = watsonxdatav3.UnmarshalSparkScaleConfig(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSalIntegrationPatch successfully`, func() { + It(`Invoke UnmarshalSparkVolumeDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SalIntegrationPatch) - model.Op = core.StringPtr("add") - model.Path = core.StringPtr("storage") - model.Value = core.StringPtr("new-apikey") + model := new(watsonxdatav3.SparkVolumeDetails) + model.MountPath = core.StringPtr("/mount/path") + model.Name = core.StringPtr("my-volume") + model.ReadOnly = core.BoolPtr(true) + model.SourceSubPath = core.StringPtr("/source/path") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39948,16 +44758,19 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SalIntegrationPatch - err = watsonxdatav2.UnmarshalSalIntegrationPatch(raw, &result) + var result *watsonxdatav3.SparkVolumeDetails + err = watsonxdatav3.UnmarshalSparkVolumeDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSparkApplicationConfig successfully`, func() { + It(`Invoke UnmarshalSparkVscodeConfig successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SparkApplicationConfig) - model.SparkSampleConfigProperpty = core.StringPtr("testString") + model := new(watsonxdatav3.SparkVscodeConfig) + model.Crn = core.StringPtr("crn:v1:staging:public:lakehouse:us-east:a/9aa2b62f2a644ffb9e004451dc631307:00924abc-59a3-45bc-a2c0-58bbccf89ee2") + model.EnvironmentType = core.StringPtr("SaaS") + model.Host = core.StringPtr("us-south.lakehouse.dev.cloud.ibm.com") + model.UserName = core.StringPtr("user@example.com") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39966,26 +44779,19 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SparkApplicationConfig - err = watsonxdatav2.UnmarshalSparkApplicationConfig(raw, &result) + var result *watsonxdatav3.SparkVscodeConfig + err = watsonxdatav3.UnmarshalSparkVscodeConfig(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSparkApplicationDetails successfully`, func() { + It(`Invoke UnmarshalStorageCatalogPrototype successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SparkApplicationDetails) - model.Application = core.StringPtr("s3://mybucket/wordcount.py") - model.Arguments = []string{"people.txt"} - model.Class = core.StringPtr("org.apache.spark.examples.SparkPi") - model.Conf = nil - model.Env = nil - model.Files = core.StringPtr("s3://mybucket/myfile.txt") - model.Jars = core.StringPtr("testString") - model.Name = core.StringPtr("SparkApplicaton1") - model.Packages = core.StringPtr("org.apache.spark:example_1.2.3") - model.Repositories = core.StringPtr("https://repo1.maven.org/maven2/") - model.SparkVersion = core.StringPtr("3.3") + model := new(watsonxdatav3.StorageCatalogPrototype) + model.BasePath = core.StringPtr("/abc/def") + model.CatalogName = core.StringPtr("sampleCatalog") + model.CatalogTags = []string{"catalog_tag_1", "catalog_tag_2"} + model.CatalogType = core.StringPtr("iceberg") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -39994,16 +44800,32 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SparkApplicationDetails - err = watsonxdatav2.UnmarshalSparkApplicationDetails(raw, &result) + var result *watsonxdatav3.StorageCatalogPrototype + err = watsonxdatav3.UnmarshalStorageCatalogPrototype(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSparkApplicationEnv successfully`, func() { + It(`Invoke UnmarshalStorageDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SparkApplicationEnv) - model.SampleEnvKey = core.StringPtr("testString") + model := new(watsonxdatav3.StorageDetails) + model.AccessKey = core.StringPtr("") + model.AccessKeyVault = nil + model.AccountName = core.StringPtr("sample-storage") + model.ApplicationID = core.StringPtr("application-id") + model.AuthMode = core.StringPtr("iam") + model.ContainerName = core.StringPtr("sample-container") + model.DirectoryID = core.StringPtr("directory-id") + model.Endpoint = core.StringPtr("https://s3.us-south.cloud-object-storage.appdomain.cloud/") + model.KeyFile = core.StringPtr("key_file") + model.Name = core.StringPtr("sample-storage") + model.Provider = core.StringPtr("ibm-cos") + model.Region = core.StringPtr("us-south") + model.RoleArn = core.StringPtr("arn:aws:iam::5ssdd5467-002c-a4f8cac3f3f9") + model.SasToken = core.StringPtr("") + model.SecretKey = core.StringPtr("secret_key") + model.SecretKeyVault = nil + model.VaultEnabled = core.BoolPtr(true) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -40012,17 +44834,18 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SparkApplicationEnv - err = watsonxdatav2.UnmarshalSparkApplicationEnv(raw, &result) + var result *watsonxdatav3.StorageDetails + err = watsonxdatav3.UnmarshalStorageDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSparkDefaultConfig successfully`, func() { + It(`Invoke UnmarshalStorageDetailsAccesskeyVault successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SparkDefaultConfig) - model.Config1 = core.StringPtr("testString") - model.Config2 = core.StringPtr("testString") + model := new(watsonxdatav3.StorageDetailsAccesskeyVault) + model.Key = core.StringPtr("secret key") + model.SecretName = core.StringPtr("secret name") + model.SecretUrn = core.StringPtr("secret urn") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -40031,30 +44854,20 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SparkDefaultConfig - err = watsonxdatav2.UnmarshalSparkDefaultConfig(raw, &result) + var result *watsonxdatav3.StorageDetailsAccesskeyVault + err = watsonxdatav3.UnmarshalStorageDetailsAccesskeyVault(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSparkEngineDetailsPrototype successfully`, func() { + It(`Invoke UnmarshalStorageRegistrationPatch successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SparkEngineDetailsPrototype) - model.ApiKey = core.StringPtr("apikey") - model.ConnectionString = core.StringPtr("1.2.3.4") - model.DefaultConfig = nil - model.DefaultVersion = core.StringPtr("4.8.3") - model.EngineHomeBucketDisplayName = core.StringPtr("test-spark-bucket") - model.EngineHomeBucketName = core.StringPtr("test-spark-bucket") - model.EngineHomePath = core.StringPtr("spark/spark1234") - model.EngineHomeVolumeID = core.StringPtr("1704979825978585") - model.EngineHomeVolumeName = core.StringPtr("my-volume") - model.EngineHomeVolumeStorageClass = core.StringPtr("nfs-client") - model.EngineHomeVolumeStorageSize = core.StringPtr("5Gi") - model.EngineSubType = core.StringPtr("java/cpp") - model.InstanceID = core.StringPtr("spark-id") - model.ManagedBy = core.StringPtr("fully/self") - model.ScaleConfig = nil + model := new(watsonxdatav3.StorageRegistrationPatch) + model.Connection = nil + model.Description = core.StringPtr("COS storage for customer data") + model.DisplayName = core.StringPtr("sample-storage-displayname") + model.SystemStorageUpdateCredentials = core.BoolPtr(true) + model.Tags = []string{"teststorage", "userstorage"} b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -40063,17 +44876,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SparkEngineDetailsPrototype - err = watsonxdatav2.UnmarshalSparkEngineDetailsPrototype(raw, &result) + var result *watsonxdatav3.StorageRegistrationPatch + err = watsonxdatav3.UnmarshalStorageRegistrationPatch(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSparkEngineResourceLimit successfully`, func() { + It(`Invoke UnmarshalSubject successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SparkEngineResourceLimit) - model.Cores = core.StringPtr("1") - model.Memory = core.StringPtr("4G") + model := new(watsonxdatav3.Subject) + model.Type = core.StringPtr("user") + model.Value = core.StringPtr("user1") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -40082,21 +44895,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SparkEngineResourceLimit - err = watsonxdatav2.UnmarshalSparkEngineResourceLimit(raw, &result) + var result *watsonxdatav3.Subject + err = watsonxdatav3.UnmarshalSubject(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSparkScaleConfig successfully`, func() { + It(`Invoke UnmarshalSubjectBulkUpdate successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SparkScaleConfig) - model.AutoScaleEnabled = core.BoolPtr(true) - model.CurrentNumberOfNodes = core.Int64Ptr(int64(2)) - model.MaximumNumberOfNodes = core.Int64Ptr(int64(5)) - model.MinimumNumberOfNodes = core.Int64Ptr(int64(1)) - model.NodeType = core.StringPtr("medium") - model.NumberOfNodes = core.Int64Ptr(int64(2)) + model := new(watsonxdatav3.SubjectBulkUpdate) + model.Permissions = []string{"testString"} + model.Subject = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -40105,19 +44914,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SparkScaleConfig - err = watsonxdatav2.UnmarshalSparkScaleConfig(raw, &result) + var result *watsonxdatav3.SubjectBulkUpdate + err = watsonxdatav3.UnmarshalSubjectBulkUpdate(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSparkVolumeDetails successfully`, func() { + It(`Invoke UnmarshalSubjectRevoke successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SparkVolumeDetails) - model.MountPath = core.StringPtr("/mount/path") - model.Name = core.StringPtr("my-volume") - model.ReadOnly = core.BoolPtr(true) - model.SourceSubPath = core.StringPtr("/source/path") + model := new(watsonxdatav3.SubjectRevoke) + model.Permissions = []string{"testString"} + model.Subject = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -40126,24 +44933,16 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SparkVolumeDetails - err = watsonxdatav2.UnmarshalSparkVolumeDetails(raw, &result) + var result *watsonxdatav3.SubjectRevoke + err = watsonxdatav3.UnmarshalSubjectRevoke(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalStorageDetails successfully`, func() { + It(`Invoke UnmarshalTablePatch successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.StorageDetails) - model.AccessKey = core.StringPtr("") - model.ApplicationID = core.StringPtr("") - model.AuthMode = core.StringPtr("") - model.ContainerName = core.StringPtr("sample-container") - model.DirectoryID = core.StringPtr("") - model.Endpoint = core.StringPtr("abfss://@.dfs.core.windows.net/") - model.SasToken = core.StringPtr("") - model.SecretKey = core.StringPtr("secret_key") - model.StorageAccountName = core.StringPtr("sample-storage") + model := new(watsonxdatav3.TablePatch) + model.Name = core.StringPtr("updated_table_name") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -40152,17 +44951,27 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.StorageDetails - err = watsonxdatav2.UnmarshalStorageDetails(raw, &result) + var result *watsonxdatav3.TablePatch + err = watsonxdatav3.UnmarshalTablePatch(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalSyncCatalogs successfully`, func() { + It(`Invoke UnmarshalTargetDetails successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.SyncCatalogs) - model.AutoAddNewTables = core.BoolPtr(true) - model.SyncIcebergMd = core.BoolPtr(true) + model := new(watsonxdatav3.TargetDetails) + model.Catalog = core.StringPtr("testString") + model.Schema = core.StringPtr("testString") + model.Table = core.StringPtr("testString") + model.WriteMode = core.StringPtr("testString") + model.MergeOnRead = core.BoolPtr(false) + model.SchemaMode = core.StringPtr("testString") + model.SchemaInfer = core.BoolPtr(true) + model.CatalogURI = core.StringPtr("testString") + model.BucketDetails = nil + model.Location = core.StringPtr("testString") + model.IsNewSchema = core.BoolPtr(false) + model.IsNewTable = core.BoolPtr(false) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -40171,16 +44980,18 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.SyncCatalogs - err = watsonxdatav2.UnmarshalSyncCatalogs(raw, &result) + var result *watsonxdatav3.TargetDetails + err = watsonxdatav3.UnmarshalTargetDetails(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalTablePatch successfully`, func() { + It(`Invoke UnmarshalTransformColumnProperties successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.TablePatch) - model.TableName = core.StringPtr("updated_table_name") + model := new(watsonxdatav3.TransformColumnProperties) + model.MaskCondition = core.StringPtr("NIL") + model.MaskType = core.StringPtr("mask_show_last_4") + model.MaskValue = core.StringPtr("NIL") b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -40189,19 +45000,16 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.TablePatch - err = watsonxdatav2.UnmarshalTablePatch(raw, &result) + var result *watsonxdatav3.TransformColumnProperties + err = watsonxdatav3.UnmarshalTransformColumnProperties(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalUpdateSparkEngineBody successfully`, func() { + It(`Invoke UnmarshalUpdateAutoScalingRequest successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.UpdateSparkEngineBody) - model.Description = core.StringPtr("updated description for spark engine") - model.EngineDetails = nil - model.EngineDisplayName = core.StringPtr("sampleEngine") - model.Tags = []string{"tag1", "tag2"} + model := new(watsonxdatav3.UpdateAutoScalingRequest) + model.AutoscalingConfig = nil b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -40210,20 +45018,17 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.UpdateSparkEngineBody - err = watsonxdatav2.UnmarshalUpdateSparkEngineBody(raw, &result) + var result *watsonxdatav3.UpdateAutoScalingRequest + err = watsonxdatav3.UnmarshalUpdateAutoScalingRequest(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model)) }) - It(`Invoke UnmarshalUpdateSparkEngineBodyEngineDetails successfully`, func() { + It(`Invoke UnmarshalWorkerNodeDescriptionBody successfully`, func() { // Construct an instance of the model. - model := new(watsonxdatav2.UpdateSparkEngineBodyEngineDetails) - model.DefaultConfig = map[string]string{"key1": "testString"} - model.DefaultVersion = core.StringPtr("4.8.3") - model.EngineHomeBucketName = core.StringPtr("test-spark-bucket") - model.ResourceLimitEnabled = core.BoolPtr(true) - model.ResourceLimits = nil + model := new(watsonxdatav3.WorkerNodeDescriptionBody) + model.NodeType = core.StringPtr("starter") + model.Quantity = core.Int64Ptr(int64(1)) b, err := json.Marshal(model) Expect(err).To(BeNil()) @@ -40232,8 +45037,8 @@ var _ = Describe(`WatsonxDataV2`, func() { err = json.Unmarshal(b, &raw) Expect(err).To(BeNil()) - var result *watsonxdatav2.UpdateSparkEngineBodyEngineDetails - err = watsonxdatav2.UnmarshalUpdateSparkEngineBodyEngineDetails(raw, &result) + var result *watsonxdatav3.WorkerNodeDescriptionBody + err = watsonxdatav3.UnmarshalWorkerNodeDescriptionBody(raw, &result) Expect(err).To(BeNil()) Expect(result).ToNot(BeNil()) Expect(result).To(Equal(model))